instance method execute_command

Ruby on Rails 7.1.6

Since v5.2.8.1 Private

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

execute_command(executor, command, options = {})

Runs the supplied command using either “rake …” or “rails …” based on the executor parameter provided.

Parameters

executor req
command req
options opt = {}
Source
# 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

Defined in railties/lib/rails/generators/actions.rb line 461 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Generators::Actions

Type at least 2 characters to search.

↑↓ navigate · open · esc close