From 03c982fa3417fc49a380eeb88fdd26fdd4bae46b Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Mon, 12 Sep 2016 21:59:26 +0200 Subject: Remove the old command files. Wash out your old! These adhoc scripts are replaced by the new commands. --- railties/lib/rails/commands/runner.rb | 71 ----------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 railties/lib/rails/commands/runner.rb (limited to 'railties/lib/rails/commands/runner.rb') diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb deleted file mode 100644 index b74addf587..0000000000 --- a/railties/lib/rails/commands/runner.rb +++ /dev/null @@ -1,71 +0,0 @@ -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" -end - -ARGV.clone.options do |opts| - opts.banner = "Usage: rails runner [options] [<'Some.ruby(code)'> | ]" - - opts.separator "" - - opts.on("-e", "--environment=name", String, - "Specifies the environment for the runner to operate under (test/development/production).", - "Default: development") { |v| options[:environment] = v } - - opts.separator "" - - opts.on("-h", "--help", - "Show this help message.") { $stdout.puts opts; exit } - - opts.separator "" - opts.separator "Examples: " - - opts.separator " rails runner 'puts Rails.env'" - opts.separator " This runs the code `puts Rails.env` after loading the app" - opts.separator "" - opts.separator " rails runner path/to/filename.rb" - opts.separator " This runs the Ruby file located at `path/to/filename.rb` after loading the app" - - if RbConfig::CONFIG["host_os"] !~ /mswin|mingw/ - 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(command)}" - opts.separator "" - opts.separator " Product.all.each { |p| p.price *= 2 ; p.save! }" - opts.separator " -------------------------------------------------------------" - end - - opts.order! { |o| code_or_file ||= o } rescue retry -end - -ARGV.delete(code_or_file) - -ENV["RAILS_ENV"] = options[:environment] - -require APP_PATH -Rails.application.require_environment! -Rails.application.load_runner - -if code_or_file.nil? - $stderr.puts "Run '#{command} -h' for help." - exit 1 -elsif File.exist?(code_or_file) - $0 = code_or_file - Kernel.load code_or_file -else - begin - eval(code_or_file, binding, __FILE__, __LINE__) - rescue SyntaxError, NameError => e - $stderr.puts "Please specify a valid ruby command or the path of a script to run." - $stderr.puts "Run '#{command} -h' for help." - $stderr.puts - $stderr.puts e - exit 1 - end -end -- cgit v1.2.3