From 685a9195aa1dcf0231806fe3bc27783145e2100f Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Tue, 24 May 2011 20:52:38 -0500 Subject: [PATCH 1/4] Removing deprecated config.paths.app.controller API --- railties/lib/rails/paths.rb | 26 ------------------------- railties/test/application/paths_test.rb | 2 +- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 5d217dcb10..e9b5042f60 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -2,24 +2,6 @@ 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. @@ -63,7 +45,6 @@ module Rails # # Check the Path documentation for more information. class Root < ::Hash - include PathParent attr_accessor :path def initialize(path) @@ -121,8 +102,6 @@ module Rails end class Path < Array - include PathParent - attr_reader :path attr_accessor :glob @@ -194,11 +173,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/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 From ce350de56e266e3febdc810cb83ddb11b69fc4b7 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Tue, 24 May 2011 22:24:09 -0500 Subject: [PATCH 2/4] Removing Deprecated Path API tests --- railties/test/paths_test.rb | 53 ------------------------------------- 1 file changed, 53 deletions(-) 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 From 6e1dbb87ef1df9d29a6e9944e960899f0edb5cdc Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Tue, 24 May 2011 22:35:05 -0500 Subject: [PATCH 3/4] Remove deprecated plugin generator --- .../lib/rails/generators/rails/plugin/USAGE | 13 ---- .../rails/plugin/plugin_generator.rb | 54 -------------- .../rails/plugin/templates/MIT-LICENSE.tt | 20 ------ .../rails/plugin/templates/README.tt | 13 ---- .../rails/plugin/templates/Rakefile.tt | 23 ------ .../generators/rails/plugin/templates/init.rb | 1 - .../rails/plugin/templates/install.rb | 1 - .../plugin/templates/lib/%file_name%.rb.tt | 1 - .../lib/tasks/%file_name%_tasks.rake.tt | 4 -- .../rails/plugin/templates/uninstall.rb | 1 - .../test/generators/plugin_generator_test.rb | 71 ------------------- 11 files changed, 202 deletions(-) delete mode 100644 railties/lib/rails/generators/rails/plugin/USAGE delete mode 100644 railties/lib/rails/generators/rails/plugin/plugin_generator.rb delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/README.tt delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/init.rb delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/install.rb delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt delete mode 100644 railties/lib/rails/generators/rails/plugin/templates/uninstall.rb delete mode 100644 railties/test/generators/plugin_generator_test.rb 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 c5afe79b86..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 'rdoc/task' - -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.' -RDoc::Task.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 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/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 From 944aee7bb1aeae44faf75979e70f35bc3772ad29 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Wed, 25 May 2011 00:11:56 -0500 Subject: [PATCH 4/4] Removing deprecated config.generators in Rails::Railtie --- railties/lib/rails/railtie/configuration.rb | 5 ----- 1 file changed, 5 deletions(-) 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)