lib/bootstrap/bundler.rb
# execute bundle install and capture any $stdout output. any raised exception in the process will be trapped
# and returned. logs errors to $stdout.
# @param [Hash] options invoke options with default values, :max_tries => 10, :clean => false, :install => false, :update => false
# @option options [Boolean] :max_tries The number of times bundler is going to try the installation before failing (default: 10)
# @option options [Boolean] :clean It cleans the unused gems (default: false)
# @option options [Boolean] :install Run the installation of a set of gems defined in a Gemfile (default: false)
# @option options [Boolean, String, Array] :update Update the current environment, must be either false or a String or an Array of String (default: false)
# @option options [Boolean] :local Do not attempt to fetch gems remotely and use the gem cache instead (default: false)
# @option options [Boolean] :package Locks and then caches all dependencies to be reused later on (default: false)
# @option options [Boolean] :all It packages dependencies defined with :git or :path (default: false)
# @option options [Array] :without  Exclude gems that are part of the specified named group (default: [:development])
# @return [String, Exception] the installation captured output and any raised exception or nil if none
execute bundle install and capture any $stdout output. any raised exception in the process will be trapped
and returned. logs errors to $stdout.
execute bundle install and capture any $stdout output . any raised exception in the process will be trapped and returned . logs errors to $stdout .
def invoke!(options = {})
      options = {:max_tries => 10, :clean => false, :install => false, :update => false, :local => false,
                 :jobs => 12, :all => false, :package => false, :without => [:development]}.merge(options)
      options[:without] = Array(options[:without])
      options[:update] = Array(options[:update]) if options[:update]
      ::Gem.clear_paths
      ENV['GEM_HOME'] = ENV['GEM_PATH'] = LogStash::Environment.logstash_gem_home
      ::Gem.paths = ENV
      ENV["BUNDLE_GEMFILE"] = LogStash::Environment::GEMFILE_PATH
      require "bundler"
      require "bundler/cli"
      unless ::File.exists?(Environment::GEMFILE_PATH)
        FileUtils.copy(
          ::File.join(Environment::LOGSTASH_HOME, "Gemfile.template"), Environment::GEMFILE_PATH
        )
      end
      lock_template = ::File.join(ENV["LOGSTASH_HOME"], "Gemfile.jruby-2.3.lock.release")
      if ::File.exists?(lock_template) && !::File.exists?(Environment::LOCKFILE)
        FileUtils.copy(lock_template, Environment::LOCKFILE)
      end
      LogStash::Bundler.patch!
      ::Gem.sources = ::Gem::SourceList.from(options[:rubygems_source]) if options[:rubygems_source]
      ::Bundler.settings[:path] = LogStash::Environment::BUNDLE_DIR
      ::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
      ::Bundler.settings[:without] = options[:without].join(":")
      ::Bundler.settings[:force] = options[:force]
      if !debug?
        execute_bundler_with_retry(options)
      else
        options[:verbose] = true
        execute_bundler(options)
      end
    end
def invoke! ( options = { } ) options = { :max_tries => 10 , :clean => false , :install => false , :update => false , :local => false , :jobs => 12 , :all => false , :package => false , :without => [ :development ] } . merge ( options ) options [ :without ] = Array ( options [ :without ] ) options [ :update ] = Array ( options [ :update ] ) if options [ :update ] :: Gem . clear_paths ENV [ 'GEM_HOME' ] = ENV [ 'GEM_PATH' ] = LogStash :: Environment . logstash_gem_home :: Gem . paths = ENV ENV [ "BUNDLE_GEMFILE" ] = LogStash :: Environment :: GEMFILE_PATH require "bundler" require "bundler/cli" unless :: File . exists? ( Environment :: GEMFILE_PATH ) FileUtils . copy ( :: File . join ( Environment :: LOGSTASH_HOME , "Gemfile.template" ) , Environment :: GEMFILE_PATH ) end lock_template = :: File . join ( ENV [ "LOGSTASH_HOME" ] , "Gemfile.jruby-2.3.lock.release" ) if :: File . exists? ( lock_template ) && ! :: File . exists? ( Environment :: LOCKFILE ) FileUtils . copy ( lock_template , Environment :: LOCKFILE ) end LogStash :: Bundler . patch! :: Gem . sources = :: Gem :: SourceList . from ( options [ :rubygems_source ] ) if options [ :rubygems_source ] :: Bundler . settings [ :path ] = LogStash :: Environment :: BUNDLE_DIR :: Bundler . settings [ :gemfile ] = LogStash :: Environment :: GEMFILE_PATH :: Bundler . settings [ :without ] = options [ :without ] . join ( ":" ) :: Bundler . settings [ :force ] = options [ :force ] if ! debug? execute_bundler_with_retry ( options ) else options [ :verbose ] = true execute_bundler ( options ) end end
execute bundle install and capture any $stdout output.
execute bundle install and capture any $stdout output .
# set BUNDLE_GEMFILE ENV before requiring bundler to avoid bundler recurse and load unrelated Gemfile(s). # in the context of calling Bundler::CLI this is not really required since Bundler::CLI will look at # Bundler.settings[:gemfile] unlike Bundler.setup. For the sake of consistency and defensive/future proofing, let's keep it here. # create Gemfile from template iff it does not exist # create Gemfile.jruby-1.9.lock from template iff a template exists it itself does not exist # force Rubygems sources to our Gemfile sources # Will deal with transient network errors
the installation captured output and any raised exception or nil if none
the installation captured output and any raised exception or nil if none
String, Exception
options
:without Exclude gems that are part of the specified named group (default: [:development])
: without Exclude gems that are part of the specified named group ( default : [ : development ] )
options invoke options with default values, :max_tries => 10, :clean => false, :install => false, :update => false
options invoke options with default values : max_tries = > 10 : clean = > false : install = > false : update = > false