execute_command(executor, command, options = {})
private
Runs the supplied command using either “rake …” or “rails
…” based on the executor parameter provided.
# File railties/lib/rails/generators/actions.rb, line 461
def execute_command(executor, command, options = {}) # :doc:
log executor, command
sudo = options[:sudo] && !Gem.win_platform? ? "sudo " : ""
config = {
env: { "RAILS_ENV" => (options[:env] || ENV["RAILS_ENV"] || "development") },
verbose: false,
capture: options[:capture],
abort_on_failure: options[:abort_on_failure],
}
in_root { run("#{sudo}#{Shellwords.escape Gem.ruby} bin/#{executor} #{command}", config) }
end