mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Tidy up generators commits.
This commit is contained in:
parent
aafac200be
commit
7b2f2c8b47
4 changed files with 10 additions and 15 deletions
|
@ -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!
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue