instance method execute_command

Ruby on Rails 6.0.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 285
        def execute_command(executor, command, options = {}) # :doc:
          log executor, command
          env = options[:env] || ENV["RAILS_ENV"] || "development"
          rails_env = " RAILS_ENV=#{env}" unless options[:without_rails_env]
          sudo = options[:sudo] && !Gem.win_platform? ? "sudo " : ""
          config = { verbose: false }

          config[:capture] = options[:capture] if options[:capture]
          config[:abort_on_failure] = options[:abort_on_failure] if options[:abort_on_failure]

          in_root { run("#{sudo}#{extify(executor)} #{command}#{rails_env}", config) }
        end

Defined in railties/lib/rails/generators/actions.rb line 285 · 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