diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-11-14 19:27:06 -0600 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-16 00:04:35 +0100 |
commit | dc1250265cdf1ae4ab2d61b5d0b1cf2aa2f8ba0e (patch) | |
tree | 4ef2bf29ad473da7877cfa14a8ab1bf78aba96df | |
parent | 73443329de6817b32ea0fa65889056c146181bca (diff) | |
download | rails-dc1250265cdf1ae4ab2d61b5d0b1cf2aa2f8ba0e.tar.gz rails-dc1250265cdf1ae4ab2d61b5d0b1cf2aa2f8ba0e.tar.bz2 rails-dc1250265cdf1ae4ab2d61b5d0b1cf2aa2f8ba0e.zip |
Deprecate plugin generator
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/plugin_generator.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 18 |
2 files changed, 19 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 40ed2062d3..a3387b8a57 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -1,3 +1,4 @@ + require 'rails/generators/rails/generator/generator_generator' module Rails @@ -5,6 +6,12 @@ module Rails class PluginGenerator < NamedBase class_option :tasks, :desc => "When supplied creates tasks base files." + def show_deprecation + return unless behavior == :invoke + message = "Plugin generator is depreacted, please use 'rails plugin new' command to generate plugin structure." + ActiveSupport::Deprecation.warn message + end + check_class_collision def create_root_files diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index c1f646f7c1..e31a116af3 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -6,7 +6,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase arguments %w(plugin_fu) def test_plugin_skeleton_is_created - run_generator + silence(:stderr) { run_generator } year = Date.today.year %w( @@ -36,30 +36,36 @@ class PluginGeneratorTest < Rails::Generators::TestCase end def test_invokes_default_test_framework - run_generator + 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 = run_generator ["plugin_fu", "--test-framework=rspec"] + 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 - run_generator ["plugin_fu", "--tasks"] + 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 - run_generator ["plugin_fu", "--generator"] + 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 - run_generator + silence(:stderr) { run_generator } run_generator ["plugin_fu"], :behavior => :revoke end + + def test_deprecation + output = capture(:stderr) { run_generator } + assert_match /Plugin generator is depreacted, please use 'rails plugin new' command to generate plugin structure./, output + end end |