Permalink
Browse files

warn user if options are given before application name [#3435 state:r…

…esolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
ravinderrana authored and josevalim committed Apr 16, 2010
1 parent d793d30 commit e9a9ef094e84abfe6a0167e9255abcf5b63412d9
@@ -55,6 +55,7 @@ class AppGenerator < Base
: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(", ")}."
@@ -58,6 +58,11 @@ def test_application_controller_and_layout_files
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

0 comments on commit e9a9ef0

Please sign in to comment.