aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/Rakefile4
-rw-r--r--railties/lib/rails.rb21
-rw-r--r--railties/lib/rails/application.rb54
-rw-r--r--railties/lib/rails/commands/server.rb10
-rw-r--r--railties/lib/rails/generators.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb6
-rw-r--r--railties/lib/rails/initializable.rb22
-rw-r--r--railties/lib/rails/initializer.rb2
-rw-r--r--railties/lib/rails/tasks/framework.rake8
-rw-r--r--railties/lib/rails/tasks/testing.rake2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb3
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/CHANGELOG.rdoc (renamed from railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc)4
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/LICENSE (renamed from railties/lib/rails/vendor/thor-0.12.0/LICENSE)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/README.rdoc (renamed from railties/lib/rails/vendor/thor-0.12.0/README.rdoc)20
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/Thorfile (renamed from railties/lib/rails/vendor/thor-0.12.0/Thorfile)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb)4
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/create_file.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/directory.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb)6
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/empty_directory.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/file_manipulation.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb)12
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/inject_into_file.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/base.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/core_ext/hash_with_indifferent_access.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/core_ext/ordered_hash.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/error.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/group.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/invocation.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/argument.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/arguments.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/option.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/options.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/rake_compat.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/runner.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell/basic.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb)2
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell/color.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/color.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/task.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/task.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/util.rb (renamed from railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb)0
-rw-r--r--railties/lib/rails/vendor/thor-0.12.1/lib/thor/version.rb3
-rw-r--r--railties/railties.gemspec (renamed from railties/rails.gemspec)7
-rw-r--r--railties/test/application/configuration_test.rb9
-rw-r--r--railties/test/application/generators_test.rb26
-rw-r--r--railties/test/application/initializer_test.rb20
-rw-r--r--railties/test/application/routing_test.rb85
-rw-r--r--railties/test/initializer/check_ruby_version_test.rb7
47 files changed, 209 insertions, 142 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index e6f698fc74..cb482c90bf 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -10,7 +10,7 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib"
require 'rails/version'
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
-PKG_NAME = ENV['PKG_NAME'] || 'rails'
+PKG_NAME = ENV['PKG_NAME'] || 'railties'
PKG_VERSION = Rails::VERSION::STRING + PKG_BUILD
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
@@ -141,7 +141,7 @@ Rake::RDocTask.new { |rdoc|
# Generate GEM ----------------------------------------------------------------------------
-spec = eval(File.read('rails.gemspec'))
+spec = eval(File.read('railties.gemspec'))
Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb
index c23b67e321..b7cae9a9ac 100644
--- a/railties/lib/rails.rb
+++ b/railties/lib/rails.rb
@@ -1,5 +1,9 @@
require "pathname"
+require 'active_support'
+require 'active_support/core_ext/kernel/reporting'
+require 'active_support/core_ext/logger'
+
require 'rails/initializable'
require 'rails/application'
require 'rails/railties_path'
@@ -10,4 +14,19 @@ require 'rails/core'
require 'rails/configuration'
require 'rails/deprecation'
require 'rails/initializer'
-require 'rails/plugin' \ No newline at end of file
+require 'rails/plugin'
+require 'rails/ruby_version_check'
+
+# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
+# multibyte safe operations. Plugin authors supporting other encodings
+# should override this behaviour and set the relevant +default_charset+
+# on ActionController::Base.
+#
+# For Ruby 1.9, UTF-8 is the default internal and external encoding.
+if RUBY_VERSION < '1.9'
+ $KCODE='u'
+else
+ Encoding.default_external = Encoding::UTF_8
+end
+
+RAILS_ENV = (ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development").dup unless defined?(RAILS_ENV) \ No newline at end of file
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 7ea79aa9c9..110311558c 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -82,8 +82,21 @@ module Rails
@app.call(env)
end
- initializer :initialize_rails do
- Rails.run_initializers
+
+ # Loads the environment specified by Configuration#environment_path, which
+ # is typically one of development, test, or production.
+ initializer :load_environment do
+ next unless File.file?(config.environment_path)
+
+ config = self.config
+
+ Kernel.class_eval do
+ meth = instance_method(:config) if Object.respond_to?(:config)
+ define_method(:config) { config }
+ require config.environment_path
+ remove_method :config
+ define_method(:config, &meth) if meth
+ end
end
# Set the <tt>$LOAD_PATH</tt> based on the value of
@@ -97,18 +110,8 @@ module Rails
# list. By default, all frameworks (Active Record, Active Support,
# Action Pack, Action Mailer, and Active Resource) are loaded.
initializer :require_frameworks do
- begin
- require 'active_support'
- require 'active_support/core_ext/kernel/reporting'
- require 'active_support/core_ext/logger'
-
- # TODO: This is here to make Sam Ruby's tests pass. Needs discussion.
- require 'active_support/core_ext/numeric/bytes'
- config.frameworks.each { |framework| require(framework.to_s) }
- rescue LoadError => e
- # Re-raise as RuntimeError because Mongrel would swallow LoadError.
- raise e.to_s
- end
+ require 'active_support/all' unless config.active_support.bare
+ config.frameworks.each { |framework| require(framework.to_s) }
end
# Set the paths from which Rails will automatically load source files, and
@@ -137,24 +140,6 @@ module Rails
end
end
- # Loads the environment specified by Configuration#environment_path, which
- # is typically one of development, test, or production.
- initializer :load_environment do
- silence_warnings do
- next if @environment_loaded
- next unless File.file?(config.environment_path)
-
- @environment_loaded = true
- constants = self.class.constants
-
- eval(IO.read(config.environment_path), binding, config.environment_path)
-
- (self.class.constants - constants).each do |const|
- Object.const_set(const, self.class.const_get(const))
- end
- end
- end
-
# Preload all frameworks specified by the Configuration#frameworks.
# Used by Passenger to ensure everything's loaded before forking and
# to avoid autoload race conditions in JRuby.
@@ -312,9 +297,6 @@ module Rails
base_class.send("#{setting}=", value)
end
end
- config.active_support.each do |setting, value|
- ActiveSupport.send("#{setting}=", value)
- end
end
# Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
@@ -387,7 +369,7 @@ module Rails
initializer :initialize_routing do
next unless configuration.frameworks.include?(:action_controller)
- ActionController::Routing.controller_paths += configuration.controller_paths
+ ActionController::Routing::Routes.controller_paths += configuration.controller_paths
ActionController::Routing::Routes.add_configuration_file(configuration.routes_configuration_file)
ActionController::Routing::Routes.reload!
end
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 57b7c6a49c..3687b4460e 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -41,9 +41,9 @@ module Rails
new(app).start
end
- def initialize(app)
+ def initialize(app_const)
super() # Call Rack::Server#initialize without passing any options to use.
- @app = app
+ @app_const = app_const
end
def start
@@ -69,7 +69,7 @@ module Rails
end
def log_path
- "#{File.expand_path(@app.root)}/log/#{options[:environment]}.log"
+ "#{File.expand_path(@app_const.root)}/log/#{options[:environment]}.log"
end
def default_options
@@ -77,10 +77,10 @@ module Rails
:Port => 3000,
:Host => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
- :rack_file => "#{@app.root}/config.ru",
+ :rack_file => "#{@app_const.root}/config.ru",
:daemonize => false,
:debugger => false,
- :pid => "#{@app.root}/tmp/pids/server.pid",
+ :pid => "#{@app_const.root}/tmp/pids/server.pid",
:AccessLog => []
}
end
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index 85c2fd52a4..ffb9cfe1cd 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -9,7 +9,7 @@ require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/string/inflections'
# TODO: Do not always push on vendored thor
-$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/vendor/thor-0.12.0/lib")
+$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/vendor/thor-0.12.1/lib")
require 'rails/generators/base'
require 'rails/generators/named_base'
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 7e21a6d1d9..ae18fa843b 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -123,10 +123,10 @@ module Rails::Generators
end
def create_script_files
- directory "script" do |file|
- prepend_file file, "#{shebang}\n", :verbose => false
- chmod file, 0755, :verbose => false
+ directory "script" do |content|
+ "#{shebang}\n" + content
end
+ chmod "script", 0755, :verbose => false
end
def create_test_files
diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb
index 3866b856b2..96234739cf 100644
--- a/railties/lib/rails/initializable.rb
+++ b/railties/lib/rails/initializable.rb
@@ -106,26 +106,4 @@ module Rails
end
end
end
-
- include Initializable
-
- # Check for valid Ruby version (1.8.2 or 1.8.4 or higher). This is done in an
- # external file, so we can use it from the `rails` program as well without duplication.
- initializer :check_ruby_version, :global => true do
- require 'rails/ruby_version_check'
- end
-
- # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
- # multibyte safe operations. Plugin authors supporting other encodings
- # should override this behaviour and set the relevant +default_charset+
- # on ActionController::Base.
- #
- # For Ruby 1.9, UTF-8 is the default internal and external encoding.
- initializer :initialize_encoding, :global => true do
- if RUBY_VERSION < '1.9'
- $KCODE='u'
- else
- Encoding.default_external = Encoding::UTF_8
- end
- end
end \ No newline at end of file
diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb
index 44101dcc94..95478428ec 100644
--- a/railties/lib/rails/initializer.rb
+++ b/railties/lib/rails/initializer.rb
@@ -1,7 +1,5 @@
require "rails" # In case people require this file directly
-RAILS_ENV = (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development').dup unless defined?(RAILS_ENV)
-
module Rails
class Initializer
class Error < StandardError ; end
diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake
index 1611d1d94d..f7b53885c8 100644
--- a/railties/lib/rails/tasks/framework.rake
+++ b/railties/lib/rails/tasks/framework.rake
@@ -92,7 +92,7 @@ namespace :rails do
namespace :update do
def invoke_from_app_generator(method)
- require 'generators'
+ require 'rails/generators'
require 'rails/generators/rails/app/app_generator'
generator = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true },
@@ -100,6 +100,12 @@ namespace :rails do
generator.invoke(method)
end
+ desc "Update config/boot.rb from your current rails install"
+ task :configs do
+ invoke_from_app_generator :create_boot_file
+ invoke_from_app_generator :create_config_files
+ end
+
desc "Update Prototype javascripts from your current rails install"
task :javascripts do
invoke_from_app_generator :create_prototype_files
diff --git a/railties/lib/rails/tasks/testing.rake b/railties/lib/rails/tasks/testing.rake
index 5bd4aa1596..57857fb911 100644
--- a/railties/lib/rails/tasks/testing.rake
+++ b/railties/lib/rails/tasks/testing.rake
@@ -48,7 +48,7 @@ task :test do
task
end
end.compact
- abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
+ abort "Errors running #{errors * ', '}!" if errors.any?
end
namespace :test do
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb
deleted file mode 100644
index 885230fac4..0000000000
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class Thor
- VERSION = "0.11.8".freeze
-end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc b/railties/lib/rails/vendor/thor-0.12.1/CHANGELOG.rdoc
index adedfeca9d..606a0cdb52 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc
+++ b/railties/lib/rails/vendor/thor-0.12.1/CHANGELOG.rdoc
@@ -17,7 +17,7 @@
* thor help now show information about any class/task. All those calls are
possible:
-
+
thor help describe
thor help describe:amazing
@@ -47,7 +47,7 @@
are in the 'standard' group. Running 'thor -T' will only show the standard
tasks - adding --all will show all tasks. You can also filter on a specific
group using the --group option: thor -T --group advanced
-
+
== 0.9.6, released 2008-09-13
* Generic improvements
diff --git a/railties/lib/rails/vendor/thor-0.12.0/LICENSE b/railties/lib/rails/vendor/thor-0.12.1/LICENSE
index 98722da459..98722da459 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/LICENSE
+++ b/railties/lib/rails/vendor/thor-0.12.1/LICENSE
diff --git a/railties/lib/rails/vendor/thor-0.12.0/README.rdoc b/railties/lib/rails/vendor/thor-0.12.1/README.rdoc
index f1106f02b6..ee545f3d97 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/README.rdoc
+++ b/railties/lib/rails/vendor/thor-0.12.1/README.rdoc
@@ -7,7 +7,7 @@ Example:
class App < Thor # [1]
map "-L" => :list # [2]
-
+
desc "install APP_NAME", "install one of the available apps" # [3]
method_options :force => :boolean, :alias => :string # [4]
def install(name)
@@ -17,7 +17,7 @@ Example:
end
# other code
end
-
+
desc "list [SEARCH]", "list all of the available apps, limited by SEARCH"
def list(search="")
# list everything
@@ -126,13 +126,13 @@ invoked only once. For example:
invoke :two
invoke :three
end
-
+
desc "two", "Prints 2, 3"
def two
puts 2
invoke :three
end
-
+
desc "three", "Prints 3"
def three
puts 3
@@ -155,15 +155,15 @@ Thor::Group as this:
class Counter < Thor::Group
desc "Prints 1, 2, 3"
-
+
def one
puts 1
end
-
+
def two
puts 2
end
-
+
def three
puts 3
end
@@ -184,15 +184,15 @@ Besides, Thor::Group can parse arguments and options as Thor tasks:
# number will be available as attr_accessor
argument :number, :type => :numeric, :desc => "The number to start counting"
desc "Prints the 'number' given upto 'number+2'"
-
+
def one
puts number + 0
end
-
+
def two
puts number + 1
end
-
+
def three
puts number + 2
end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/Thorfile b/railties/lib/rails/vendor/thor-0.12.1/Thorfile
index f71a1e57e2..ff1cb4498a 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/Thorfile
+++ b/railties/lib/rails/vendor/thor-0.12.1/Thorfile
@@ -56,7 +56,7 @@ class Default < Thor
s.test_files.exclude 'spec/sandbox/**/*'
end
- Jeweler::RubyforgeTasks.new
+ Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor.rb
index 68944f140d..68944f140d 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions.rb
index d561ccb2aa..4bfb7c2870 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions.rb
@@ -114,7 +114,7 @@ class Thor
@source_paths ||= self.class.source_paths_for_search
end
- # Receives a file or directory and search for it in the source paths.
+ # Receives a file or directory and search for it in the source paths.
#
def find_in_source_paths(file)
relative_root = relative_to_original_destination_root(destination_root, false)
@@ -222,7 +222,7 @@ class Thor
run "#{command}", config.merge(:with => Thor::Util.ruby_command)
end
- # Run a thor command. A hash of options can be given and it's converted to
+ # Run a thor command. A hash of options can be given and it's converted to
# switches.
#
# ==== Parameters
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/create_file.rb
index a3d9296823..a3d9296823 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/create_file.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/directory.rb
index 467e63732a..2e0b459fa3 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/directory.rb
@@ -79,11 +79,9 @@ class Thor
next if dirname == given_destination
base.empty_directory(dirname, config)
when /\.tt$/
- destination = base.template(file_source, file_destination[0..-4], config)
- @block.call(destination) if @block
+ destination = base.template(file_source, file_destination[0..-4], config, &@block)
else
- destination = base.copy_file(file_source, file_destination, config)
- @block.call(destination) if @block
+ destination = base.copy_file(file_source, file_destination, config, &@block)
end
end
end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/empty_directory.rb
index 484cb820f8..484cb820f8 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/empty_directory.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/file_manipulation.rb
index d77d90d448..8a45c83f25 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/file_manipulation.rb
@@ -18,12 +18,14 @@ class Thor
#
# copy_file "doc/README"
#
- def copy_file(source, destination=nil, config={})
+ def copy_file(source, destination=nil, config={}, &block)
destination ||= source
source = File.expand_path(find_in_source_paths(source.to_s))
create_file destination, nil, config do
- File.read(source)
+ content = File.read(source)
+ content = block.call(content) if block
+ content
end
end
@@ -72,13 +74,15 @@ class Thor
#
# template "doc/README"
#
- def template(source, destination=nil, config={})
+ def template(source, destination=nil, config={}, &block)
destination ||= source
source = File.expand_path(find_in_source_paths(source.to_s))
context = instance_eval('binding')
create_file destination, nil, config do
- ERB.new(::File.read(source), nil, '-').result(context)
+ content = ERB.new(::File.read(source), nil, '-').result(context)
+ content = block.call(content) if block
+ content
end
end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/inject_into_file.rb
index 0636ec6591..6b0b42ea02 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/actions/inject_into_file.rb
@@ -11,7 +11,7 @@ class Thor
# data<String>:: Data to add to the file. Can be given as a block.
# config<Hash>:: give :verbose => false to not log the status and the flag
# for injection (:after or :before).
- #
+ #
# ==== Examples
#
# inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/base.rb
index 700d794123..700d794123 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/base.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/core_ext/hash_with_indifferent_access.rb
index 78bc5cf4bf..40d201d9e4 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/core_ext/hash_with_indifferent_access.rb
@@ -65,7 +65,7 @@ class Thor
else
self[$1] == args.first
end
- else
+ else
self[method]
end
end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/core_ext/ordered_hash.rb
index 27fea5bb35..27fea5bb35 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/core_ext/ordered_hash.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/error.rb
index f9b31a35d1..f9b31a35d1 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/error.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/group.rb
index 0964a9667a..021a067a3e 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/group.rb
@@ -132,7 +132,7 @@ class Thor::Group
names.each do |name|
unless class_options.key?(name)
- raise ArgumentError, "You have to define the option #{name.inspect} " <<
+ raise ArgumentError, "You have to define the option #{name.inspect} " <<
"before setting invoke_from_option."
end
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/invocation.rb
index 32e6a72454..32e6a72454 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/invocation.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser.rb
index 57a3f6e1a5..57a3f6e1a5 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/argument.rb
index aa8ace4719..aa8ace4719 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/argument.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/arguments.rb
index fb5d965e06..fb5d965e06 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/arguments.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/option.rb
index 9e40ec73fa..e09b4901e2 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/option.rb
@@ -36,7 +36,7 @@ class Thor
# string (--foo=value) or booleans (just --foo).
#
# By default all options are optional, unless :required is given.
- #
+ #
def self.parse(key, value)
if key.is_a?(Array)
name, *aliases = key
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/options.rb
index 75092308b5..75092308b5 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/parser/options.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/rake_compat.rb
index 0d0757fdda..0d0757fdda 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/rake_compat.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/runner.rb
index 9dc70ea069..079f9e0c65 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/runner.rb
@@ -36,7 +36,7 @@ class Thor::Runner < Thor #:nodoc:
def install(name)
initialize_thorfiles
- # If a directory name is provided as the argument, look for a 'main.thor'
+ # If a directory name is provided as the argument, look for a 'main.thor'
# task in said directory.
begin
if File.directory?(File.expand_path(name))
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell.rb
index 1dc8f0e5b4..1dc8f0e5b4 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell/basic.rb
index ea9665380b..f6be3575ca 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell/basic.rb
@@ -143,7 +143,7 @@ class Thor
answer = ask %[Overwrite #{destination}? (enter "h" for help) #{options}]
case answer
- when is?(:yes), is?(:force)
+ when is?(:yes), is?(:force), ""
return true
when is?(:no), is?(:skip)
return false
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/color.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell/color.rb
index 24704f7885..24704f7885 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/color.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/shell/color.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/task.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/task.rb
index 91c7564d3f..91c7564d3f 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/task.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/task.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/util.rb
index ebae0a3193..ebae0a3193 100644
--- a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/util.rb
diff --git a/railties/lib/rails/vendor/thor-0.12.1/lib/thor/version.rb b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/version.rb
new file mode 100644
index 0000000000..650253d648
--- /dev/null
+++ b/railties/lib/rails/vendor/thor-0.12.1/lib/thor/version.rb
@@ -0,0 +1,3 @@
+class Thor
+ VERSION = "0.12.1".freeze
+end
diff --git a/railties/rails.gemspec b/railties/railties.gemspec
index dc66e1efea..a060c3c301 100644
--- a/railties/rails.gemspec
+++ b/railties/railties.gemspec
@@ -1,8 +1,8 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
- s.name = 'rails'
+ s.name = 'railties'
s.version = '3.0.pre'
- s.summary = "Web-application framework with template engine, control-flow layer, and ORM."
+ s.summary = "Controls boot-up, rake tasks and generators for the Rails framework."
s.description = <<-EOF
Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick
on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
@@ -10,10 +10,7 @@ Gem::Specification.new do |s|
s.add_dependency('rake', '>= 0.8.3')
s.add_dependency('activesupport', '= 3.0.pre')
- s.add_dependency('activerecord', '= 3.0.pre')
s.add_dependency('actionpack', '= 3.0.pre')
- s.add_dependency('actionmailer', '= 3.0.pre')
- s.add_dependency('activeresource', '= 3.0.pre')
s.rdoc_options << '--exclude' << '.'
s.has_rdoc = false
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index a3e1916494..fc21d4e5fd 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -44,5 +44,14 @@ module ApplicationTests
assert_equal Pathname.new("#{app_path}/app"), Rails.application.root
end
end
+
+ test "config.active_support.bare does not require all of ActiveSupport" do
+ add_to_config "config.frameworks = []; config.active_support.bare = true"
+
+ Dir.chdir("#{app_path}/app") do
+ require "#{app_path}/config/environment"
+ assert_raises(NoMethodError, /day/) { 1.day }
+ end
+ end
end
end \ No newline at end of file
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index ccbcd84176..2ed49d1057 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -11,8 +11,16 @@ module ApplicationTests
require "rails/generators"
end
+ def app_const
+ @app_const ||= Class.new(Rails::Application)
+ end
+
+ def with_config
+ yield app_const.config
+ end
+
test "generators default values" do
- Rails::Initializer.run do |c|
+ with_config do |c|
assert_equal(true, c.generators.colorize_logging)
assert_equal({}, c.generators.aliases)
assert_equal({}, c.generators.options)
@@ -20,7 +28,7 @@ module ApplicationTests
end
test "generators set rails options" do
- Rails::Initializer.run do |c|
+ with_config do |c|
c.generators.orm = :datamapper
c.generators.test_framework = :rspec
c.generators.helper = false
@@ -30,7 +38,7 @@ module ApplicationTests
end
test "generators set rails aliases" do
- Rails::Initializer.run do |c|
+ with_config do |c|
c.generators.aliases = { :rails => { :test_framework => "-w" } }
expected = { :rails => { :test_framework => "-w" } }
assert_equal expected, c.generators.aliases
@@ -38,14 +46,14 @@ module ApplicationTests
end
test "generators aliases and options on initialization" do
- Rails::Initializer.run do |c|
+ application = with_config do |c|
c.frameworks = []
c.generators.rails :aliases => { :test_framework => "-w" }
c.generators.orm :datamapper
c.generators.test_framework :rspec
end
# Initialize the application
- Rails.initialize!
+ app_const.initialize!
Rails::Generators.configure!
assert_equal :rspec, Rails::Generators.options[:rails][:test_framework]
@@ -53,19 +61,19 @@ module ApplicationTests
end
test "generators no color on initialization" do
- Rails::Initializer.run do |c|
+ with_config do |c|
c.frameworks = []
c.generators.colorize_logging = false
end
# Initialize the application
- Rails.initialize!
+ app_const.initialize!
Rails::Generators.configure!
assert_equal Thor::Base.shell, Thor::Shell::Basic
end
test "generators with hashes for options and aliases" do
- Rails::Initializer.run do |c|
+ with_config do |c|
c.generators do |g|
g.orm :datamapper, :migration => false
g.plugin :aliases => { :generator => "-g" },
@@ -84,7 +92,7 @@ module ApplicationTests
end
test "generators with hashes are deep merged" do
- Rails::Initializer.run do |c|
+ with_config do |c|
c.generators do |g|
g.orm :datamapper, :migration => false
g.plugin :aliases => { :generator => "-g" },
diff --git a/railties/test/application/initializer_test.rb b/railties/test/application/initializer_test.rb
index 719520bf68..56582c5772 100644
--- a/railties/test/application/initializer_test.rb
+++ b/railties/test/application/initializer_test.rb
@@ -10,22 +10,6 @@ module ApplicationTests
require "rails"
end
- test "initializing an application initializes rails" do
- Rails::Initializer.run do |config|
- config.root = app_path
- end
-
- if RUBY_VERSION < '1.9'
- $KCODE = ''
- Rails.initialize!
- assert_equal 'UTF8', $KCODE
- else
- Encoding.default_external = Encoding::US_ASCII
- Rails.initialize!
- assert_equal Encoding::UTF_8, Encoding.default_external
- end
- end
-
test "initializing an application adds the application paths to the load path" do
Rails::Initializer.run do |config|
config.root = app_path
@@ -41,7 +25,9 @@ module ApplicationTests
config.frameworks << :action_foo
end
- assert_raises RuntimeError do
+ require "active_support/core_ext/load_error"
+
+ assert_raises MissingSourceFile do
Rails.initialize!
end
end
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb
new file mode 100644
index 0000000000..1bfec3805b
--- /dev/null
+++ b/railties/test/application/routing_test.rb
@@ -0,0 +1,85 @@
+require 'isolation/abstract_unit'
+require 'rack/test'
+
+module ApplicationTests
+ class RoutingTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
+ include Rack::Test::Methods
+
+ def setup
+ build_app
+ end
+
+ def app
+ @app ||= begin
+ boot_rails
+ require "#{app_path}/config/environment"
+
+ Rails.application
+ end
+ end
+
+ test "simple controller" do
+ controller :foo, <<-RUBY
+ class FooController < ActionController::Base
+ def index
+ render :text => "foo"
+ end
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'foo', last_response.body
+ end
+
+ test "multiple controllers" do
+ controller :foo, <<-RUBY
+ class FooController < ActionController::Base
+ def index
+ render :text => "foo"
+ end
+ end
+ RUBY
+
+ controller :bar, <<-RUBY
+ class BarController < ActionController::Base
+ def index
+ render :text => "bar"
+ end
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'foo', last_response.body
+
+ get '/bar'
+ assert_equal 'bar', last_response.body
+ end
+
+ test "nested controller" do
+ controller 'foo', <<-RUBY
+ class FooController < ActionController::Base
+ def index
+ render :text => "foo"
+ end
+ end
+ RUBY
+
+ controller 'admin/foo', <<-RUBY
+ module Admin
+ class FooController < ActionController::Base
+ def index
+ render :text => "admin::foo"
+ end
+ end
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'foo', last_response.body
+
+ get '/admin/foo'
+ assert_equal 'admin::foo', last_response.body
+ end
+ end
+end
diff --git a/railties/test/initializer/check_ruby_version_test.rb b/railties/test/initializer/check_ruby_version_test.rb
index 97d884e1be..0691caad9d 100644
--- a/railties/test/initializer/check_ruby_version_test.rb
+++ b/railties/test/initializer/check_ruby_version_test.rb
@@ -7,7 +7,6 @@ module InitializerTests
def setup
build_app
boot_rails
- require "rails"
end
test "rails does not initialize with ruby version 1.8.1" do
@@ -50,8 +49,7 @@ module InitializerTests
def assert_rails_boots(version = nil)
set_ruby_version(version) if version
assert_nothing_raised "It appears that rails does not boot" do
- Rails::Initializer.run { |c| c.frameworks = [] }
- Rails.initialize!
+ require "rails"
end
end
@@ -59,8 +57,7 @@ module InitializerTests
set_ruby_version(version)
$stderr = File.open("/dev/null", "w")
assert_raises(SystemExit) do
- Rails::Initializer.run { |c| c.frameworks = [] }
- Rails.initialize!
+ require "rails"
end
end
end