diff options
Diffstat (limited to 'railties')
52 files changed, 140 insertions, 477 deletions
diff --git a/railties/Rakefile b/railties/Rakefile index 827b2ba0cd..be9a77d4e4 100755 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -1,6 +1,6 @@ #!/usr/bin/env rake require 'rake/testtask' -require 'rake/gempackagetask' +require 'rubygems/package_task' require 'date' require 'rbconfig' @@ -55,7 +55,7 @@ end spec = eval(File.read('railties.gemspec')) -Rake::GemPackageTask.new(spec) do |pkg| +Gem::PackageTask.new(spec) do |pkg| pkg.gem_spec = spec end diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 99527bb051..953233d774 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -50,7 +50,9 @@ module Rails end end - attr_accessor :assets + attr_accessor :assets, :sandbox + alias_method :sandbox?, :sandbox + delegate :default_url_options, :default_url_options=, :to => :routes # This method is called just after an application inherits from Rails::Application, @@ -96,24 +98,25 @@ module Rails self end - def load_tasks + def load_tasks(app=self) initialize_tasks - railties.all { |r| r.load_tasks } + railties.all { |r| r.load_tasks(app) } super self end - def load_generators + def load_generators(app=self) initialize_generators - railties.all { |r| r.load_generators } + railties.all { |r| r.load_generators(app) } + Rails::Generators.configure!(app.config.generators) super self end - def load_console(sandbox=false) - initialize_console(sandbox) - railties.all { |r| r.load_console(sandbox) } - super() + def load_console(app=self) + initialize_console + railties.all { |r| r.load_console(app) } + super self end @@ -196,7 +199,7 @@ module Rails require "rails/generators" end - def initialize_console(sandbox=false) + def initialize_console require "pp" require "rails/console/app" require "rails/console/helpers" diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index 4a082aedb8..39627a3094 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -15,6 +15,8 @@ command = aliases[command] || command case command when 'generate', 'destroy', 'plugin' + require 'rails/generators' + if command == 'plugin' && ARGV.first == 'new' require "rails/commands/plugin_new" else @@ -22,7 +24,9 @@ when 'generate', 'destroy', 'plugin' Rails.application.require_environment! if defined?(ENGINE_PATH) && engine = Rails::Engine.find(ENGINE_PATH) - Rails.application = engine + Rails.application.load_generators(engine) + else + Rails.application.load_generators end require "rails/commands/#{command}" diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb index f3fa1fd54d..1cf23a8b92 100644 --- a/railties/lib/rails/commands/application.rb +++ b/railties/lib/rails/commands/application.rb @@ -12,7 +12,6 @@ else end require 'rubygems' if ARGV.include?("--dev") - require 'rails/generators' require 'rails/generators/rails/app/app_generator' diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 66dbb5d11e..32e361d421 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -23,7 +23,8 @@ module Rails opt.parse!(ARGV) end - @app.load_console(options[:sandbox]) + @app.sandbox = options[:sandbox] + @app.load_console if options[:debugger] begin diff --git a/railties/lib/rails/commands/destroy.rb b/railties/lib/rails/commands/destroy.rb index 2a84e2a6df..ae354eca97 100644 --- a/railties/lib/rails/commands/destroy.rb +++ b/railties/lib/rails/commands/destroy.rb @@ -1,8 +1,6 @@ require 'rails/generators' require 'active_support/core_ext/object/inclusion' -Rails::Generators.configure! - if ARGV.first.in?([nil, "-h", "--help"]) Rails::Generators.help 'destroy' exit diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index 28c1c56352..b6f9a003d1 100644 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -1,8 +1,6 @@ require 'rails/generators' require 'active_support/core_ext/object/inclusion' -Rails::Generators.configure! - if ARGV.first.in?([nil, "-h", "--help"]) Rails::Generators.help 'generate' exit diff --git a/railties/lib/rails/commands/plugin_new.rb b/railties/lib/rails/commands/plugin_new.rb index 8baa8ebfd4..0287ba0638 100644 --- a/railties/lib/rails/commands/plugin_new.rb +++ b/railties/lib/rails/commands/plugin_new.rb @@ -1,3 +1,5 @@ +require 'rubygems' if ARGV.include?("--dev") + if ARGV.first != "new" ARGV[0] = "--help" else @@ -6,5 +8,4 @@ end require 'rails/generators' require 'rails/generators/rails/plugin_new/plugin_new_generator' - -Rails::Generators::PluginNewGenerator.start +Rails::Generators::PluginNewGenerator.start
\ No newline at end of file diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 66fab0a760..f8ad17773a 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -43,6 +43,7 @@ module Rails class Generators #:nodoc: attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging + attr_reader :hidden_namespaces def initialize @aliases = Hash.new { |h,k| h[k] = {} } @@ -50,6 +51,7 @@ module Rails @fallbacks = {} @templates = [] @colorize_logging = true + @hidden_namespaces = [] end def initialize_copy(source) @@ -59,6 +61,10 @@ module Rails @templates = @templates.dup end + def hide_namespace(namespace) + @hidden_namespaces << namespace + end + def method_missing(method, *args) method = method.to_s.sub(/=$/, '').to_sym diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 81a0350724..0d01a818f5 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -387,7 +387,7 @@ module Rails delegate :middleware, :root, :paths, :to => :config delegate :engine_name, :isolated?, :to => "self.class" - def load_tasks + def load_tasks(*) super paths["lib/tasks"].existent.sort.each { |ext| load(ext) } end diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 85c67af19a..09e505a75b 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -57,7 +57,7 @@ module Rails :resource_controller => :controller, :scaffold_controller => :scaffold_controller, :stylesheets => true, - :stylesheet_engine => nil, + :stylesheet_engine => :css, :test_framework => false, :template_engine => :erb }, @@ -68,13 +68,14 @@ module Rails } } - def self.configure!(config = Rails.application.config.generators) #:nodoc: + def self.configure!(config) #:nodoc: no_color! unless config.colorize_logging aliases.deep_merge! config.aliases options.deep_merge! config.options fallbacks.merge! config.fallbacks templates_path.concat config.templates templates_path.uniq! + hide_namespaces *config.hidden_namespaces end def self.templates_path @@ -175,6 +176,7 @@ module Rails orm = options[:rails][:orm] test = options[:rails][:test_framework] template = options[:rails][:template_engine] + css = options[:rails][:stylesheet_engine] [ "rails", @@ -194,7 +196,11 @@ module Rails "#{test}:plugin", "#{template}:controller", "#{template}:scaffold", - "#{template}:mailer" + "#{template}:mailer", + "#{css}:scaffold", + "#{css}:assets", + "css:assets", + "css:scaffold" ] end end @@ -280,7 +286,6 @@ module Rails # Receives namespaces in an array and tries to find matching generators # in the load path. def self.lookup(namespaces) #:nodoc: - load_generators_from_railties! paths = namespaces_to_paths(namespaces) paths.each do |raw_path| @@ -304,8 +309,6 @@ module Rails # This will try to load any generator in the load path to show in help. def self.lookup! #:nodoc: - load_generators_from_railties! - $LOAD_PATH.each do |base| Dir[File.join(base, "{rails/generators,generators}", "**", "*_generator.rb")].each do |path| begin @@ -318,13 +321,6 @@ module Rails end end - # Allow generators to be loaded from custom paths. - def self.load_generators_from_railties! #:nodoc: - return if defined?(@generators_from_railties) || Rails.application.nil? - @generators_from_railties = true - Rails.application.load_generators - end - # Convert namespaces to paths by replacing ":" for "/" and adding # an extra lookup. For example, "rails:model" should be searched # in both: "rails/model/model_generator" and "rails/model_generator". diff --git a/railties/lib/rails/generators/css/assets/assets_generator.rb b/railties/lib/rails/generators/css/assets/assets_generator.rb new file mode 100644 index 0000000000..492177ca2e --- /dev/null +++ b/railties/lib/rails/generators/css/assets/assets_generator.rb @@ -0,0 +1,13 @@ +require "rails/generators/named_base" + +module Css + module Generators + class AssetsGenerator < Rails::Generators::NamedBase + source_root File.expand_path("../templates", __FILE__) + + def copy_stylesheet + copy_file "stylesheet.css", File.join('app/assets/stylesheets', class_path, "#{file_name}.css") + end + end + end +end diff --git a/railties/lib/rails/generators/rails/assets/templates/stylesheet.css.scss b/railties/lib/rails/generators/css/assets/templates/stylesheet.css index ba95e217cc..afad32db02 100644 --- a/railties/lib/rails/generators/rails/assets/templates/stylesheet.css.scss +++ b/railties/lib/rails/generators/css/assets/templates/stylesheet.css @@ -1,5 +1,4 @@ -/* +/* Place all the styles related to the matching controller here. They will automatically be included in application.css. - You can use Sass (SCSS) here: http://sass-lang.com/ */ diff --git a/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb new file mode 100644 index 0000000000..1d7fe9fac0 --- /dev/null +++ b/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb @@ -0,0 +1,16 @@ +require "rails/generators/named_base" + +module Css + module Generators + class ScaffoldGenerator < Rails::Generators::NamedBase + # In order to allow the Sass generators to pick up the default Rails CSS and + # transform it, we leave it in a standard location for the CSS stylesheet + # generators to handle. For the simple, default case, just copy it over. + def copy_stylesheet + dir = Rails::Generators::ScaffoldGenerator.source_root + file = File.join(dir, "scaffold.css") + create_file "app/assets/stylesheets/scaffold.css", File.read(file) + end + end + end +end diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index cf5bf9ca57..ebe38bf8e6 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -7,7 +7,7 @@ source 'http://rubygems.org' <%= "gem 'jruby-openssl'\n" if defined?(JRUBY_VERSION) -%> # Asset template engines <%= "gem 'json'\n" if RUBY_VERSION < "1.9.2" -%> -gem 'sass' +gem 'sass-rails' gem 'coffee-script' gem 'uglifier' diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index 8ff80c6fd3..a097c77391 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -39,17 +39,6 @@ module <%= app_const_base %> # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de - # Please note that JavaScript expansions are *ignored altogether* if the asset - # pipeline is enabled (see config.assets.enabled below). Put your defaults in - # app/assets/javascripts/application.js in that case. - # - # JavaScript files you want as :defaults (application.js is always included). -<% if options[:skip_javascript] -%> - # config.action_view.javascript_expansions[:defaults] = %w() -<% else -%> - # config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs) -<% end -%> - # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index 066aa54862..dcf4ace264 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -21,4 +21,7 @@ # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false end diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index 1c3dc1117f..60e26755fe 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -11,9 +11,11 @@ # Disable Rails's static asset server (Apache or nginx will already do this) config.serve_static_assets = false - # Compress both stylesheets and JavaScripts + # Compress JavaScripts and CSS + config.assets.compress = true + + # Specify the default JavaScript compressor config.assets.js_compressor = :uglifier - config.assets.css_compressor = :scss # Specifies the header that your server uses for sending files # (comment out if your front-end server doesn't support this) diff --git a/railties/lib/rails/generators/rails/assets/assets_generator.rb b/railties/lib/rails/generators/rails/assets/assets_generator.rb index 2d52da77eb..db3422fe83 100644 --- a/railties/lib/rails/generators/rails/assets/assets_generator.rb +++ b/railties/lib/rails/generators/rails/assets/assets_generator.rb @@ -13,12 +13,6 @@ module Rails File.join('app/assets/javascripts', class_path, "#{asset_name}.#{javascript_extension}") end - def create_stylesheet_files - return unless options.stylesheets? - copy_file "stylesheet.#{stylesheet_extension}", - File.join('app/assets/stylesheets', class_path, "#{asset_name}.#{stylesheet_extension}") - end - protected def asset_name @@ -30,9 +24,8 @@ module Rails "js.#{options.javascript_engine}" : "js" end - def stylesheet_extension - options.stylesheet_engine.present? ? - "css.#{options.stylesheet_engine}" : "css" + hook_for :stylesheet_engine do |stylesheet_engine| + invoke stylesheet_engine, [name] if options[:stylesheets] end end end diff --git a/railties/lib/rails/generators/rails/plugin/USAGE b/railties/lib/rails/generators/rails/plugin/USAGE deleted file mode 100644 index 1bcfcf190d..0000000000 --- a/railties/lib/rails/generators/rails/plugin/USAGE +++ /dev/null @@ -1,13 +0,0 @@ -Description: - Stubs out a new plugin at vendor/plugins. Pass the plugin name, either - CamelCased or under_scored, as an argument. - -Example: - `rails generate plugin BrowserFilters` - - creates a standard browser_filters plugin: - vendor/plugins/browser_filters/README - vendor/plugins/browser_filters/init.rb - vendor/plugins/browser_filters/install.rb - vendor/plugins/browser_filters/lib/browser_filters.rb - vendor/plugins/browser_filters/test/browser_filters_test.rb diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb deleted file mode 100644 index 97f681d826..0000000000 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ /dev/null @@ -1,54 +0,0 @@ - -require 'rails/generators/rails/generator/generator_generator' - -module Rails - module Generators - class PluginGenerator < NamedBase - class_option :tasks, :desc => "When supplied creates tasks base files." - - def show_deprecation - return unless behavior == :invoke - message = "Plugin generator is deprecated, please use 'rails plugin new' command to generate plugin structure." - ActiveSupport::Deprecation.warn message - end - - check_class_collision - - def create_root_files - directory '.', plugin_dir, :recursive => false - end - - def create_lib_files - directory 'lib', plugin_dir('lib'), :recursive => false - end - - def create_tasks_files - return unless options[:tasks] - directory 'lib/tasks', plugin_dir('lib/tasks') - end - - hook_for :generator do |generator| - inside plugin_dir, :verbose => true do - invoke generator, [ name ], :namespace => false - end - end - - hook_for :test_framework do |test_framework| - inside plugin_dir, :verbose => true do - invoke test_framework - end - end - - protected - - def plugin_dir(join=nil) - if join - File.join(plugin_dir, join) - else - "vendor/plugins/#{file_name}" - end - end - - end - end -end diff --git a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt b/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt deleted file mode 100644 index 8717df053d..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) <%= Date.today.year %> [name of plugin creator] - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/railties/lib/rails/generators/rails/plugin/templates/README.tt b/railties/lib/rails/generators/rails/plugin/templates/README.tt deleted file mode 100644 index 702db07cb1..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/README.tt +++ /dev/null @@ -1,13 +0,0 @@ -<%= class_name %> -<%= "=" * class_name.size %> - -Introduction goes here. - - -Example -======= - -Example goes here. - - -Copyright (c) <%= Date.today.year %> [name of plugin creator], released under the MIT license diff --git a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt b/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt deleted file mode 100644 index 77149ae351..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env rake -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the <%= file_name %> plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the <%= file_name %> plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = '<%= class_name %>' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end
\ No newline at end of file diff --git a/railties/lib/rails/generators/rails/plugin/templates/init.rb b/railties/lib/rails/generators/rails/plugin/templates/init.rb deleted file mode 100644 index 3c19a743c9..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/init.rb +++ /dev/null @@ -1 +0,0 @@ -# Include hook code here diff --git a/railties/lib/rails/generators/rails/plugin/templates/install.rb b/railties/lib/rails/generators/rails/plugin/templates/install.rb deleted file mode 100644 index f7732d3796..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/install.rb +++ /dev/null @@ -1 +0,0 @@ -# Install hook code here diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt deleted file mode 100644 index d8d908a959..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt +++ /dev/null @@ -1 +0,0 @@ -# <%= class_name %> diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt deleted file mode 100644 index 72920a9d3a..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :<%= file_name %> do -# # Task goes here -# end diff --git a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb b/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb deleted file mode 100644 index 9738333463..0000000000 --- a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb +++ /dev/null @@ -1 +0,0 @@ -# Uninstall hook code here diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index 9ddb3cae33..4967d1793c 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -202,7 +202,7 @@ task :default => :test end def create_test_dummy_files - return if options[:skip_test_unit] + return if options[:skip_test_unit] && options[:dummy_path] == 'test/dummy' create_dummy_app end diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile b/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile index 5704e75a29..1bf9c8c831 100755 --- a/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile +++ b/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile @@ -5,9 +5,9 @@ rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end -require 'rake/rdoctask' +require 'rdoc/task' -Rake::RDocTask.new(:rdoc) do |rdoc| +RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = '<%= camelized %>' rdoc.options << '--line-numbers' << '--inline-source' diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb index aa9b45c5a5..03a61a035e 100644 --- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb @@ -11,21 +11,12 @@ module Rails hook_for :scaffold_controller, :required => true - def copy_stylesheets_file - if behavior == :invoke && options.stylesheets? - template "scaffold.#{stylesheet_extension}", "app/assets/stylesheets/scaffold.#{stylesheet_extension}" - end - end - hook_for :assets do |assets| invoke assets, [controller_name] end - private - - def stylesheet_extension - options.stylesheet_engine.present? ? - "css.#{options.stylesheet_engine}" : "css" + hook_for :stylesheet_engine do |stylesheet_engine| + invoke stylesheet_engine, [controller_name] if options[:stylesheets] && behavior == :invoke end end end diff --git a/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css.scss b/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css.scss deleted file mode 100644 index 45116b53f6..0000000000 --- a/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css.scss +++ /dev/null @@ -1,58 +0,0 @@ -body { background-color: #fff; color: #333; } - -body, p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; -} - -pre { - background-color: #eee; - padding: 10px; - font-size: 11px; -} - -a { - color: #000; - &:visited { color: #666; } - &:hover { color: #fff; background-color:#000; } -} - -div.field, div.actions { - margin-bottom: 10px; -} - -#notice { - color: green; -} - -.field_with_errors { - padding: 2px; - background-color: red; - display: table; -} - -#error_explanation { - width: 450px; - border: 2px solid red; - padding: 7px; - padding-bottom: 0; - margin-bottom: 20px; - background-color: #f0f0f0; - - h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - margin-bottom: 0px; - background-color: #c00; - color: #fff; - } - - ul li { - font-size: 12px; - list-style: square; - } -}
\ No newline at end of file diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 5d217dcb10..09ff0ef378 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -2,29 +2,11 @@ require 'set' module Rails module Paths - module PathParent #:nodoc: - def method_missing(id, *args) - match = id.to_s.match(/^(.*)=$/) - full = [@current, $1 || id].compact.join("/") - - ActiveSupport::Deprecation.warn 'config.paths.app.controller API is deprecated in ' << - 'favor of config.paths["app/controller"] API.' - - if match || args.any? - @root[full] = Path.new(@root, full, *args) - elsif path = @root[full] - path - else - super - end - end - end - # This object is an extended hash that behaves as root of the Rails::Paths system. # It allows you to collect information about how you want to structure your application # paths by a Hash like API. It requires you to give a physical path on initialization. # - # root = Root.new + # root = Root.new "/rails" # root.add "app/controllers", :eager_load => true # # The command above creates a new root object and add "app/controllers" as a path. @@ -54,8 +36,7 @@ module Rails # # Finally, the Path object also provides a few helpers: # - # root = Root.new - # root.path = "/rails" + # root = Root.new "/rails" # root.add "app/controllers" # # root["app/controllers"].expanded # => ["/rails/app/controllers"] @@ -63,11 +44,10 @@ module Rails # # Check the Path documentation for more information. class Root < ::Hash - include PathParent attr_accessor :path def initialize(path) - raise if path.is_a?(Array) + raise "Argument should be a String of the physical root path" if path.is_a?(Array) @current = nil @path = path @root = self @@ -121,8 +101,6 @@ module Rails end class Path < Array - include PathParent - attr_reader :path attr_accessor :glob @@ -194,11 +172,6 @@ module Rails expanded.select { |f| File.exists?(f) } end - def paths - ActiveSupport::Deprecation.warn "paths is deprecated. Please call expand instead." - expanded - end - alias to_a expanded end end diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 0a65840c2b..65c567d72f 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -173,24 +173,24 @@ module Rails def eager_load! end - def load_console(sandbox=false) - self.class.console.each { |block| block.call(sandbox) } + def load_console(app) + self.class.console.each { |block| block.call(app) } end - def load_tasks + def load_tasks(app) extend Rake::DSL if defined? Rake::DSL - self.class.rake_tasks.each(&:call) + self.class.rake_tasks.each { |block| block.call(app) } # load also tasks from all superclasses klass = self.class.superclass while klass.respond_to?(:rake_tasks) - klass.rake_tasks.each { |t| self.instance_exec(&t) } + klass.rake_tasks.each { |t| self.instance_exec(app, &t) } klass = klass.superclass end end - def load_generators - self.class.generators.each(&:call) + def load_generators(app) + self.class.generators.each { |block| block.call(app) } end end end diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb index bfd2a73aeb..f888684117 100644 --- a/railties/lib/rails/railtie/configuration.rb +++ b/railties/lib/rails/railtie/configuration.rb @@ -26,11 +26,6 @@ module Rails @@app_generators end - def generators(&block) #:nodoc - ActiveSupport::Deprecation.warn "config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead." - app_generators(&block) - end - # First configurable block to run. Called before any initializers are run. def before_configuration(&block) ActiveSupport.on_load(:before_configuration, :yield => true, &block) diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index edd716d7d0..c8b4040151 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -1,7 +1,7 @@ -require 'rake/rdoctask' +require 'rdoc/task' # Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise -class RDocTaskWithoutDescriptions < Rake::RDocTask +class RDocTaskWithoutDescriptions < RDoc::Task def define task rdoc_task_name diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index 5ae6323345..db8f1f2ac6 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -10,7 +10,8 @@ class ConsoleTest < Test::Unit::TestCase def load_environment(sandbox = false) require "#{rails_root}/config/environment" - Rails.application.load_console(sandbox) + Rails.application.sandbox = sandbox + Rails.application.load_console end def test_app_method_should_return_integration_session @@ -78,8 +79,8 @@ class ConsoleTest < Test::Unit::TestCase value = false Class.new(Rails::Railtie) do - console do |sandbox| - value = sandbox + console do |app| + value = app.sandbox? end end diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 8b840fffd0..1ca9515335 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -68,8 +68,7 @@ module ApplicationTests # Initialize the application require "#{app_path}/config/environment" - require "rails/generators" - Rails::Generators.configure! + Rails.application.load_generators assert_equal :rspec, Rails::Generators.options[:rails][:test_framework] assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework] @@ -84,8 +83,7 @@ module ApplicationTests # Initialize the application require "#{app_path}/config/environment" - require "rails/generators" - Rails::Generators.configure! + Rails.application.load_generators assert_equal Thor::Base.shell, Thor::Shell::Basic end diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb index b1ff6e9cb1..03e0247556 100644 --- a/railties/test/application/paths_test.rb +++ b/railties/test/application/paths_test.rb @@ -61,7 +61,7 @@ module ApplicationTests end test "environments has a glob equal to the current environment" do - assert_equal "#{Rails.env}.rb", @paths.config.environments.glob + assert_equal "#{Rails.env}.rb", @paths["config/environments"].glob end test "load path includes each of the paths in config.paths as long as the directories exist" do diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 03353301cb..c31c65a27d 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -174,7 +174,6 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_jquery_is_the_default_javascript_library run_generator - assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype prototype_ujs\)/ assert_file "app/assets/javascripts/application.js" do |contents| assert_match %r{^//= require jquery}, contents assert_match %r{^//= require jquery_ujs}, contents @@ -186,7 +185,6 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_other_javascript_libraries run_generator [destination_root, '-j', 'prototype'] - assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype prototype_ujs\)/ assert_file "app/assets/javascripts/application.js" do |contents| assert_match %r{^//= require prototype}, contents assert_match %r{^//= require prototype_ujs}, contents @@ -198,7 +196,6 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_javascript_is_skipped_if_required run_generator [destination_root, "--skip-javascript"] - assert_file "config/application.rb", /^\s+# config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(\)/ assert_file "app/assets/javascripts/application.js" do |contents| assert_no_match %r{^//=\s+require\s}, contents end diff --git a/railties/test/generators/assets_generator_test.rb b/railties/test/generators/assets_generator_test.rb index 375632e5bc..2d20982d04 100644 --- a/railties/test/generators/assets_generator_test.rb +++ b/railties/test/generators/assets_generator_test.rb @@ -9,17 +9,17 @@ class AssetsGeneratorTest < Rails::Generators::TestCase def test_assets run_generator assert_file "app/assets/javascripts/posts.js.coffee" - assert_file "app/assets/stylesheets/posts.css.scss" + assert_file "app/assets/stylesheets/posts.css" end def test_skipping_assets content = run_generator ["posts", "--no-stylesheets", "--no-javascripts"] assert_no_file "app/assets/javascripts/posts.js.coffee" - assert_no_file "app/assets/stylesheets/posts.css.scss" + assert_no_file "app/assets/stylesheets/posts.css" end def test_vanilla_assets - run_generator ["posts", "--no-javascript-engine", "--no-stylesheet-engine"] + run_generator ["posts", "--no-javascript-engine"] assert_file "app/assets/javascripts/posts.js" assert_file "app/assets/stylesheets/posts.css" end diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 46533b70be..3adf7be118 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -40,7 +40,7 @@ class ControllerGeneratorTest < Rails::Generators::TestCase def test_invokes_assets run_generator assert_file "app/assets/javascripts/account.js.coffee" - assert_file "app/assets/stylesheets/account.css.scss" + assert_file "app/assets/stylesheets/account.css" end def test_invokes_default_test_framework diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 1b9a8fd8a7..7fdd54fc30 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -12,7 +12,7 @@ Rails.application.config.generators.templates = [File.join(Rails.root, "lib", "t # Call configure to load the settings from # Rails.application.config.generators to Rails::Generators -Rails::Generators.configure! +Rails.application.load_generators require 'active_record' require 'action_dispatch' diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb index 6f8a9b4280..17cbac0912 100644 --- a/railties/test/generators/namespaced_generators_test.rb +++ b/railties/test/generators/namespaced_generators_test.rb @@ -252,7 +252,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase assert_file "test/unit/helpers/test_app/product_lines_helper_test.rb" # Stylesheets - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" end def test_scaffold_on_revoke @@ -283,7 +283,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase assert_no_file "test/unit/helpers/test_app/product_lines_helper_test.rb" # Stylesheets (should not be removed) - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" end def test_scaffold_with_namespace_on_invoke @@ -324,7 +324,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase assert_file "test/unit/helpers/test_app/admin/roles_helper_test.rb" # Stylesheets - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" end def test_scaffold_with_namespace_on_revoke @@ -356,6 +356,6 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase assert_no_file "test/unit/helpers/test_app/admin/roles_helper_test.rb" # Stylesheets (should not be removed) - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" end end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb deleted file mode 100644 index 5c0774ddbd..0000000000 --- a/railties/test/generators/plugin_generator_test.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'generators/generators_test_helper' -require 'rails/generators/rails/plugin/plugin_generator' - -class PluginGeneratorTest < Rails::Generators::TestCase - include GeneratorsTestHelper - arguments %w(plugin_fu) - - def test_plugin_skeleton_is_created - silence(:stderr) { run_generator } - year = Date.today.year - - %w( - vendor/plugins - vendor/plugins/plugin_fu - vendor/plugins/plugin_fu/init.rb - vendor/plugins/plugin_fu/install.rb - vendor/plugins/plugin_fu/uninstall.rb - vendor/plugins/plugin_fu/lib - vendor/plugins/plugin_fu/lib/plugin_fu.rb - vendor/plugins/plugin_fu/Rakefile - ).each{ |path| assert_file path } - - %w( - vendor/plugins/plugin_fu/README - ).each{ |path| assert_file path, /PluginFu/ } - - %w( - vendor/plugins/plugin_fu/README - vendor/plugins/plugin_fu/MIT-LICENSE - ).each{ |path| assert_file path, /#{year}/ } - end - - def test_check_class_collision - content = capture(:stderr){ run_generator ["object"] } - assert_match(/The name 'Object' is either already used in your application or reserved/, content) - end - - def test_invokes_default_test_framework - silence(:stderr) { run_generator } - assert_file "vendor/plugins/plugin_fu/test/plugin_fu_test.rb", /class PluginFuTest < ActiveSupport::TestCase/ - assert_file "vendor/plugins/plugin_fu/test/test_helper.rb" - end - - def test_logs_if_the_test_framework_cannot_be_found - content = nil - silence(:stderr) { content = run_generator ["plugin_fu", "--test-framework=rspec"] } - assert_match(/rspec \[not found\]/, content) - end - - def test_creates_tasks_if_required - silence(:stderr) { run_generator ["plugin_fu", "--tasks"] } - assert_file "vendor/plugins/plugin_fu/lib/tasks/plugin_fu_tasks.rake" - end - - def test_creates_generator_if_required - silence(:stderr) { run_generator ["plugin_fu", "--generator"] } - assert_file "vendor/plugins/plugin_fu/lib/generators/templates" - assert_file "vendor/plugins/plugin_fu/lib/generators/plugin_fu_generator.rb", - /class PluginFuGenerator < Rails::Generators::NamedBase/ - end - - def test_plugin_generator_on_revoke - silence(:stderr) { run_generator } - run_generator ["plugin_fu"], :behavior => :revoke - end - - def test_deprecation - output = capture(:stderr) { run_generator } - assert_match(/Plugin generator is deprecated, please use 'rails plugin new' command to generate plugin structure./, output) - end -end diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 60bec5b27f..1b01c9dbc1 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -187,6 +187,13 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "spec/dummy/config/application.rb" assert_no_file "test/dummy" end + + def test_creating_dummy_without_tests_but_with_dummy_path + run_generator [destination_root, "--dummy_path", "spec/dummy", "--skip-test-unit"] + assert_file "spec/dummy" + assert_file "spec/dummy/config/application.rb" + assert_no_file "test" + end def test_skipping_gemspec run_generator [destination_root, "--skip-gemspec"] diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 4b07f8bcbe..2135ffac81 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -80,9 +80,9 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "test/unit/helpers/product_lines_helper_test.rb" # Assets - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" assert_file "app/assets/javascripts/product_lines.js.coffee" - assert_file "app/assets/stylesheets/product_lines.css.scss" + assert_file "app/assets/stylesheets/product_lines.css" end def test_scaffold_on_revoke @@ -113,9 +113,9 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_no_file "test/unit/helpers/product_lines_helper_test.rb" # Assets - assert_file "app/assets/stylesheets/scaffold.css.scss", /&:visited/ + assert_file "app/assets/stylesheets/scaffold.css", /:visited/ assert_no_file "app/assets/javascripts/product_lines.js.coffee" - assert_no_file "app/assets/stylesheets/product_lines.css.scss" + assert_no_file "app/assets/stylesheets/product_lines.css" end def test_scaffold_with_namespace_on_invoke @@ -189,9 +189,9 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "test/unit/helpers/admin/roles_helper_test.rb" # Assets - assert_file "app/assets/stylesheets/scaffold.css.scss", /&:visited/ + assert_file "app/assets/stylesheets/scaffold.css", /:visited/ assert_file "app/assets/javascripts/admin/roles.js.coffee" - assert_file "app/assets/stylesheets/admin/roles.css.scss" + assert_file "app/assets/stylesheets/admin/roles.css" end def test_scaffold_with_namespace_on_revoke @@ -223,9 +223,9 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_no_file "test/unit/helpers/admin/roles_helper_test.rb" # Assets - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" assert_no_file "app/assets/javascripts/admin/roles.js.coffee" - assert_no_file "app/assets/stylesheets/admin/roles.css.scss" + assert_no_file "app/assets/stylesheets/admin/roles.css" end def test_scaffold_generator_on_revoke_does_not_mutilate_legacy_map_parameter @@ -245,27 +245,27 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase def test_scaffold_generator_no_assets run_generator [ "posts", "--no-assets" ] - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" assert_no_file "app/assets/javascripts/posts.js.coffee" - assert_no_file "app/assets/stylesheets/posts.css.scss" + assert_no_file "app/assets/stylesheets/posts.css" end def test_scaffold_generator_no_stylesheets run_generator [ "posts", "--no-stylesheets" ] - assert_no_file "app/assets/stylesheets/scaffold.css.scss" + assert_no_file "app/assets/stylesheets/scaffold.css" assert_file "app/assets/javascripts/posts.js.coffee" - assert_no_file "app/assets/stylesheets/posts.css.scss" + assert_no_file "app/assets/stylesheets/posts.css" end def test_scaffold_generator_no_javascripts run_generator [ "posts", "--no-javascripts" ] - assert_file "app/assets/stylesheets/scaffold.css.scss" + assert_file "app/assets/stylesheets/scaffold.css" assert_no_file "app/assets/javascripts/posts.js.coffee" - assert_file "app/assets/stylesheets/posts.css.scss" + assert_file "app/assets/stylesheets/posts.css" end - def test_scaffold_generator_no_negines - run_generator [ "posts", "--no-javascript-engine", "--no-stylesheet-engine" ] + def test_scaffold_generator_no_engines + run_generator [ "posts", "--no-javascript-engine" ] assert_file "app/assets/stylesheets/scaffold.css" assert_file "app/assets/javascripts/posts.js" assert_file "app/assets/stylesheets/posts.css" diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 1264ac7764..301ae80bcf 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -185,13 +185,6 @@ class GeneratorsTest < Rails::Generators::TestCase Rails::Generators.subclasses.delete(WithOptionsGenerator) end - def test_load_generators_from_railties - Rails::Generators::ModelGenerator.expects(:start).with(["Account"], {}) - Rails::Generators.send(:remove_instance_variable, :@generators_from_railties) - Rails.application.expects(:load_generators) - Rails::Generators.invoke("model", ["Account"]) - end - def test_rails_root_templates template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb") diff --git a/railties/test/paths_test.rb b/railties/test/paths_test.rb index 6e4e3446b3..c0f3887263 100644 --- a/railties/test/paths_test.rb +++ b/railties/test/paths_test.rb @@ -227,57 +227,4 @@ class PathsTest < ActiveSupport::TestCase assert @root["app"].autoload? assert_equal ["/app"], @root.autoload_paths end - - # Deprecated API tests - - test "reading a root level path with assignment" do - @root.add "app" - assert_deprecated do - assert_equal ["/foo/bar/app"], @root.app.to_a - end - end - - test "creating a root level path with assignment" do - assert_deprecated do - @root.app = "/foo/bar" - end - assert_equal ["/foo/bar"], @root["app"].to_a - end - - test "creating a root level path without assignment" do - assert_deprecated do - @root.app "/foo/bar" - end - assert_equal ["/foo/bar"], @root["app"].to_a - end - - test "reading a nested level path with assignment" do - @root.add "app" - @root.add "app/model" - assert_deprecated do - assert_equal ["/foo/bar/app/model"], @root.app.model.to_a - end - end - - test "creating a nested level path with assignment" do - @root.add "app" - assert_deprecated do - @root.app.model = "/foo/bar" - end - assert_equal ["/foo/bar"], @root["app/model"].to_a - end - - test "creating a nested level path without assignment" do - @root.add "app" - assert_deprecated do - @root.app.model "/foo/bar" - end - assert_equal ["/foo/bar"], @root["app/model"].to_a - end - - test "trying to access a path that does not exist raises NoMethodError" do - assert_deprecated do - assert_raises(NoMethodError) { @root.app } - end - end end diff --git a/railties/test/railties/railtie_test.rb b/railties/test/railties/railtie_test.rb index 7ea8364ae9..18fdf59fe3 100644 --- a/railties/test/railties/railtie_test.rb +++ b/railties/test/railties/railtie_test.rb @@ -97,7 +97,7 @@ module RailtiesTest assert !$ran_block require 'rake' require 'rake/testtask' - require 'rake/rdoctask' + require 'rdoc/task' AppTemplate::Application.load_tasks assert $ran_block @@ -121,7 +121,7 @@ module RailtiesTest assert_equal [], $ran_block require 'rake' require 'rake/testtask' - require 'rake/rdoctask' + require 'rdoc/task' AppTemplate::Application.load_tasks assert $ran_block.include?("my_tie") diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb index e5debf29ae..659551d08a 100644 --- a/railties/test/railties/shared_tests.rb +++ b/railties/test/railties/shared_tests.rb @@ -237,7 +237,7 @@ module RailtiesTest boot_rails require 'rake' - require 'rake/rdoctask' + require 'rdoc/task' require 'rake/testtask' Rails.application.load_tasks Rake::Task[:foo].invoke |