diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-10 06:45:52 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-10 06:45:52 -0700 |
commit | 8eb2b519f267e61edcf1e715489c3c9ac0244d81 (patch) | |
tree | 1494b6adf828bfe98450c61942a9a7ce80c540ce | |
parent | 78acd17f3124a22485aa1bdcc64d7d1e6e69cb2d (diff) | |
parent | 880371ef2b4a2cb08f0c36ceba1eee41836bb739 (diff) | |
download | rails-8eb2b519f267e61edcf1e715489c3c9ac0244d81.tar.gz rails-8eb2b519f267e61edcf1e715489c3c9ac0244d81.tar.bz2 rails-8eb2b519f267e61edcf1e715489c3c9ac0244d81.zip |
Merge pull request #1631 from vijaydev/runner-help
rails runner without any options should show usage information
-rw-r--r-- | railties/lib/rails/commands/runner.rb | 4 | ||||
-rw-r--r-- | railties/test/application/runner_test.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb index f8b00e7249..e8cc5d9e3b 100644 --- a/railties/lib/rails/commands/runner.rb +++ b/railties/lib/rails/commands/runner.rb @@ -4,6 +4,10 @@ require 'rbconfig' 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)" diff --git a/railties/test/application/runner_test.rb b/railties/test/application/runner_test.rb index 4104bacae5..4468fa295e 100644 --- a/railties/test/application/runner_test.rb +++ b/railties/test/application/runner_test.rb @@ -22,6 +22,10 @@ module ApplicationTests 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 |