aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavinder Singh <ravinderrana30@gmail.com>2010-04-16 16:58:14 +0530
committerJosé Valim <jose.valim@gmail.com>2010-04-29 13:00:17 +0200
commite9a9ef094e84abfe6a0167e9255abcf5b63412d9 (patch)
tree214629eca606ae695edd8eb3f5e77fde44b5f40c
parentd793d30776737e46ead49d90dcba411c3dfd6edf (diff)
downloadrails-e9a9ef094e84abfe6a0167e9255abcf5b63412d9.tar.gz
rails-e9a9ef094e84abfe6a0167e9255abcf5b63412d9.tar.bz2
rails-e9a9ef094e84abfe6a0167e9255abcf5b63412d9.zip
warn user if options are given before application name [#3435 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb1
-rw-r--r--railties/test/generators/app_generator_test.rb5
2 files changed, 6 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index aa066fe3c4..667a123025 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -55,6 +55,7 @@ module Rails::Generators
:desc => "Show this help message and quit"
def initialize(*args)
+ raise Error, "Options should be given after the application name. For details run: rails --help" if args[0].blank?
super
if !options[:skip_activerecord] && !DATABASES.include?(options[:database])
raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 24e6d541c2..e57b5e19b4 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -58,6 +58,11 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_no_file "public/stylesheets/application.css"
end
+ def test_options_before_application_name_raises_an_error
+ content = capture(:stderr){ run_generator(["--skip-activerecord", destination_root]) }
+ assert_equal "Options should be given after the application name. For details run: rails --help\n", content
+ end
+
def test_name_collision_raises_an_error
content = capture(:stderr){ run_generator [File.join(destination_root, "generate")] }
assert_equal "Invalid application name generate. Please give a name which does not match one of the reserved rails words.\n", content