Upgrade to Rails 2.0.2

Upgraded to Rails 2.0.2, except that we maintain

   vendor/rails/actionpack/lib/action_controller/routing.rb

from Rail 1.2.6 (at least for now), so that Routes don't change. We still
get to enjoy Rails's many new features.

Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
This commit is contained in:
Jacques Distler 2007-12-21 01:48:59 -06:00
parent 0f6889e09f
commit 6873fc8026
1083 changed files with 52810 additions and 41058 deletions

View file

@ -1 +0,0 @@
require 'breakpoint_client'

View file

@ -10,16 +10,23 @@ OptionParser.new do |opt|
end
libs = " -r irb/completion"
libs << " -r #{RAILS_ROOT}/config/environment"
libs << %( -r "#{RAILS_ROOT}/config/environment")
libs << " -r console_app"
libs << " -r console_sandbox" if options[:sandbox]
libs << " -r console_with_helpers"
ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development'
ENV['RAILS_ENV'] = case ARGV.first
when "p": "production"
when "d": "development"
when "t": "test"
else
ARGV.first || ENV['RAILS_ENV'] || 'development'
end
if options[:sandbox]
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox."
puts "Any modifications you make will be rolled back on exit."
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox (Rails #{Rails::VERSION::STRING})"
puts "Any modifications you make will be rolled back on exit"
else
puts "Loading #{ENV['RAILS_ENV']} environment."
puts "Loading #{ENV['RAILS_ENV']} environment (Rails #{Rails::VERSION::STRING})"
end
exec "#{options[:irb]} #{libs} --simple-prompt"

View file

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require 'config/environment'
require 'application'
require 'action_controller/request_profiler'
ActionController::RequestProfiler.run(ARGV)

View file

@ -91,7 +91,7 @@ class RailsEnvironment
unless plugin.nil?
plugin.install
else
puts "plugin not found: #{name_uri_or_plugin}"
puts "Plugin not found: #{name_uri_or_plugin}"
end
end
@ -214,12 +214,12 @@ class Plugin
def run_install_hook
install_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/install.rb"
load install_hook_file if File.exists? install_hook_file
load install_hook_file if File.exist? install_hook_file
end
def run_uninstall_hook
uninstall_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/uninstall.rb"
load uninstall_hook_file if File.exists? uninstall_hook_file
load uninstall_hook_file if File.exist? uninstall_hook_file
end
def install_using_export(options = {})
@ -239,10 +239,10 @@ class Plugin
def install_using_http(options = {})
root = rails_env.root
mkdir_p "#{root}/vendor/plugins"
Dir.chdir "#{root}/vendor/plugins" do
mkdir_p "#{root}/vendor/plugins/#{@name}"
Dir.chdir "#{root}/vendor/plugins/#{@name}" do
puts "fetching from '#{uri}'" if $verbose
fetcher = RecursiveHTTPFetcher.new(uri)
fetcher = RecursiveHTTPFetcher.new(uri, -1)
fetcher.quiet = true if options[:quiet]
fetcher.fetch
end
@ -515,7 +515,7 @@ module Commands
o.on( "--local",
"List locally installed plugins.") {|@local| @remote = false}
o.on( "--remote",
"List remotely availabled plugins. This is the default behavior",
"List remotely available plugins. This is the default behavior",
"unless --local is provided.") {|@remote|}
end
end
@ -765,8 +765,9 @@ module Commands
args.each do |name|
::Plugin.find(name).install(install_method, @options)
end
rescue
rescue StandardError => e
puts "Plugin not found: #{args.inspect}"
puts e.inspect if $verbose
exit 1
end
end
@ -853,7 +854,8 @@ end
class RecursiveHTTPFetcher
attr_accessor :quiet
def initialize(urls_to_fetch, cwd = ".")
def initialize(urls_to_fetch, level = 1, cwd = ".")
@level = level
@cwd = cwd
@urls_to_fetch = urls_to_fetch.to_a
@quiet = false
@ -884,7 +886,8 @@ class RecursiveHTTPFetcher
links = []
contents.scan(/href\s*=\s*\"*[^\">]*/i) do |link|
link = link.sub(/href="/i, "")
next if link =~ /^http/i || link =~ /^\./
next if link =~ /svnindex.xsl$/
next if link =~ /^(\w*:|)\/\// || link =~ /^\./
links << File.join(base_url, link)
end
links
@ -906,12 +909,14 @@ class RecursiveHTTPFetcher
end
def fetch_dir(url)
push_d(File.basename(url))
@level += 1
push_d(File.basename(url)) if @level > 0
open(url) do |stream|
contents = stream.read
fetch(links(url, contents))
end
pop_d
pop_d if @level > 0
@level -= 1
end
end

View file

@ -65,6 +65,14 @@ class MongrelSpawner < Spawner
"-c #{OPTIONS[:rails_root]} " +
"-l #{OPTIONS[:rails_root]}/log/mongrel.log"
# Add prefix functionality to spawner's call to mongrel_rails
# Digging through monrel's project subversion server, the earliest
# Tag that has prefix implemented in the bin/mongrel_rails file
# is 0.3.15 which also happens to be the earilest tag listed.
# References: http://mongrel.rubyforge.org/svn/tags
if Mongrel::Const::MONGREL_VERSION.to_f >=0.3 && !OPTIONS[:prefix].nil?
cmd = cmd + " --prefix #{OPTIONS[:prefix]}"
end
system(cmd)
end
@ -114,14 +122,15 @@ end
OPTIONS = {
:environment => "production",
:spawner => '/usr/bin/env spawn-fcgi',
:dispatcher => File.expand_path(RAILS_ROOT + '/public/dispatch.fcgi'),
:pids => File.expand_path(RAILS_ROOT + "/tmp/pids"),
:rails_root => File.expand_path(RAILS_ROOT),
:dispatcher => File.expand_path(RELATIVE_RAILS_ROOT + '/public/dispatch.fcgi'),
:pids => File.expand_path(RELATIVE_RAILS_ROOT + "/tmp/pids"),
:rails_root => File.expand_path(RELATIVE_RAILS_ROOT),
:process => "dispatch",
:port => 8000,
:address => '0.0.0.0',
:instances => 3,
:repeat => nil
:repeat => nil,
:prefix => nil
}
ARGV.options do |opts|
@ -182,6 +191,7 @@ ARGV.options do |opts|
opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |v| OPTIONS[:instances] = v }
opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |v| OPTIONS[:repeat] = v }
opts.on("-e", "--environment=name", String, "test|development|production (default: #{OPTIONS[:environment]})") { |v| OPTIONS[:environment] = v }
opts.on("-P", "--prefix=path", String, "URL prefix for Rails app. [Used only with Mongrel > v0.3.15]: (default: #{OPTIONS[:prefix]})") { |v| OPTIONS[:prefix] = v }
opts.on("-n", "--process=name", String, "default: #{OPTIONS[:process]}") { |v| OPTIONS[:process] = v }
opts.on("-s", "--spawner=path", String, "default: #{OPTIONS[:spawner]}") { |v| OPTIONS[:spawner] = v }
opts.on("-d", "--dispatcher=path", String, "default: #{OPTIONS[:dispatcher]}") { |dispatcher| OPTIONS[:dispatcher] = File.expand_path(dispatcher) }

View file

@ -41,7 +41,7 @@ require RAILS_ROOT + '/config/environment'
if code_or_file.nil?
$stderr.puts "Run '#{$0} -h' for help."
exit 1
elsif File.exists?(code_or_file)
elsif File.exist?(code_or_file)
eval(File.read(code_or_file))
else
eval(code_or_file)

View file

@ -17,3 +17,15 @@ def tail(log_file)
end
tail_thread
end
def start_debugger
begin
require_library_or_gem 'ruby-debug'
Debugger.start
Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
puts "=> Debugger enabled"
rescue Exception
puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'"
exit
end
end

View file

@ -12,13 +12,15 @@ OPTIONS = {
:port => 3000,
:ip => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
:detach => false
:detach => false,
:debugger => false
}
ARGV.clone.options do |opts|
opts.on("-p", "--port=port", Integer, "Runs Rails on the specified port.", "Default: 3000") { |v| OPTIONS[:port] = v }
opts.on("-b", "--binding=ip", String, "Binds Rails to the specified ip.", "Default: 0.0.0.0") { |v| OPTIONS[:ip] = v }
opts.on("-d", "--daemon", "Make server run as a Daemon.") { OPTIONS[:detach] = true }
opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { OPTIONS[:debugger] = true }
opts.on("-e", "--environment=name", String,
"Specifies the environment to run this server under (test/development/production).",
"Default: development") { |v| OPTIONS[:environment] = v }
@ -46,6 +48,8 @@ else
ENV["RAILS_ENV"] = OPTIONS[:environment]
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)
start_debugger if OPTIONS[:debugger]
require 'initializer'
Rails::Initializer.run(:initialize_logger)

View file

@ -1,14 +1,17 @@
require 'webrick'
require 'optparse'
require 'commands/servers/base'
OPTIONS = {
:port => 3000,
:ip => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
:server_root => File.expand_path(RAILS_ROOT + "/public/"),
:server_type => WEBrick::SimpleServer,
:charset => "UTF-8",
:mime_types => WEBrick::HTTPUtils::DefaultMimeTypes
:port => 3000,
:ip => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
:server_root => File.expand_path(RAILS_ROOT + "/public/"),
:server_type => WEBrick::SimpleServer,
:charset => "UTF-8",
:mime_types => WEBrick::HTTPUtils::DefaultMimeTypes,
:debugger => false
}
ARGV.options do |opts|
@ -34,6 +37,8 @@ ARGV.options do |opts|
"Make Rails run as a Daemon (only works if fork is available -- meaning on *nix)."
) { OPTIONS[:server_type] = WEBrick::Daemon }
opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { OPTIONS[:debugger] = true }
opts.on("-c", "--charset=charset", String,
"Set default charset for output.",
"Default: UTF-8") { |v| OPTIONS[:charset] = v }
@ -46,6 +51,8 @@ ARGV.options do |opts|
opts.parse!
end
start_debugger if OPTIONS[:debugger]
ENV["RAILS_ENV"] = OPTIONS[:environment]
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)