Skip to content
Browse files

make 'rails runner' show usage when run without any options

  • Loading branch information...
1 parent 78acd17 commit 880371ef2b4a2cb08f0c36ceba1eee41836bb739 @vijaydev vijaydev committed
Showing with 8 additions and 0 deletions.
  1. +4 −0 railties/lib/rails/commands/runner.rb
  2. +4 −0 railties/test/application/runner_test.rb
View
4 railties/lib/rails/commands/runner.rb
@@ -4,6 +4,10 @@
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
code_or_file = nil
+if ARGV.first.nil?
+ ARGV.push "-h"
+end
+
ARGV.clone.options do |opts|
script_name = File.basename($0)
opts.banner = "Usage: runner [options] ('Some.ruby(code)' or a filename)"
View
4 railties/test/application/runner_test.rb
@@ -22,6 +22,10 @@ def teardown
teardown_app
end
+ def test_should_include_runner_in_shebang_line_in_help_without_option
+ assert_match "/rails runner", Dir.chdir(app_path) { `bundle exec rails runner` }
+ end
+
def test_should_include_runner_in_shebang_line_in_help
assert_match "/rails runner", Dir.chdir(app_path) { `bundle exec rails runner --help` }
end

0 comments on commit 880371e

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