aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-09-01 15:45:43 -0300
committerEmilio Tagua <miloops@gmail.com>2009-09-01 15:45:43 -0300
commit39e4e76d15233bb1cb0b778d920f54efe86bb4f0 (patch)
tree7e9cab343139c79acc36715f4f24c579a207fbc6 /railties
parent6b67df70ab1bc42d9a05571144cdf5614a7d4a6a (diff)
parentda636809daca9c338200811d3590e446f57c8e81 (diff)
downloadrails-39e4e76d15233bb1cb0b778d920f54efe86bb4f0.tar.gz
rails-39e4e76d15233bb1cb0b778d920f54efe86bb4f0.tar.bz2
rails-39e4e76d15233bb1cb0b778d920f54efe86bb4f0.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record/associations.rb
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/Rakefile6
-rw-r--r--railties/builtin/rails_info/rails/info.rb6
-rw-r--r--railties/lib/generators.rb3
-rw-r--r--railties/lib/generators/actions.rb12
-rw-r--r--railties/lib/generators/base.rb52
-rw-r--r--railties/lib/generators/erb/scaffold/scaffold_generator.rb5
-rw-r--r--railties/lib/generators/erb/scaffold/templates/_form.html.erb17
-rw-r--r--railties/lib/generators/erb/scaffold/templates/edit.html.erb16
-rw-r--r--railties/lib/generators/erb/scaffold/templates/layout.html.erb2
-rw-r--r--railties/lib/generators/erb/scaffold/templates/new.html.erb16
-rw-r--r--railties/lib/generators/named_base.rb62
-rw-r--r--railties/lib/generators/rails/generator/generator_generator.rb2
-rw-r--r--railties/lib/generators/rails/resource/resource_generator.rb16
-rw-r--r--railties/lib/generators/rails/scaffold/scaffold_generator.rb3
-rw-r--r--railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb5
-rw-r--r--railties/lib/generators/rails/stylesheets/templates/scaffold.css8
-rw-r--r--railties/lib/generators/resource_helpers.rb74
-rw-r--r--railties/lib/generators/test_unit/scaffold/scaffold_generator.rb3
-rw-r--r--railties/lib/rails/configuration.rb1
-rw-r--r--railties/lib/rails/plugin.rb12
-rw-r--r--railties/lib/rails/plugin/loader.rb9
-rw-r--r--railties/lib/tasks/databases.rake2
-rw-r--r--railties/lib/vendor/thor-0.11.6/CHANGELOG.rdoc (renamed from railties/lib/vendor/thor-0.11.5/CHANGELOG.rdoc)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/LICENSE (renamed from railties/lib/vendor/thor-0.11.5/LICENSE)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/README.rdoc (renamed from railties/lib/vendor/thor-0.11.5/README.rdoc)0
-rwxr-xr-xrailties/lib/vendor/thor-0.11.6/bin/rake2thor (renamed from railties/lib/vendor/thor-0.11.5/bin/rake2thor)0
-rwxr-xr-xrailties/lib/vendor/thor-0.11.6/bin/thor (renamed from railties/lib/vendor/thor-0.11.5/bin/thor)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor.rb)2
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/actions.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/actions.rb)31
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/actions/create_file.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/actions/create_file.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/actions/directory.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/actions/directory.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/actions/empty_directory.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/actions/file_manipulation.rb)58
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/actions/inject_into_file.rb)63
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/base.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/base.rb)7
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/core_ext/hash_with_indifferent_access.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/core_ext/ordered_hash.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/error.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/error.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/group.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/group.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/invocation.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/invocation.rb)2
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/parser.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/parser.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/parser/argument.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/parser/argument.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/parser/arguments.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/parser/arguments.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/parser/option.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/parser/option.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/parser/options.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/parser/options.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/rake_compat.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/rake_compat.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/runner.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/runner.rb)4
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/shell.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/shell.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/shell/basic.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/shell/basic.rb)5
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/shell/color.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/shell/color.rb)0
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/task.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/task.rb)20
-rw-r--r--railties/lib/vendor/thor-0.11.6/lib/thor/util.rb (renamed from railties/lib/vendor/thor-0.11.5/lib/thor/util.rb)17
-rw-r--r--railties/rails.gemspec51
-rw-r--r--railties/test/abstract_unit.rb5
-rw-r--r--railties/test/fixtures/plugins/engines/engine/config/locales/en.yml2
-rw-r--r--railties/test/generators/scaffold_generator_test.rb1
-rw-r--r--railties/test/initializer/test_helper.rb3
-rw-r--r--railties/test/initializer_test.rb1
-rw-r--r--railties/test/plugin_loader_test.rb8
-rw-r--r--railties/test/rails_info_test.rb3
61 files changed, 419 insertions, 198 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 782afd5aa4..d6311f77a0 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* I18n support for plugins. #2325 [Antonio Tapiador, Sven Fuchs]
+
* Ruby 1.9: use UTF-8 for default internal and external encodings. [Jeremy Kemper]
* Added db/seeds.rb as a default file for storing seed data for the database. Can be loaded with rake db:seed (or created alongside the db with db:setup). (This is also known as the "Stop Putting Gawd Damn Seed Data In Your Migrations" feature) [DHH]
diff --git a/railties/Rakefile b/railties/Rakefile
index 3212bf3a4f..33c7a0d89a 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -181,6 +181,12 @@ Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
end
+task :gemspec do
+ File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w") do |file|
+ file.puts spec.to_ruby
+ end
+end
+
# Publishing -------------------------------------------------------
desc "Publish the rails gem"
diff --git a/railties/builtin/rails_info/rails/info.rb b/railties/builtin/rails_info/rails/info.rb
index fdacc469f5..aabe976d4e 100644
--- a/railties/builtin/rails_info/rails/info.rb
+++ b/railties/builtin/rails_info/rails/info.rb
@@ -29,8 +29,10 @@ module Rails
end
def framework_version(framework)
- require "#{framework}/version"
- "#{framework.classify}::VERSION::STRING".constantize
+ if Object.const_defined?(framework.classify)
+ require "#{framework}/version"
+ "#{framework.classify}::VERSION::STRING".constantize
+ end
end
def edge_rails_revision(info = git_info)
diff --git a/railties/lib/generators.rb b/railties/lib/generators.rb
index a2f462ae81..879abb1c41 100644
--- a/railties/lib/generators.rb
+++ b/railties/lib/generators.rb
@@ -11,7 +11,7 @@ end
$:.unshift(File.dirname(__FILE__))
-require 'vendor/thor-0.11.5/lib/thor'
+require 'vendor/thor-0.11.6/lib/thor'
require 'generators/base'
require 'generators/named_base'
@@ -45,7 +45,6 @@ module Rails
},
:erb => {
- :form => false,
:layout => true
},
diff --git a/railties/lib/generators/actions.rb b/railties/lib/generators/actions.rb
index 03d0d11a07..c4552dd399 100644
--- a/railties/lib/generators/actions.rb
+++ b/railties/lib/generators/actions.rb
@@ -89,13 +89,11 @@ module Rails
# git :add => "onefile.rb", :rm => "badfile.cxx"
#
def git(command={})
- in_root do
- if command.is_a?(Symbol)
- run "git #{command}"
- else
- command.each do |command, options|
- run "git #{command} #{options}"
- end
+ if command.is_a?(Symbol)
+ run "git #{command}"
+ else
+ command.each do |command, options|
+ run "git #{command} #{options}"
end
end
end
diff --git a/railties/lib/generators/base.rb b/railties/lib/generators/base.rb
index cbe9c0a49d..c5d769b6ed 100644
--- a/railties/lib/generators/base.rb
+++ b/railties/lib/generators/base.rb
@@ -9,6 +9,8 @@ module Rails
include Thor::Actions
include Rails::Generators::Actions
+ add_runtime_options!
+
# Automatically sets the source root based on the class name.
#
def self.source_root
@@ -45,8 +47,10 @@ module Rails
#
# ==== Examples
#
- # class ControllerGenerator < Rails::Generators::Base
- # hook_for :test_framework, :aliases => "-t"
+ # module Rails::Generators
+ # class ControllerGenerator < Base
+ # hook_for :test_framework, :aliases => "-t"
+ # end
# end
#
# The example above will create a test framework option and will invoke
@@ -64,7 +68,49 @@ module Rails
# invoked. This allows any test framework to hook into Rails as long as it
# provides any of the hooks above.
#
- # Finally, if the user don't want to use any test framework, he can do:
+ # ==== Options
+ #
+ # This lookup can be customized with two options: :base and :as. The first
+ # is the root module value and in the example above defaults to "rails".
+ # The later defaults to the generator name, without the "Generator" ending.
+ #
+ # Let's suppose you are creating a generator that needs to invoke the
+ # controller generator from test unit. Your first attempt is:
+ #
+ # class AwesomeGenerator < Rails::Generators::Base
+ # hook_for :test_framework
+ # end
+ #
+ # The lookup in this case for test_unit as input is:
+ #
+ # "test_unit:generators:awesome", "test_unit"
+ #
+ # Which is not the desired the lookup. You can change it by providing the
+ # :as option:
+ #
+ # class AwesomeGenerator < Rails::Generators::Base
+ # hook_for :test_framework, :as => :controller
+ # end
+ #
+ # And now it will lookup at:
+ #
+ # "test_unit:generators:awesome", "test_unit"
+ #
+ # Similarly, if you want it to also lookup in the rails namespace, you just
+ # need to provide the :base value:
+ #
+ # class AwesomeGenerator < Rails::Generators::Base
+ # hook_for :test_framework, :base => :rails, :as => :controller
+ # end
+ #
+ # And the lookup is exactly the same as previously:
+ #
+ # "rails:generators:test_unit", "test_unit:generators:controller", "test_unit"
+ #
+ # ==== Switches
+ #
+ # All hooks come with switches for user interface. If the user don't want
+ # to use any test framework, he can do:
#
# ruby script/generate controller Account --skip-test-framework
#
diff --git a/railties/lib/generators/erb/scaffold/scaffold_generator.rb b/railties/lib/generators/erb/scaffold/scaffold_generator.rb
index 955f22192a..d51dc7d725 100644
--- a/railties/lib/generators/erb/scaffold/scaffold_generator.rb
+++ b/railties/lib/generators/erb/scaffold/scaffold_generator.rb
@@ -1,13 +1,13 @@
require 'generators/erb'
+require 'generators/resource_helpers'
module Erb
module Generators
class ScaffoldGenerator < Base
- include Rails::Generators::ScaffoldBase
+ include Rails::Generators::ResourceHelpers
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
- class_option :form, :type => :boolean
class_option :layout, :type => :boolean
class_option :singleton, :type => :boolean, :desc => "Supply to skip index view"
@@ -33,7 +33,6 @@ module Erb
end
def copy_form_file
- return unless options[:form]
copy_view :_form
end
diff --git a/railties/lib/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/generators/erb/scaffold/templates/_form.html.erb
new file mode 100644
index 0000000000..d02028d983
--- /dev/null
+++ b/railties/lib/generators/erb/scaffold/templates/_form.html.erb
@@ -0,0 +1,17 @@
+<%% form_for(@<%= singular_name %>) do |f| %>
+ <%%= f.error_messages %>
+
+<% for attribute in attributes -%>
+ <div class="field">
+ <%%= f.label :<%= attribute.name %> %><br />
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
+ </div>
+<% end -%>
+ <div class="actions">
+ <%% if @<%= singular_name %>.new_record? %>
+ <%%= f.submit 'Create' %>
+ <%% else %>
+ <%%= f.submit 'Update' %>
+ <%% end %>
+ </div>
+<%% end %>
diff --git a/railties/lib/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/generators/erb/scaffold/templates/edit.html.erb
index cca1d61c68..5bc507ffc8 100644
--- a/railties/lib/generators/erb/scaffold/templates/edit.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/edit.html.erb
@@ -1,18 +1,6 @@
<h1>Editing <%= singular_name %></h1>
-<%% form_for(@<%= singular_name %>) do |f| %>
- <%%= f.error_messages %>
-
-<% for attribute in attributes -%>
- <p>
- <%%= f.label :<%= attribute.name %> %><br />
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
- </p>
-<% end -%>
- <p>
- <%%= f.submit 'Update' %>
- </p>
-<%% end %>
+<%%= render 'form' %>
<%%= link_to 'Show', @<%= singular_name %> %> |
-<%%= link_to 'Back', <%= plural_name %>_path %> \ No newline at end of file
+<%%= link_to 'Back', <%= plural_name %>_path %>
diff --git a/railties/lib/generators/erb/scaffold/templates/layout.html.erb b/railties/lib/generators/erb/scaffold/templates/layout.html.erb
index aacfbe4a8f..6460e5b599 100644
--- a/railties/lib/generators/erb/scaffold/templates/layout.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/layout.html.erb
@@ -7,7 +7,7 @@
</head>
<body>
-<p style="color: green"><%%= flash[:notice] %></p>
+<p class="notice"><%%= flash[:notice] %></p>
<%%= yield %>
diff --git a/railties/lib/generators/erb/scaffold/templates/new.html.erb b/railties/lib/generators/erb/scaffold/templates/new.html.erb
index 96c89fc50e..9a1c489331 100644
--- a/railties/lib/generators/erb/scaffold/templates/new.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/new.html.erb
@@ -1,17 +1,5 @@
<h1>New <%= singular_name %></h1>
-<%% form_for(@<%= singular_name %>) do |f| %>
- <%%= f.error_messages %>
+<%%= render 'form' %>
-<% for attribute in attributes -%>
- <p>
- <%%= f.label :<%= attribute.name %> %><br />
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
- </p>
-<% end -%>
- <p>
- <%%= f.submit 'Create' %>
- </p>
-<%% end %>
-
-<%%= link_to 'Back', <%= plural_name %>_path %> \ No newline at end of file
+<%%= link_to 'Back', <%= plural_name %>_path %>
diff --git a/railties/lib/generators/named_base.rb b/railties/lib/generators/named_base.rb
index cd7aa61b50..b6ac05f482 100644
--- a/railties/lib/generators/named_base.rb
+++ b/railties/lib/generators/named_base.rb
@@ -97,67 +97,5 @@ module Rails
end
end
end
-
- # Deal with controller names on scaffold. Also provide helpers to deal with
- # ActionORM.
- #
- module ScaffoldBase
- def self.included(base) #:nodoc:
- base.send :attr_reader, :controller_name, :controller_class_name, :controller_file_name,
- :controller_class_path, :controller_file_path
- end
-
- # Set controller variables on initialization.
- #
- def initialize(*args) #:nodoc:
- super
- @controller_name = name.pluralize
-
- base_name, @controller_class_path, @controller_file_path, class_nesting, class_nesting_depth = extract_modules(@controller_name)
- class_name_without_nesting, @controller_file_name, controller_plural_name = inflect_names(base_name)
-
- @controller_class_name = if class_nesting.empty?
- class_name_without_nesting
- else
- "#{class_nesting}::#{class_name_without_nesting}"
- end
- end
-
- protected
-
- # Loads the ORM::Generators::ActiveModel class. This class is responsable
- # to tell scaffold entities how to generate an specific method for the
- # ORM. Check Rails::Generators::ActiveModel for more information.
- #
- def orm_class
- @orm_class ||= begin
- # Raise an error if the class_option :orm was not defined.
- unless self.class.class_options[:orm]
- raise "You need to have :orm as class option to invoke orm_class and orm_instance"
- end
-
- action_orm = "#{options[:orm].to_s.classify}::Generators::ActiveModel"
-
- # If the orm was not loaded, try to load it at "generators/orm",
- # for example "generators/active_record" or "generators/sequel".
- begin
- klass = action_orm.constantize
- rescue NameError
- require "generators/#{options[:orm]}"
- end
-
- # Try once again after loading the file with success.
- klass ||= action_orm.constantize
- rescue Exception => e
- raise Error, "Could not load #{action_orm}, skipping controller. Error: #{e.message}."
- end
- end
-
- # Initialize ORM::Generators::ActiveModel to access instance methods.
- #
- def orm_instance(name=file_name)
- @orm_instance ||= @orm_class.new(name)
- end
- end
end
end
diff --git a/railties/lib/generators/rails/generator/generator_generator.rb b/railties/lib/generators/rails/generator/generator_generator.rb
index 2fc97b20d3..5b5d1884bc 100644
--- a/railties/lib/generators/rails/generator/generator_generator.rb
+++ b/railties/lib/generators/rails/generator/generator_generator.rb
@@ -6,7 +6,7 @@ module Rails
class_option :namespace, :type => :boolean, :default => true,
:desc => "Namespace generator under lib/generators/name"
- def craete_generator_files
+ def create_generator_files
directory '.', generator_dir
end
diff --git a/railties/lib/generators/rails/resource/resource_generator.rb b/railties/lib/generators/rails/resource/resource_generator.rb
index 70babc0550..9abb8bbeaf 100644
--- a/railties/lib/generators/rails/resource/resource_generator.rb
+++ b/railties/lib/generators/rails/resource/resource_generator.rb
@@ -1,25 +1,19 @@
require 'generators/rails/model/model_generator'
+require 'generators/resource_helpers'
module Rails
module Generators
class ResourceGenerator < ModelGenerator #metagenerator
+ include ResourceHelpers
+
hook_for :resource_controller, :required => true do |base, controller|
- base.invoke controller, [ base.name.pluralize, base.options[:actions] ]
+ base.invoke controller, [ base.controller_name, base.options[:actions] ]
end
class_option :actions, :type => :array, :banner => "ACTION ACTION", :default => [],
:desc => "Actions for the resource controller"
- class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
- class_option :force_plural, :type => :boolean, :desc => "Forces the use of a plural ModelName"
-
- def initialize(*args)
- super
- if name == name.pluralize && !options[:force_plural]
- say "Plural version of the model detected, using singularized version. Override with --force-plural."
- name.replace name.singularize
- end
- end
+ class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
def add_resource_route
route "map.resource#{:s unless options[:singleton]} :#{pluralize?(file_name)}"
diff --git a/railties/lib/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/generators/rails/scaffold/scaffold_generator.rb
index af44c8ba65..fdea5bf52b 100644
--- a/railties/lib/generators/rails/scaffold/scaffold_generator.rb
+++ b/railties/lib/generators/rails/scaffold/scaffold_generator.rb
@@ -3,7 +3,8 @@ require 'generators/rails/resource/resource_generator'
module Rails
module Generators
class ScaffoldGenerator < ResourceGenerator #metagenerator
- remove_hook_for :actions, :resource_controller
+ remove_hook_for :resource_controller
+ remove_class_option :actions
hook_for :scaffold_controller, :required => true
hook_for :stylesheets
diff --git a/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb b/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb
index 972be5a33b..228cdecb14 100644
--- a/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb
+++ b/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb
@@ -1,8 +1,9 @@
+require 'generators/resource_helpers'
+
module Rails
module Generators
class ScaffoldControllerGenerator < NamedBase
- # Add controller methods and ActionORM settings.
- include ScaffoldBase
+ include ResourceHelpers
check_class_collision :suffix => "Controller"
diff --git a/railties/lib/generators/rails/stylesheets/templates/scaffold.css b/railties/lib/generators/rails/stylesheets/templates/scaffold.css
index 093c20994d..d9fa2cf2dc 100644
--- a/railties/lib/generators/rails/stylesheets/templates/scaffold.css
+++ b/railties/lib/generators/rails/stylesheets/templates/scaffold.css
@@ -16,6 +16,14 @@ a { color: #000; }
a:visited { color: #666; }
a:hover { color: #fff; background-color:#000; }
+div.field, div.actions {
+ margin-bottom: 10px;
+}
+
+.notice {
+ color: green;
+}
+
.fieldWithErrors {
padding: 2px;
background-color: red;
diff --git a/railties/lib/generators/resource_helpers.rb b/railties/lib/generators/resource_helpers.rb
new file mode 100644
index 0000000000..ba1444652d
--- /dev/null
+++ b/railties/lib/generators/resource_helpers.rb
@@ -0,0 +1,74 @@
+module Rails
+ module Generators
+ # Deal with controller names on scaffold and add some helpers to deal with
+ # ActiveModel.
+ #
+ module ResourceHelpers
+ def self.included(base) #:nodoc:
+ base.send :attr_reader, :controller_name, :controller_class_name, :controller_file_name,
+ :controller_class_path, :controller_file_path
+
+ base.send :class_option, :force_plural, :type => :boolean, :desc => "Forces the use of a plural ModelName"
+ end
+
+ # Set controller variables on initialization.
+ #
+ def initialize(*args) #:nodoc:
+ super
+
+ if name == name.pluralize && !options[:force_plural]
+ say "Plural version of the model detected, using singularized version. Override with --force-plural."
+ name.replace name.singularize
+ assign_names!(self.name)
+ end
+
+ @controller_name = name.pluralize
+
+ base_name, @controller_class_path, @controller_file_path, class_nesting, class_nesting_depth = extract_modules(@controller_name)
+ class_name_without_nesting, @controller_file_name, controller_plural_name = inflect_names(base_name)
+
+ @controller_class_name = if class_nesting.empty?
+ class_name_without_nesting
+ else
+ "#{class_nesting}::#{class_name_without_nesting}"
+ end
+ end
+
+ protected
+
+ # Loads the ORM::Generators::ActiveModel class. This class is responsable
+ # to tell scaffold entities how to generate an specific method for the
+ # ORM. Check Rails::Generators::ActiveModel for more information.
+ #
+ def orm_class
+ @orm_class ||= begin
+ # Raise an error if the class_option :orm was not defined.
+ unless self.class.class_options[:orm]
+ raise "You need to have :orm as class option to invoke orm_class and orm_instance"
+ end
+
+ active_model = "#{options[:orm].to_s.classify}::Generators::ActiveModel"
+
+ # If the orm was not loaded, try to load it at "generators/orm",
+ # for example "generators/active_record" or "generators/sequel".
+ begin
+ klass = active_model.constantize
+ rescue NameError
+ require "generators/#{options[:orm]}"
+ end
+
+ # Try once again after loading the file with success.
+ klass ||= active_model.constantize
+ rescue Exception => e
+ raise Error, "Could not load #{active_model}, skipping controller. Error: #{e.message}."
+ end
+ end
+
+ # Initialize ORM::Generators::ActiveModel to access instance methods.
+ #
+ def orm_instance(name=file_name)
+ @orm_instance ||= @orm_class.new(name)
+ end
+ end
+ end
+end
diff --git a/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb
index 78fcea1e9c..a8f9c8bd79 100644
--- a/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb
+++ b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb
@@ -1,9 +1,10 @@
require 'generators/test_unit'
+require 'generators/resource_helpers'
module TestUnit
module Generators
class ScaffoldGenerator < Base
- include Rails::Generators::ScaffoldBase
+ include Rails::Generators::ResourceHelpers
class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
check_class_collision :suffix => "ControllerTest"
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index 5cc4f80684..2b362a9c50 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -109,6 +109,7 @@ module Rails
# TODO: Fix this when there is an application object
def middleware
+ require 'action_controller'
ActionController::Dispatcher.middleware
end
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index 49ec5c7fba..1c0af6411a 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -71,6 +71,10 @@ module Rails
File.exist?(routing_file)
end
+ # Returns true if there is any localization file in locale_path
+ def localized?
+ locale_files.any?
+ end
def view_path
File.join(directory, 'app', 'views')
@@ -87,6 +91,14 @@ module Rails
def routing_file
File.join(directory, 'config', 'routes.rb')
end
+
+ def locale_path
+ File.join(directory, 'config', 'locales')
+ end
+
+ def locale_files
+ Dir[ File.join(locale_path, '*.{rb,yml}') ]
+ end
private
diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb
index 7ea9c7c0f3..0d16cbd7c3 100644
--- a/railties/lib/rails/plugin/loader.rb
+++ b/railties/lib/rails/plugin/loader.rb
@@ -73,6 +73,7 @@ module Rails
def configure_engines
if engines.any?
add_engine_routing_configurations
+ add_engine_locales
add_engine_controller_paths
add_engine_view_paths
end
@@ -84,6 +85,14 @@ module Rails
end
end
+ def add_engine_locales
+ localized_engines = engines.select { |engine| engine.localized? }
+
+ # reverse it such that the last engine can overwrite translations from the first, like with routes
+ locale_files = localized_engines.collect { |engine| engine.locale_files }.reverse.flatten
+ I18n.load_path += locale_files - I18n.load_path
+ end
+
def add_engine_controller_paths
ActionController::Routing.controller_paths += engines.collect {|engine| engine.controller_path }
end
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake
index 687bc00b3c..8401cf0590 100644
--- a/railties/lib/tasks/databases.rake
+++ b/railties/lib/tasks/databases.rake
@@ -55,7 +55,7 @@ namespace :db do
case config['adapter']
when 'mysql'
@charset = ENV['CHARSET'] || 'utf8'
- @collation = ENV['COLLATION'] || 'utf8_general_ci'
+ @collation = ENV['COLLATION'] || 'utf8_unicode_ci'
creation_options = {:charset => (config['charset'] || @charset), :collation => (config['collation'] || @collation)}
begin
ActiveRecord::Base.establish_connection(config.merge('database' => nil))
diff --git a/railties/lib/vendor/thor-0.11.5/CHANGELOG.rdoc b/railties/lib/vendor/thor-0.11.6/CHANGELOG.rdoc
index dba25b7205..dba25b7205 100644
--- a/railties/lib/vendor/thor-0.11.5/CHANGELOG.rdoc
+++ b/railties/lib/vendor/thor-0.11.6/CHANGELOG.rdoc
diff --git a/railties/lib/vendor/thor-0.11.5/LICENSE b/railties/lib/vendor/thor-0.11.6/LICENSE
index 98722da459..98722da459 100644
--- a/railties/lib/vendor/thor-0.11.5/LICENSE
+++ b/railties/lib/vendor/thor-0.11.6/LICENSE
diff --git a/railties/lib/vendor/thor-0.11.5/README.rdoc b/railties/lib/vendor/thor-0.11.6/README.rdoc
index f1106f02b6..f1106f02b6 100644
--- a/railties/lib/vendor/thor-0.11.5/README.rdoc
+++ b/railties/lib/vendor/thor-0.11.6/README.rdoc
diff --git a/railties/lib/vendor/thor-0.11.5/bin/rake2thor b/railties/lib/vendor/thor-0.11.6/bin/rake2thor
index 50c7410d80..50c7410d80 100755
--- a/railties/lib/vendor/thor-0.11.5/bin/rake2thor
+++ b/railties/lib/vendor/thor-0.11.6/bin/rake2thor
diff --git a/railties/lib/vendor/thor-0.11.5/bin/thor b/railties/lib/vendor/thor-0.11.6/bin/thor
index eaf849fb4a..eaf849fb4a 100755
--- a/railties/lib/vendor/thor-0.11.5/bin/thor
+++ b/railties/lib/vendor/thor-0.11.6/bin/thor
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor.rb b/railties/lib/vendor/thor-0.11.6/lib/thor.rb
index 8dfcfd4c5b..3b45c4e9b7 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor.rb
@@ -135,7 +135,7 @@ class Thor
args, opts = given_args, {}
end
- task ||= Task.dynamic(meth)
+ task ||= Thor::Task::Dynamic.new(meth)
trailing = args[Range.new(arguments.size, -1)]
new(args, opts, config).invoke(task, trailing || [])
end
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/actions.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/actions.rb
index 1d09dc38ae..d561ccb2aa 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/actions.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/actions.rb
@@ -8,23 +8,8 @@ class Thor
module Actions
attr_accessor :behavior
- # On inclusion, add some options to base.
- #
def self.included(base) #:nodoc:
base.extend ClassMethods
- return unless base.respond_to?(:class_option)
-
- base.class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime,
- :desc => "Run but do not make any changes"
-
- base.class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime,
- :desc => "Overwrite files that already exist"
-
- base.class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime,
- :desc => "Skip files that already exist"
-
- base.class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime,
- :desc => "Supress status output"
end
module ClassMethods
@@ -49,6 +34,22 @@ class Thor
paths += from_superclass(:source_paths, [])
paths
end
+
+ # Add runtime options that help actions execution.
+ #
+ def add_runtime_options!
+ class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime,
+ :desc => "Run but do not make any changes"
+
+ class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime,
+ :desc => "Overwrite files that already exist"
+
+ class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime,
+ :desc => "Skip files that already exist"
+
+ class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime,
+ :desc => "Supress status output"
+ end
end
# Extends initializer to add more configuration options.
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/create_file.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/create_file.rb
index 8f6badee27..8f6badee27 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/create_file.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/create_file.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/directory.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/directory.rb
index be5eb822ac..be5eb822ac 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/directory.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/directory.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/empty_directory.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb
index 03c1fe4af1..03c1fe4af1 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/empty_directory.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/file_manipulation.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb
index 74c157ba8c..d77d90d448 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/file_manipulation.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb
@@ -100,7 +100,7 @@ class Thor
FileUtils.chmod_R(mode, path) unless options[:pretend]
end
- # Prepend text to a file.
+ # Prepend text to a file. Since it depends on inject_into_file, it's reversible.
#
# ==== Parameters
# path<String>:: path of the file to be changed
@@ -111,19 +111,17 @@ class Thor
#
# prepend_file 'config/environments/test.rb', 'config.gem "rspec"'
#
- def prepend_file(path, data=nil, config={}, &block)
- return unless behavior == :invoke
- path = File.expand_path(path, destination_root)
- say_status :prepend, relative_to_original_destination_root(path), config.fetch(:verbose, true)
-
- unless options[:pretend]
- content = data || block.call
- content << File.read(path)
- File.open(path, 'wb') { |file| file.write(content) }
- end
+ # prepend_file 'config/environments/test.rb' do
+ # 'config.gem "rspec"'
+ # end
+ #
+ def prepend_file(path, *args, &block)
+ config = args.last.is_a?(Hash) ? args.pop : {}
+ config.merge!(:after => /\A/)
+ inject_into_file(path, *(args << config), &block)
end
- # Append text to a file.
+ # Append text to a file. Since it depends on inject_into_file, it's reversible.
#
# ==== Parameters
# path<String>:: path of the file to be changed
@@ -134,11 +132,37 @@ class Thor
#
# append_file 'config/environments/test.rb', 'config.gem "rspec"'
#
- def append_file(path, data=nil, config={}, &block)
- return unless behavior == :invoke
- path = File.expand_path(path, destination_root)
- say_status :append, relative_to_original_destination_root(path), config.fetch(:verbose, true)
- File.open(path, 'ab') { |file| file.write(data || block.call) } unless options[:pretend]
+ # append_file 'config/environments/test.rb' do
+ # 'config.gem "rspec"'
+ # end
+ #
+ def append_file(path, *args, &block)
+ config = args.last.is_a?(Hash) ? args.pop : {}
+ config.merge!(:before => /\z/)
+ inject_into_file(path, *(args << config), &block)
+ end
+
+ # Injects text right after the class definition. Since it depends on
+ # inject_into_file, it's reversible.
+ #
+ # ==== Parameters
+ # path<String>:: path of the file to be changed
+ # klass<String|Class>:: the class to be manipulated
+ # data<String>:: the data to append to the class, can be also given as a block.
+ # config<Hash>:: give :verbose => false to not log the status.
+ #
+ # ==== Examples
+ #
+ # inject_into_class "app/controllers/application_controller.rb", " filter_parameter :password\n"
+ #
+ # inject_into_class "app/controllers/application_controller.rb", ApplicationController do
+ # " filter_parameter :password\n"
+ # end
+ #
+ def inject_into_class(path, klass, *args, &block)
+ config = args.last.is_a?(Hash) ? args.pop : {}
+ config.merge!(:after => /class #{klass}\n|class #{klass} .*\n/)
+ inject_into_file(path, *(args << config), &block)
end
# Run a regular expression replacement on a file.
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/inject_into_file.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb
index 66dd1f5fc1..0636ec6591 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/actions/inject_into_file.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb
@@ -3,10 +3,8 @@ require 'thor/actions/empty_directory'
class Thor
module Actions
- # Injects the given content into a file. Different from append_file,
- # prepend_file and gsub_file, this method is reversible. By this reason,
- # the flag can only be strings. gsub_file is your friend if you need to
- # deal with more complex cases.
+ # Injects the given content into a file. Different from gsub_file, this
+ # method is reversible.
#
# ==== Parameters
# destination<String>:: Relative path to the destination root
@@ -16,11 +14,11 @@ class Thor
#
# ==== Examples
#
- # inject_into_file "config/environment.rb", "config.gem thor", :after => "Rails::Initializer.run do |config|\n"
+ # inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
#
# inject_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
# gems = ask "Which gems would you like to add?"
- # gems.split(" ").map{ |gem| " config.gem #{gem}" }.join("\n")
+ # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
# end
#
def inject_into_file(destination, *args, &block)
@@ -29,40 +27,65 @@ class Thor
else
data, config = args.shift, args.shift
end
-
- log_status = args.empty? || args.pop
action InjectIntoFile.new(self, destination, data, config)
end
class InjectIntoFile < EmptyDirectory #:nodoc:
- attr_reader :flag, :replacement
+ attr_reader :replacement, :flag, :behavior
def initialize(base, destination, data, config)
super(base, destination, { :verbose => true }.merge(config))
- data = data.call if data.is_a?(Proc)
-
- @replacement = if @config.key?(:after)
- @flag = @config.delete(:after)
- @flag + data
+ @behavior, @flag = if @config.key?(:after)
+ [:after, @config.delete(:after)]
else
- @flag = @config.delete(:before)
- data + @flag
+ [:before, @config.delete(:before)]
end
+
+ @replacement = data.is_a?(Proc) ? data.call : data
+ @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp)
end
def invoke!
- say_status :inject, config[:verbose]
- replace!(flag, replacement)
+ say_status :invoke
+
+ content = if @behavior == :after
+ '\0' + replacement
+ else
+ replacement + '\0'
+ end
+
+ replace!(/#{flag}/, content)
end
def revoke!
- say_status :deinject, config[:verbose]
- replace!(replacement, flag)
+ say_status :revoke
+
+ regexp = if @behavior == :after
+ content = '\1\2'
+ /(#{flag})(.*)(#{Regexp.escape(replacement)})/m
+ else
+ content = '\2\3'
+ /(#{Regexp.escape(replacement)})(.*)(#{flag})/m
+ end
+
+ replace!(regexp, content)
end
protected
+ def say_status(behavior)
+ status = if flag == /\A/
+ behavior == :invoke ? :prepend : :unprepend
+ elsif flag == /\z/
+ behavior == :invoke ? :append : :unappend
+ else
+ behavior == :invoke ? :inject : :deinject
+ end
+
+ super(status, config[:verbose])
+ end
+
# Adds the content to the file.
#
def replace!(regexp, string)
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/base.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/base.rb
index 0fa87f8162..700d794123 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/base.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/base.rb
@@ -355,6 +355,7 @@ class Thor
else
config[:shell].error e.message
end
+ exit(1) if exit_on_failure?
end
protected
@@ -491,6 +492,12 @@ class Thor
end
end
+ # A flag that makes the process exit with status 1 if any error happens.
+ #
+ def exit_on_failure?
+ false
+ end
+
# SIGNATURE: Sets the baseclass. This is where the superclass lookup
# finishes.
def baseclass #:nodoc:
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb
index 78bc5cf4bf..78bc5cf4bf 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/core_ext/hash_with_indifferent_access.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/core_ext/ordered_hash.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb
index 27fea5bb35..27fea5bb35 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/core_ext/ordered_hash.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/error.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/error.rb
index f9b31a35d1..f9b31a35d1 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/error.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/error.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/group.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/group.rb
index 1e59df2313..1e59df2313 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/group.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/group.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/invocation.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/invocation.rb
index c0388dd863..32e6a72454 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/invocation.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/invocation.rb
@@ -153,7 +153,7 @@ class Thor
raise "Expected Thor class, got #{klass}" unless klass <= Thor::Base
task ||= klass.default_task if klass <= Thor
- task = klass.all_tasks[task.to_s] || Task.dynamic(task) if task && !task.is_a?(Thor::Task)
+ task = klass.all_tasks[task.to_s] || Thor::Task::Dynamic.new(task) if task && !task.is_a?(Thor::Task)
task
end
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/parser.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/parser.rb
index 57a3f6e1a5..57a3f6e1a5 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/parser.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/parser.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/argument.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/argument.rb
index aa8ace4719..aa8ace4719 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/argument.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/argument.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/arguments.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/arguments.rb
index fb5d965e06..fb5d965e06 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/arguments.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/arguments.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/option.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/option.rb
index 9e40ec73fa..9e40ec73fa 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/option.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/option.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/options.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/options.rb
index 75092308b5..75092308b5 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/parser/options.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/parser/options.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/rake_compat.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/rake_compat.rb
index 3ab6bb21f5..3ab6bb21f5 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/rake_compat.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/rake_compat.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/runner.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/runner.rb
index 3639ac0aa9..43da09b336 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/runner.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/runner.rb
@@ -175,6 +175,10 @@ class Thor::Runner < Thor #:nodoc:
File.open(yaml_file, "w") { |f| f.puts yaml.to_yaml }
end
+ def self.exit_on_failure?
+ true
+ end
+
# Load the thorfiles. If relevant_to is supplied, looks for specific files
# in the thor_root instead of loading them all.
#
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/shell.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/shell.rb
index 0d3f4d5951..0d3f4d5951 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/shell.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/shell.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/shell/basic.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/shell/basic.rb
index 3c02e47c33..ea9665380b 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/shell/basic.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/shell/basic.rb
@@ -34,12 +34,11 @@ class Thor
# ==== Example
# say("I know you knew that.")
#
- def say(message="", color=nil, force_new_line=false)
+ def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)$/))
message = message.to_s
- new_line = force_new_line || !(message[-1, 1] == " " || message[-1, 1] == "\t")
message = set_color(message, color) if color
- if new_line
+ if force_new_line
$stdout.puts(message)
else
$stdout.print(message)
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/shell/color.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/shell/color.rb
index 24704f7885..24704f7885 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/shell/color.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/shell/color.rb
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/task.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/task.rb
index 23d35b883c..91c7564d3f 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/task.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/task.rb
@@ -1,11 +1,19 @@
class Thor
class Task < Struct.new(:name, :description, :usage, :options)
- # Creates a dynamic task. Dynamic tasks are created on demand to allow method
- # missing calls (since a method missing does not have a task object for it).
+ # A dynamic task that handles method missing scenarios.
#
- def self.dynamic(name)
- new(name, "A dynamically-generated task", name.to_s)
+ class Dynamic < Task
+ def initialize(name)
+ super(name.to_s, "A dynamically-generated task", name.to_s)
+ end
+
+ def run(instance, args=[])
+ unless (instance.methods & [name.to_s, name.to_sym]).empty?
+ raise Error, "could not find Thor class or task '#{name}'"
+ end
+ super
+ end
end
def initialize(name, description, usage, options=nil)
@@ -37,8 +45,6 @@ class Thor
# injected in the usage.
#
def formatted_usage(klass=nil, namespace=false, show_options=true)
- formatted = ''
-
formatted = if namespace.is_a?(String)
"#{namespace}:"
elsif klass && namespace
@@ -77,7 +83,7 @@ class Thor
#
def public_method?(instance) #:nodoc:
collection = instance.private_methods + instance.protected_methods
- !(collection).include?(name.to_s) && !(collection).include?(name.to_sym) # For Ruby 1.9
+ (collection & [name.to_s, name.to_sym]).empty?
end
# Clean everything that comes from the Thor gempath and remove the caller.
diff --git a/railties/lib/vendor/thor-0.11.5/lib/thor/util.rb b/railties/lib/vendor/thor-0.11.6/lib/thor/util.rb
index 4938dc4aca..fd820d7462 100644
--- a/railties/lib/vendor/thor-0.11.5/lib/thor/util.rb
+++ b/railties/lib/vendor/thor-0.11.6/lib/thor/util.rb
@@ -22,7 +22,7 @@ class Thor
# namespace<String>:: The namespace to search for.
#
def self.find_by_namespace(namespace)
- namespace = 'default' if namespace.empty?
+ namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/
Thor::Base.subclasses.find do |klass|
klass.namespace == namespace
@@ -137,17 +137,18 @@ class Thor
# inherit from Thor or Thor::Group.
#
def self.namespace_to_thor_class_and_task(namespace, raise_if_nil=true)
- klass, task_name = Thor::Util.find_by_namespace(namespace), nil
+ if namespace.include?(?:)
+ pieces = namespace.split(":")
+ task = pieces.pop
+ klass = Thor::Util.find_by_namespace(pieces.join(":"))
+ end
- if klass.nil? && namespace.include?(?:)
- namespace = namespace.split(":")
- task_name = namespace.pop
- klass = Thor::Util.find_by_namespace(namespace.join(":"))
+ unless klass
+ klass, task = Thor::Util.find_by_namespace(namespace), nil
end
raise Error, "could not find Thor class or task '#{namespace}'" if raise_if_nil && klass.nil?
-
- return klass, task_name
+ return klass, task
end
# Receives a path and load the thor file in the path. The file is evaluated
diff --git a/railties/rails.gemspec b/railties/rails.gemspec
new file mode 100644
index 0000000000..b937667246
--- /dev/null
+++ b/railties/rails.gemspec
@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{rails}
+ s.version = "3.0.pre"
+
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
+ s.authors = ["David Heinemeier Hansson"]
+ s.date = %q{2009-08-31}
+ s.default_executable = %q{rails}
+ s.description = %q{ 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.
+}
+ s.email = %q{david@loudthinking.com}
+ s.executables = ["rails"]
+ s.files = ["bin", "builtin", "CHANGELOG", "guides", "lib", "MIT-LICENSE", "pkg", "rails.gemspec", "Rakefile", "README", "bin/rails", "builtin/rails_info", "builtin/rails_info/rails", "builtin/rails_info/rails/info.rb", "builtin/rails_info/rails/info_controller.rb", "builtin/rails_info/rails/info_helper.rb", "builtin/rails_info/rails_info_controller.rb", "guides/files", "guides/files/javascripts", "guides/files/javascripts/code_highlighter.js", "guides/files/javascripts/guides.js", "guides/files/javascripts/highlighters.js", "guides/files/stylesheets", "guides/files/stylesheets/main.css", "guides/files/stylesheets/print.css", "guides/files/stylesheets/reset.css", "guides/files/stylesheets/style.css", "guides/files/stylesheets/syntax.css", "guides/images", "guides/images/belongs_to.png", "guides/images/book_icon.gif", "guides/images/bullet.gif", "guides/images/chapters_icon.gif", "guides/images/check_bullet.gif", "guides/images/credits_pic_blank.gif", "guides/images/csrf.png", "guides/images/customized_error_messages.png", "guides/images/error_messages.png", "guides/images/feature_tile.gif", "guides/images/footer_tile.gif", "guides/images/fxn.png", "guides/images/grey_bullet.gif", "guides/images/habtm.png", "guides/images/has_many.png", "guides/images/has_many_through.png", "guides/images/has_one.png", "guides/images/has_one_through.png", "guides/images/header_backdrop.png", "guides/images/header_tile.gif", "guides/images/i18n", "guides/images/i18n/demo_localized_pirate.png", "guides/images/i18n/demo_translated_en.png", "guides/images/i18n/demo_translated_pirate.png", "guides/images/i18n/demo_translation_missing.png", "guides/images/i18n/demo_untranslated.png", "guides/images/icons", "guides/images/icons/callouts", "guides/images/icons/callouts/1.png", "guides/images/icons/callouts/10.png", "guides/images/icons/callouts/11.png", "guides/images/icons/callouts/12.png", "guides/images/icons/callouts/13.png", "guides/images/icons/callouts/14.png", "guides/images/icons/callouts/15.png", "guides/images/icons/callouts/2.png", "guides/images/icons/callouts/3.png", "guides/images/icons/callouts/4.png", "guides/images/icons/callouts/5.png", "guides/images/icons/callouts/6.png", "guides/images/icons/callouts/7.png", "guides/images/icons/callouts/8.png", "guides/images/icons/callouts/9.png", "guides/images/icons/caution.png", "guides/images/icons/example.png", "guides/images/icons/home.png", "guides/images/icons/important.png", "guides/images/icons/next.png", "guides/images/icons/note.png", "guides/images/icons/prev.png", "guides/images/icons/README", "guides/images/icons/tip.png", "guides/images/icons/up.png", "guides/images/icons/warning.png", "guides/images/nav_arrow.gif", "guides/images/polymorphic.png", "guides/images/posts_index.png", "guides/images/rails_guides_logo.gif", "guides/images/rails_logo_remix.gif", "guides/images/rails_welcome.png", "guides/images/session_fixation.png", "guides/images/tab_grey.gif", "guides/images/tab_info.gif", "guides/images/tab_note.gif", "guides/images/tab_red.gif", "guides/images/tab_yellow.gif", "guides/images/tab_yellow.png", "guides/images/validation_error_messages.png", "guides/rails_guides", "guides/rails_guides/generator.rb", "guides/rails_guides/helpers.rb", "guides/rails_guides/indexer.rb", "guides/rails_guides/levenshtein.rb", "guides/rails_guides/textile_extensions.rb", "guides/rails_guides.rb", "guides/source", "guides/source/2_2_release_notes.textile", "guides/source/2_3_release_notes.textile", "guides/source/action_controller_overview.textile", "guides/source/action_mailer_basics.textile", "guides/source/action_view_overview.textile", "guides/source/active_record_basics.textile", "guides/source/active_record_querying.textile", "guides/source/active_support_overview.textile", "guides/source/activerecord_validations_callbacks.textile", "guides/source/ajax_on_rails.textile", "guides/source/association_basics.textile", "guides/source/caching_with_rails.textile", "guides/source/command_line.textile", "guides/source/configuring.textile", "guides/source/contribute.textile", "guides/source/contributing_to_rails.textile", "guides/source/credits.erb.textile", "guides/source/debugging_rails_applications.textile", "guides/source/form_helpers.textile", "guides/source/getting_started.textile", "guides/source/i18n.textile", "guides/source/index.erb.textile", "guides/source/layout.html.erb", "guides/source/layouts_and_rendering.textile", "guides/source/migrations.textile", "guides/source/nested_model_forms.textile", "guides/source/performance_testing.textile", "guides/source/plugins.textile", "guides/source/rails_application_templates.textile", "guides/source/rails_on_rack.textile", "guides/source/routing.textile", "guides/source/security.textile", "guides/source/testing.textile", "lib/code_statistics.rb", "lib/commands", "lib/commands/about.rb", "lib/commands/console.rb", "lib/commands/dbconsole.rb", "lib/commands/destroy.rb", "lib/commands/generate.rb", "lib/commands/ncgi", "lib/commands/ncgi/listener", "lib/commands/ncgi/tracker", "lib/commands/performance", "lib/commands/performance/benchmarker.rb", "lib/commands/performance/profiler.rb", "lib/commands/plugin.rb", "lib/commands/runner.rb", "lib/commands/server.rb", "lib/commands/update.rb", "lib/commands.rb", "lib/console_app.rb", "lib/console_sandbox.rb", "lib/console_with_helpers.rb", "lib/dispatcher.rb", "lib/fcgi_handler.rb", "lib/generators", "lib/generators/actions.rb", "lib/generators/active_model.rb", "lib/generators/active_record", "lib/generators/active_record/migration", "lib/generators/active_record/migration/migration_generator.rb", "lib/generators/active_record/migration/templates", "lib/generators/active_record/migration/templates/migration.rb", "lib/generators/active_record/model", "lib/generators/active_record/model/model_generator.rb", "lib/generators/active_record/model/templates", "lib/generators/active_record/model/templates/migration.rb", "lib/generators/active_record/model/templates/model.rb", "lib/generators/active_record/observer", "lib/generators/active_record/observer/observer_generator.rb", "lib/generators/active_record/observer/templates", "lib/generators/active_record/observer/templates/observer.rb", "lib/generators/active_record/session_migration", "lib/generators/active_record/session_migration/session_migration_generator.rb", "lib/generators/active_record/session_migration/templates", "lib/generators/active_record/session_migration/templates/migration.rb", "lib/generators/active_record.rb", "lib/generators/base.rb", "lib/generators/erb", "lib/generators/erb/controller", "lib/generators/erb/controller/controller_generator.rb", "lib/generators/erb/controller/templates", "lib/generators/erb/controller/templates/view.html.erb", "lib/generators/erb/mailer", "lib/generators/erb/mailer/mailer_generator.rb", "lib/generators/erb/mailer/templates", "lib/generators/erb/mailer/templates/view.erb", "lib/generators/erb/scaffold", "lib/generators/erb/scaffold/scaffold_generator.rb", "lib/generators/erb/scaffold/templates", "lib/generators/erb/scaffold/templates/_form.html.erb", "lib/generators/erb/scaffold/templates/edit.html.erb", "lib/generators/erb/scaffold/templates/index.html.erb", "lib/generators/erb/scaffold/templates/layout.html.erb", "lib/generators/erb/scaffold/templates/new.html.erb", "lib/generators/erb/scaffold/templates/show.html.erb", "lib/generators/erb.rb", "lib/generators/generated_attribute.rb", "lib/generators/migration.rb", "lib/generators/named_base.rb", "lib/generators/rails", "lib/generators/rails/app", "lib/generators/rails/app/app_generator.rb", "lib/generators/rails/app/templates", "lib/generators/rails/app/templates/app", "lib/generators/rails/app/templates/app/controllers", "lib/generators/rails/app/templates/app/controllers/application_controller.rb", "lib/generators/rails/app/templates/app/helpers", "lib/generators/rails/app/templates/app/helpers/application_helper.rb", "lib/generators/rails/app/templates/app/models", "lib/generators/rails/app/templates/app/views", "lib/generators/rails/app/templates/app/views/layouts", "lib/generators/rails/app/templates/config", "lib/generators/rails/app/templates/config/boot.rb", "lib/generators/rails/app/templates/config/databases", "lib/generators/rails/app/templates/config/databases/frontbase.yml", "lib/generators/rails/app/templates/config/databases/ibm_db.yml", "lib/generators/rails/app/templates/config/databases/mysql.yml", "lib/generators/rails/app/templates/config/databases/oracle.yml", "lib/generators/rails/app/templates/config/databases/postgresql.yml", "lib/generators/rails/app/templates/config/databases/sqlite3.yml", "lib/generators/rails/app/templates/config/environment.rb", "lib/generators/rails/app/templates/config/environments", "lib/generators/rails/app/templates/config/environments/development.rb", "lib/generators/rails/app/templates/config/environments/production.rb", "lib/generators/rails/app/templates/config/environments/test.rb", "lib/generators/rails/app/templates/config/initializers", "lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb", "lib/generators/rails/app/templates/config/initializers/inflections.rb", "lib/generators/rails/app/templates/config/initializers/mime_types.rb", "lib/generators/rails/app/templates/config/initializers/new_rails_defaults.rb", "lib/generators/rails/app/templates/config/initializers/session_store.rb.tt", "lib/generators/rails/app/templates/config/locales", "lib/generators/rails/app/templates/config/locales/en.yml", "lib/generators/rails/app/templates/config/routes.rb", "lib/generators/rails/app/templates/db", "lib/generators/rails/app/templates/db/seeds.rb", "lib/generators/rails/app/templates/dispatchers", "lib/generators/rails/app/templates/dispatchers/config.ru", "lib/generators/rails/app/templates/dispatchers/dispatch.fcgi", "lib/generators/rails/app/templates/dispatchers/dispatch.rb", "lib/generators/rails/app/templates/dispatchers/gateway.cgi", "lib/generators/rails/app/templates/doc", "lib/generators/rails/app/templates/doc/README_FOR_APP", "lib/generators/rails/app/templates/public", "lib/generators/rails/app/templates/public/404.html", "lib/generators/rails/app/templates/public/422.html", "lib/generators/rails/app/templates/public/500.html", "lib/generators/rails/app/templates/public/favicon.ico", "lib/generators/rails/app/templates/public/images", "lib/generators/rails/app/templates/public/images/rails.png", "lib/generators/rails/app/templates/public/index.html", "lib/generators/rails/app/templates/public/javascripts", "lib/generators/rails/app/templates/public/javascripts/application.js", "lib/generators/rails/app/templates/public/javascripts/controls.js", "lib/generators/rails/app/templates/public/javascripts/dragdrop.js", "lib/generators/rails/app/templates/public/javascripts/effects.js", "lib/generators/rails/app/templates/public/javascripts/prototype.js", "lib/generators/rails/app/templates/public/robots.txt", "lib/generators/rails/app/templates/public/stylesheets", "lib/generators/rails/app/templates/Rakefile", "lib/generators/rails/app/templates/README", "lib/generators/rails/app/templates/script", "lib/generators/rails/app/templates/script/about.tt", "lib/generators/rails/app/templates/script/console.tt", "lib/generators/rails/app/templates/script/dbconsole.tt", "lib/generators/rails/app/templates/script/destroy.tt", "lib/generators/rails/app/templates/script/generate.tt", "lib/generators/rails/app/templates/script/performance", "lib/generators/rails/app/templates/script/performance/benchmarker.tt", "lib/generators/rails/app/templates/script/performance/profiler.tt", "lib/generators/rails/app/templates/script/plugin.tt", "lib/generators/rails/app/templates/script/runner.tt", "lib/generators/rails/app/templates/script/server.tt", "lib/generators/rails/app/templates/test", "lib/generators/rails/app/templates/test/fixtures", "lib/generators/rails/app/templates/test/functional", "lib/generators/rails/app/templates/test/integration", "lib/generators/rails/app/templates/test/performance", "lib/generators/rails/app/templates/test/performance/browsing_test.rb", "lib/generators/rails/app/templates/test/test_helper.rb", "lib/generators/rails/app/templates/test/unit", "lib/generators/rails/app/USAGE", "lib/generators/rails/controller", "lib/generators/rails/controller/controller_generator.rb", "lib/generators/rails/controller/templates", "lib/generators/rails/controller/templates/controller.rb", "lib/generators/rails/controller/USAGE", "lib/generators/rails/generator", "lib/generators/rails/generator/generator_generator.rb", "lib/generators/rails/generator/templates", "lib/generators/rails/generator/templates/%file_name%_generator.rb.tt", "lib/generators/rails/generator/templates/templates", "lib/generators/rails/generator/templates/USAGE.tt", "lib/generators/rails/generator/USAGE", "lib/generators/rails/helper", "lib/generators/rails/helper/helper_generator.rb", "lib/generators/rails/helper/templates", "lib/generators/rails/helper/templates/helper.rb", "lib/generators/rails/helper/USAGE", "lib/generators/rails/integration_test", "lib/generators/rails/integration_test/integration_test_generator.rb", "lib/generators/rails/integration_test/USAGE", "lib/generators/rails/mailer", "lib/generators/rails/mailer/mailer_generator.rb", "lib/generators/rails/mailer/templates", "lib/generators/rails/mailer/templates/mailer.rb", "lib/generators/rails/mailer/USAGE", "lib/generators/rails/metal", "lib/generators/rails/metal/metal_generator.rb", "lib/generators/rails/metal/templates", "lib/generators/rails/metal/templates/metal.rb", "lib/generators/rails/metal/USAGE", "lib/generators/rails/migration", "lib/generators/rails/migration/migration_generator.rb", "lib/generators/rails/migration/USAGE", "lib/generators/rails/model", "lib/generators/rails/model/model_generator.rb", "lib/generators/rails/model/USAGE", "lib/generators/rails/model_subclass", "lib/generators/rails/model_subclass/model_subclass_generator.rb", "lib/generators/rails/observer", "lib/generators/rails/observer/observer_generator.rb", "lib/generators/rails/observer/USAGE", "lib/generators/rails/performance_test", "lib/generators/rails/performance_test/performance_test_generator.rb", "lib/generators/rails/performance_test/USAGE", "lib/generators/rails/plugin", "lib/generators/rails/plugin/plugin_generator.rb", "lib/generators/rails/plugin/templates", "lib/generators/rails/plugin/templates/init.rb", "lib/generators/rails/plugin/templates/install.rb", "lib/generators/rails/plugin/templates/lib", "lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt", "lib/generators/rails/plugin/templates/MIT-LICENSE", "lib/generators/rails/plugin/templates/Rakefile", "lib/generators/rails/plugin/templates/README", "lib/generators/rails/plugin/templates/tasks", "lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt", "lib/generators/rails/plugin/templates/uninstall.rb", "lib/generators/rails/plugin/USAGE", "lib/generators/rails/resource", "lib/generators/rails/resource/resource_generator.rb", "lib/generators/rails/resource/USAGE", "lib/generators/rails/scaffold", "lib/generators/rails/scaffold/scaffold_generator.rb", "lib/generators/rails/scaffold/USAGE", "lib/generators/rails/scaffold_controller", "lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb", "lib/generators/rails/scaffold_controller/templates", "lib/generators/rails/scaffold_controller/templates/controller.rb", "lib/generators/rails/scaffold_controller/USAGE", "lib/generators/rails/session_migration", "lib/generators/rails/session_migration/session_migration_generator.rb", "lib/generators/rails/session_migration/USAGE", "lib/generators/rails/stylesheets", "lib/generators/rails/stylesheets/stylesheets_generator.rb", "lib/generators/rails/stylesheets/templates", "lib/generators/rails/stylesheets/templates/scaffold.css", "lib/generators/rails/stylesheets/USAGE", "lib/generators/resource_helpers.rb", "lib/generators/test_unit", "lib/generators/test_unit/controller", "lib/generators/test_unit/controller/controller_generator.rb", "lib/generators/test_unit/controller/templates", "lib/generators/test_unit/controller/templates/functional_test.rb", "lib/generators/test_unit/helper", "lib/generators/test_unit/helper/helper_generator.rb", "lib/generators/test_unit/helper/templates", "lib/generators/test_unit/helper/templates/helper_test.rb", "lib/generators/test_unit/integration", "lib/generators/test_unit/integration/integration_generator.rb", "lib/generators/test_unit/integration/templates", "lib/generators/test_unit/integration/templates/integration_test.rb", "lib/generators/test_unit/mailer", "lib/generators/test_unit/mailer/mailer_generator.rb", "lib/generators/test_unit/mailer/templates", "lib/generators/test_unit/mailer/templates/fixture", "lib/generators/test_unit/mailer/templates/unit_test.rb", "lib/generators/test_unit/model", "lib/generators/test_unit/model/model_generator.rb", "lib/generators/test_unit/model/templates", "lib/generators/test_unit/model/templates/fixtures.yml", "lib/generators/test_unit/model/templates/unit_test.rb", "lib/generators/test_unit/observer", "lib/generators/test_unit/observer/observer_generator.rb", "lib/generators/test_unit/observer/templates", "lib/generators/test_unit/observer/templates/unit_test.rb", "lib/generators/test_unit/performance", "lib/generators/test_unit/performance/performance_generator.rb", "lib/generators/test_unit/performance/templates", "lib/generators/test_unit/performance/templates/performance_test.rb", "lib/generators/test_unit/plugin", "lib/generators/test_unit/plugin/plugin_generator.rb", "lib/generators/test_unit/plugin/templates", "lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt", "lib/generators/test_unit/plugin/templates/test_helper.rb", "lib/generators/test_unit/scaffold", "lib/generators/test_unit/scaffold/scaffold_generator.rb", "lib/generators/test_unit/scaffold/templates", "lib/generators/test_unit/scaffold/templates/functional_test.rb", "lib/generators/test_unit.rb", "lib/generators.rb", "lib/initializer.rb", "lib/initializer_old.rb", "lib/performance_test_help.rb", "lib/rails", "lib/rails/backtrace_cleaner.rb", "lib/rails/configuration.rb", "lib/rails/core.rb", "lib/rails/gem_builder.rb", "lib/rails/gem_dependency.rb", "lib/rails/paths.rb", "lib/rails/plugin", "lib/rails/plugin/loader.rb", "lib/rails/plugin/locator.rb", "lib/rails/plugin.rb", "lib/rails/rack", "lib/rails/rack/debugger.rb", "lib/rails/rack/log_tailer.rb", "lib/rails/rack/metal.rb", "lib/rails/rack/static.rb", "lib/rails/rack.rb", "lib/rails/vendor_gem_source_index.rb", "lib/rails/version.rb", "lib/railties_path.rb", "lib/ruby_version_check.rb", "lib/rubyprof_ext.rb", "lib/source_annotation_extractor.rb", "lib/tasks", "lib/tasks/annotations.rake", "lib/tasks/databases.rake", "lib/tasks/documentation.rake", "lib/tasks/framework.rake", "lib/tasks/gems.rake", "lib/tasks/log.rake", "lib/tasks/middleware.rake", "lib/tasks/misc.rake", "lib/tasks/rails.rb", "lib/tasks/routes.rake", "lib/tasks/statistics.rake", "lib/tasks/testing.rake", "lib/tasks/tmp.rake", "lib/test_help.rb", "lib/vendor", "lib/vendor/bundler", "lib/vendor/bundler/bin", "lib/vendor/bundler/bin/gem_bundler", "lib/vendor/bundler/lib", "lib/vendor/bundler/lib/bundler", "lib/vendor/bundler/lib/bundler/cli.rb", "lib/vendor/bundler/lib/bundler/dependency.rb", "lib/vendor/bundler/lib/bundler/finder.rb", "lib/vendor/bundler/lib/bundler/gem_bundle.rb", "lib/vendor/bundler/lib/bundler/gem_specification.rb", "lib/vendor/bundler/lib/bundler/installer.rb", "lib/vendor/bundler/lib/bundler/manifest.rb", "lib/vendor/bundler/lib/bundler/resolver", "lib/vendor/bundler/lib/bundler/resolver/builders.rb", "lib/vendor/bundler/lib/bundler/resolver/engine.rb", "lib/vendor/bundler/lib/bundler/resolver/inspect.rb", "lib/vendor/bundler/lib/bundler/resolver/search.rb", "lib/vendor/bundler/lib/bundler/resolver/stack.rb", "lib/vendor/bundler/lib/bundler/resolver/state.rb", "lib/vendor/bundler/lib/bundler/resolver.rb", "lib/vendor/bundler/lib/bundler/runtime.rb", "lib/vendor/bundler/lib/bundler.rb", "lib/vendor/bundler/LICENSE", "lib/vendor/bundler/Rakefile", "lib/vendor/thor-0.11.6", "lib/vendor/thor-0.11.6/bin", "lib/vendor/thor-0.11.6/bin/rake2thor", "lib/vendor/thor-0.11.6/bin/thor", "lib/vendor/thor-0.11.6/CHANGELOG.rdoc", "lib/vendor/thor-0.11.6/lib", "lib/vendor/thor-0.11.6/lib/thor", "lib/vendor/thor-0.11.6/lib/thor/actions", "lib/vendor/thor-0.11.6/lib/thor/actions/create_file.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/directory.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb", "lib/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb", "lib/vendor/thor-0.11.6/lib/thor/actions.rb", "lib/vendor/thor-0.11.6/lib/thor/base.rb", "lib/vendor/thor-0.11.6/lib/thor/core_ext", "lib/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb", "lib/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb", "lib/vendor/thor-0.11.6/lib/thor/error.rb", "lib/vendor/thor-0.11.6/lib/thor/group.rb", "lib/vendor/thor-0.11.6/lib/thor/invocation.rb", "lib/vendor/thor-0.11.6/lib/thor/parser", "lib/vendor/thor-0.11.6/lib/thor/parser/argument.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/arguments.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/option.rb", "lib/vendor/thor-0.11.6/lib/thor/parser/options.rb", "lib/vendor/thor-0.11.6/lib/thor/parser.rb", "lib/vendor/thor-0.11.6/lib/thor/rake_compat.rb", "lib/vendor/thor-0.11.6/lib/thor/runner.rb", "lib/vendor/thor-0.11.6/lib/thor/shell", "lib/vendor/thor-0.11.6/lib/thor/shell/basic.rb", "lib/vendor/thor-0.11.6/lib/thor/shell/color.rb", "lib/vendor/thor-0.11.6/lib/thor/shell.rb", "lib/vendor/thor-0.11.6/lib/thor/task.rb", "lib/vendor/thor-0.11.6/lib/thor/util.rb", "lib/vendor/thor-0.11.6/lib/thor.rb", "lib/vendor/thor-0.11.6/LICENSE", "lib/vendor/thor-0.11.6/README.rdoc", "lib/webrick_server.rb"]
+ s.homepage = %q{http://www.rubyonrails.org}
+ s.rdoc_options = ["--exclude", "."]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{rails}
+ s.rubygems_version = %q{1.3.5}
+ s.summary = %q{Web-application framework with template engine, control-flow layer, and ORM.}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<rake>, [">= 0.8.3"])
+ s.add_runtime_dependency(%q<activesupport>, ["= 3.0.pre"])
+ s.add_runtime_dependency(%q<activerecord>, ["= 3.0.pre"])
+ s.add_runtime_dependency(%q<actionpack>, ["= 3.0.pre"])
+ s.add_runtime_dependency(%q<actionmailer>, ["= 3.0.pre"])
+ s.add_runtime_dependency(%q<activeresource>, ["= 3.0.pre"])
+ else
+ s.add_dependency(%q<rake>, [">= 0.8.3"])
+ s.add_dependency(%q<activesupport>, ["= 3.0.pre"])
+ s.add_dependency(%q<activerecord>, ["= 3.0.pre"])
+ s.add_dependency(%q<actionpack>, ["= 3.0.pre"])
+ s.add_dependency(%q<actionmailer>, ["= 3.0.pre"])
+ s.add_dependency(%q<activeresource>, ["= 3.0.pre"])
+ end
+ else
+ s.add_dependency(%q<rake>, [">= 0.8.3"])
+ s.add_dependency(%q<activesupport>, ["= 3.0.pre"])
+ s.add_dependency(%q<activerecord>, ["= 3.0.pre"])
+ s.add_dependency(%q<actionpack>, ["= 3.0.pre"])
+ s.add_dependency(%q<actionmailer>, ["= 3.0.pre"])
+ s.add_dependency(%q<activeresource>, ["= 3.0.pre"])
+ end
+end
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb
index 9a640bdbc5..ea6ed01c7d 100644
--- a/railties/test/abstract_unit.rb
+++ b/railties/test/abstract_unit.rb
@@ -1,5 +1,9 @@
ORIG_ARGV = ARGV.dup
+require 'rubygems'
+gem 'rack', '~> 1.0.0'
+gem 'rack-test', '~> 0.4.2'
+
$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib"
$:.unshift File.dirname(__FILE__) + "/../../activerecord/lib"
$:.unshift File.dirname(__FILE__) + "/../../actionpack/lib"
@@ -9,7 +13,6 @@ $:.unshift File.dirname(__FILE__) + "/../lib"
$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info"
require 'stringio'
-require 'rubygems'
require 'test/unit'
require 'active_support'
diff --git a/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml b/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml
new file mode 100644
index 0000000000..641a7e035c
--- /dev/null
+++ b/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml
@@ -0,0 +1,2 @@
+en:
+ hello: "Hello from Engine"
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index 05eadd3460..63559a8a01 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -75,6 +75,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase
edit
new
show
+ _form
).each { |view| assert_file "app/views/product_lines/#{view}.html.erb" }
assert_file "app/views/layouts/product_lines.html.erb"
diff --git a/railties/test/initializer/test_helper.rb b/railties/test/initializer/test_helper.rb
index 9d7dfff1c0..4cb9c1b814 100644
--- a/railties/test/initializer/test_helper.rb
+++ b/railties/test/initializer/test_helper.rb
@@ -5,6 +5,9 @@
RAILS_ROOT = File.join(File.dirname(__FILE__), "root")
RAILS_FRAMEWORK_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
+require 'rubygems'
+gem 'rack', '~> 1.0.0'
+
require "test/unit"
# We are purposely avoiding adding things to the load path to catch bugs that only happen in the genuine article
require File.join(RAILS_FRAMEWORK_ROOT, 'activesupport', 'lib', 'active_support', 'testing', 'isolation')
diff --git a/railties/test/initializer_test.rb b/railties/test/initializer_test.rb
index 1fecd62995..5bbd060962 100644
--- a/railties/test/initializer_test.rb
+++ b/railties/test/initializer_test.rb
@@ -406,6 +406,7 @@ class InitializerSetupI18nTests < Test::Unit::TestCase
File.expand_path(File.dirname(__FILE__) + "/../../actionpack/lib/action_view/locale/en.yml"),
File.expand_path(File.dirname(__FILE__) + "/../../activemodel/lib/active_model/locale/en.yml"),
File.expand_path(File.dirname(__FILE__) + "/../../activerecord/lib/active_record/locale/en.yml"),
+ File.expand_path(File.dirname(__FILE__) + "/../../railties/test/fixtures/plugins/engines/engine/config/locales/en.yml"),
"my/test/locale.yml",
"my/other/locale.yml" ], I18n.load_path.collect { |path| path =~ /\.\./ ? File.expand_path(path) : path }
end
diff --git a/railties/test/plugin_loader_test.rb b/railties/test/plugin_loader_test.rb
index 873e000222..99301347b6 100644
--- a/railties/test/plugin_loader_test.rb
+++ b/railties/test/plugin_loader_test.rb
@@ -156,6 +156,14 @@ class TestPluginLoader < Test::Unit::TestCase
plugin_load_paths.each { |path| assert $LOAD_PATH.include?(path) }
end
+ def test_should_add_locale_files_to_I18n_load_path
+ only_load_the_following_plugins! [:engine]
+
+ @loader.send :add_engine_locales
+
+ assert I18n.load_path.include?(File.join(plugin_fixture_path('engines/engine'), 'config', 'locales', 'en.yml'))
+ end
+
private
def reset_load_path!
diff --git a/railties/test/rails_info_test.rb b/railties/test/rails_info_test.rb
index fdcc7a1ef6..568e2a9972 100644
--- a/railties/test/rails_info_test.rb
+++ b/railties/test/rails_info_test.rb
@@ -3,6 +3,9 @@ $:.unshift File.dirname(__FILE__) + "/../builtin/rails_info"
$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib"
$:.unshift File.dirname(__FILE__) + "/../../actionpack/lib"
+require 'rubygems'
+gem 'rack', '~> 1.0.0'
+
require 'test/unit'
require 'active_support'
require 'active_support/test_case'