aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-11-17 23:31:29 +0100
committerJosé Valim <jose.valim@gmail.com>2010-11-17 23:32:19 +0100
commit7b2f2c8b477adae9bc7243fb9c895f8a823188a3 (patch)
treeabaea7cd3f70d88b452f5adf78ea0082f78cc485 /railties
parentaafac200be0691aa97daf67b4a12ff8199dd7fe3 (diff)
downloadrails-7b2f2c8b477adae9bc7243fb9c895f8a823188a3.tar.gz
rails-7b2f2c8b477adae9bc7243fb9c895f8a823188a3.tar.bz2
rails-7b2f2c8b477adae9bc7243fb9c895f8a823188a3.zip
Tidy up generators commits.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/commands.rb5
-rw-r--r--railties/lib/rails/generators.rb1
-rw-r--r--railties/test/application/generators_test.rb13
-rw-r--r--railties/test/generators_test.rb6
4 files changed, 10 insertions, 15 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index de5d876c18..338565247f 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -12,11 +12,8 @@ command = aliases[command] || command
case command
when 'generate', 'destroy', 'plugin'
- if command == "plugin" && ARGV.first == "new"
+ if command == 'plugin' && ARGV.first == 'new'
require "rails/commands/plugin_new"
- elsif command == 'generate' && ARGV.first == "plugin_new"
- puts "This generator should not be used directly as a generator. You should use `rails plugin new` command instead"
- exit(1)
else
require APP_PATH
Rails.application.require_environment!
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index 240810b8bd..27a4007c20 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -228,6 +228,7 @@ module Rails
rails = groups.delete("rails")
rails.map! { |n| n.sub(/^rails:/, '') }
rails.delete("app")
+ rails.delete("plugin_new")
print_list("rails", rails)
hidden_namespaces.each {|n| groups.delete(n.to_s) }
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index 3c52a07bdb..8b840fffd0 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -26,17 +26,8 @@ module ApplicationTests
end
test "allow running plugin new generator inside Rails app directory" do
- FileUtils.cd rails_root do
- `ruby script/rails plugin new vendor/plugins/bukkits`
- assert File.exist?(File.join(rails_root, "vendor/plugins/bukkits/test/dummy/config/application.rb"))
- end
- end
-
- test "don't allow running plugin_new generator as a generator" do
- FileUtils.cd rails_root do
- output = `ruby script/rails g plugin_new vendor/plugins/bukkits`
- assert_match /This generator should not be used directly as a generator. You should use `rails plugin new` command instead/, output
- end
+ FileUtils.cd(rails_root){ `ruby script/rails plugin new vendor/plugins/bukkits` }
+ assert File.exist?(File.join(rails_root, "vendor/plugins/bukkits/test/dummy/config/application.rb"))
end
test "generators default values" do
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index f93800a5ae..346c9ceb9d 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -102,6 +102,12 @@ class GeneratorsTest < Rails::Generators::TestCase
assert_no_match /^ app$/, output
end
+ def test_rails_generators_help_does_not_include_app_nor_plugin_new
+ output = capture(:stdout){ Rails::Generators.help }
+ assert_no_match /app/, output
+ assert_no_match /plugin_new/, output
+ end
+
def test_rails_generators_with_others_information
output = capture(:stdout){ Rails::Generators.help }
assert_match /Fixjour:/, output