Skip to content
This repository
Browse code

return argv from each method

  • Loading branch information...
commit 4e0694c603099a2f76de8ad0f65c4f446a44dc4f 1 parent 82f59a9
Aaron Patterson authored
10  railties/lib/rails/generators/rails/app/app_generator.rb
@@ -318,11 +318,10 @@ def initialize(argv = ARGV)
318 318
 
319 319
       def prepare!
320 320
         handle_version_request!(@argv.first)
321  
-        unless handle_invalid_command!(@argv.first, @argv)
  321
+        handle_invalid_command!(@argv.first, @argv) do
322 322
           @argv.shift
323 323
           handle_rails_rc!(@argv)
324 324
         end
325  
-        @argv
326 325
       end
327 326
 
328 327
       def self.default_rc_file
@@ -340,8 +339,10 @@ def handle_version_request!(argument)
340 339
         end
341 340
 
342 341
         def handle_invalid_command!(argument, argv)
343  
-          if argument != "new"
344  
-            argv[0] = "--help"
  342
+          if argument == "new"
  343
+            yield
  344
+          else
  345
+            ['--help'] + argv.drop(1)
345 346
           end
346 347
         end
347 348
 
@@ -349,6 +350,7 @@ def handle_rails_rc!(argv)
349 350
           unless argv.delete("--no-rc")
350 351
             insert_railsrc_into_argv!(argv, railsrc(argv))
351 352
           end
  353
+          argv
352 354
         end
353 355
 
354 356
         def railsrc(argv)

0 notes on commit 4e0694c

Please sign in to comment.
Something went wrong with that request. Please try again.