提交 59bf2268 编写于 作者: K Kasper Timm Hansen

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
......@@ -2,6 +2,7 @@
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 @@
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.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 @@
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册