123456789_123456789_123456789_123456789_123456789_

Module: Rails::Generators::BundleHelper

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: railties/lib/rails/generators/bundle_helper.rb

Instance Method Summary

Instance Method Details

#bundle_command(command, env = {}, params = {})

[ GitHub ]

  
# File 'railties/lib/rails/generators/bundle_helper.rb', line 6

def bundle_command(command, env = {}, params = {})
  say_status :run, "bundle #{command}"

  # We are going to shell out rather than invoking Bundler::CLI.new(command)
  # because `rails new` loads the Thor gem and on the other hand bundler uses
  # its own vendored Thor, which could be a different version. Running both
  # things in the same process is a recipe for a night with paracetamol.
  #
  # Thanks to James Tucker for the Gem tricks involved in this call.
  _bundle_command = Gem.bin_path("bundler", "bundle")

  require "bundler"
  Bundler.with_original_env do
    exec_bundle_command(_bundle_command, command, env, params)
  end
end

#exec_bundle_command(bundle_command, command, env, params) (private)

[ GitHub ]

  
# File 'railties/lib/rails/generators/bundle_helper.rb', line 24

def exec_bundle_command(bundle_command, command, env, params)
  full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
  if options[:quiet] || params[:quiet]
    system(env, full_command, out: File::NULL)
  else
    system(env, full_command)
  end
end