aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/commands/destroy.rb2
-rwxr-xr-xrailties/lib/commands/generate.rb2
-rw-r--r--railties/lib/commands/update.rb2
-rw-r--r--railties/lib/generators.rb4
-rw-r--r--railties/test/generators_test.rb15
5 files changed, 16 insertions, 9 deletions
diff --git a/railties/lib/commands/destroy.rb b/railties/lib/commands/destroy.rb
index 204477b738..075fe5bb12 100644
--- a/railties/lib/commands/destroy.rb
+++ b/railties/lib/commands/destroy.rb
@@ -7,4 +7,4 @@ if ARGV.size == 0
end
name = ARGV.shift
-Rails::Generators.invoke name, ARGV, :revoke
+Rails::Generators.invoke name, ARGV, :behavior => :revoke
diff --git a/railties/lib/commands/generate.rb b/railties/lib/commands/generate.rb
index 7d133a179e..f6db965960 100755
--- a/railties/lib/commands/generate.rb
+++ b/railties/lib/commands/generate.rb
@@ -7,4 +7,4 @@ if ARGV.size == 0
end
name = ARGV.shift
-Rails::Generators.invoke name, ARGV, :invoke
+Rails::Generators.invoke name, ARGV, :behavior => :invoke
diff --git a/railties/lib/commands/update.rb b/railties/lib/commands/update.rb
index 0c14355f24..50b7d73e0e 100644
--- a/railties/lib/commands/update.rb
+++ b/railties/lib/commands/update.rb
@@ -7,4 +7,4 @@ if ARGV.size == 0
end
name = ARGV.shift
-Rails::Generators.invoke name, ARGV, :skip
+Rails::Generators.invoke name, ARGV, :behavior => :skip
diff --git a/railties/lib/generators.rb b/railties/lib/generators.rb
index a923a33397..d513a3f6c7 100644
--- a/railties/lib/generators.rb
+++ b/railties/lib/generators.rb
@@ -123,10 +123,10 @@ module Rails
# It's used as the default entry point for generate, destroy and update
# commands.
#
- def self.invoke(namespace, args=ARGV, behavior=:invoke)
+ def self.invoke(namespace, args=ARGV, config={})
if klass = find_by_namespace(namespace, "rails")
args << "--help" if klass.arguments.any? { |a| a.required? } && args.empty?
- klass.start args, :behavior => behavior
+ klass.start args, config
else
puts "Could not find generator #{namespace}."
end
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index ac290b10bb..c49081e5cc 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -13,14 +13,14 @@ class GeneratorsTest < GeneratorsTestCase
assert_match /Description:/, output
end
- def test_invoke_with_default_behavior
- Rails::Generators::ModelGenerator.expects(:start).with(["Account"], :behavior => :invoke)
+ def test_invoke_with_default_values
+ Rails::Generators::ModelGenerator.expects(:start).with(["Account"], {})
Rails::Generators.invoke :model, ["Account"]
end
- def test_invoke_with_given_behavior
+ def test_invoke_with_config_values
Rails::Generators::ModelGenerator.expects(:start).with(["Account"], :behavior => :skip)
- Rails::Generators.invoke :model, ["Account"], :skip
+ Rails::Generators.invoke :model, ["Account"], :behavior => :skip
end
def test_find_by_namespace_without_base_or_context
@@ -77,4 +77,11 @@ class GeneratorsTest < GeneratorsTestCase
output = capture(:stdout){ Rails::Generators.help }.split("\n").last
assert_equal "Others: active_record:fixjour, fixjour, rails:javascripts.", output
end
+
+ def test_no_color_sets_proper_shell
+ Rails::Generators.no_color!
+ assert_equal Thor::Shell::Basic, Thor::Base.shell
+ ensure
+ Thor::Base.shell = Thor::Shell::Color
+ end
end