diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-03-27 18:09:40 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-03-27 18:09:40 +0200 |
commit | 59bf226890dcd91511ea5b90a87d3ad92f54d8b3 (patch) | |
tree | 9eda9673180f7bae46b7fb24b76c51abf1f905dc | |
parent | 306da3e280055e9741f1be777197714b2090c6fc (diff) | |
parent | 06cd7ab6cb1e0ecae5a3fedaecb7facc4bf52ad9 (diff) | |
download | rails-59bf226890dcd91511ea5b90a87d3ad92f54d8b3.tar.gz rails-59bf226890dcd91511ea5b90a87d3ad92f54d8b3.tar.bz2 rails-59bf226890dcd91511ea5b90a87d3ad92f54d8b3.zip |
Merge pull request #24325 from y-yagi/show_correct_command_name_in_help_of_rails_runner
show correct command name in help of rails runner
-rw-r--r-- | railties/lib/rails/commands/runner.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb index 5844e9037c..f9c183ac86 100644 --- a/railties/lib/rails/commands/runner.rb +++ b/railties/lib/rails/commands/runner.rb @@ -2,6 +2,7 @@ require 'optparse' options = { environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup } code_or_file = nil +command = 'bin/rails runner' if ARGV.first.nil? ARGV.push "-h" @@ -34,7 +35,7 @@ ARGV.clone.options do |opts| opts.separator "" opts.separator "You can also use runner as a shebang line for your executables:" opts.separator " -------------------------------------------------------------" - opts.separator " #!/usr/bin/env #{File.expand_path($0)} runner" + opts.separator " #!/usr/bin/env #{File.expand_path(command)}" opts.separator "" opts.separator " Product.all.each { |p| p.price *= 2 ; p.save! }" opts.separator " -------------------------------------------------------------" @@ -52,7 +53,7 @@ Rails.application.require_environment! Rails.application.load_runner if code_or_file.nil? - $stderr.puts "Run '#{$0} -h' for help." + $stderr.puts "Run '#{command} -h' for help." exit 1 elsif File.exist?(code_or_file) $0 = code_or_file @@ -62,7 +63,7 @@ else eval(code_or_file, binding, __FILE__, __LINE__) rescue SyntaxError, NameError $stderr.puts "Please specify a valid ruby command or the path of a script to run." - $stderr.puts "Run '#{$0} -h' for help." + $stderr.puts "Run '#{command} -h' for help." exit 1 end end |