Sha256: 8af83d9c4bf5924a1c516030c7dd03be4659d630045b0640427613832a1fed99

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

bundle_path = ENV['EMBULK_BUNDLE_PATH'].to_s
bundle_path = nil if bundle_path.empty?

# search -b, --bundle BUNDLE_DIR
bundle_path_index = ARGV.find_index {|arg| arg == '-b' || arg == '--bundle' }
if bundle_path_index
  bundle_path = ARGV.slice!(bundle_path_index, 2)[1]
end

if bundle_path
  # use bundler installed at bundle_path
  ENV['GEM_HOME'] = File.expand_path File.join(bundle_path, Gem.ruby_engine, RbConfig::CONFIG['ruby_version'])
  ENV['GEM_PATH'] = ''
  Gem.clear_paths  # force rubygems to reload GEM_HOME

  ENV['BUNDLE_GEMFILE'] = File.expand_path File.join(bundle_path, "Gemfile")
  require 'bundler'
  Bundler.load.setup_environment
  require 'bundler/setup'
  # since here, `require` may load files of different (newer) embulk versions
  # especially following 'embulk/command/embulk_run'.

  $LOAD_PATH << File.expand_path(bundle_path)  # for local plugins

  begin
    require 'embulk/command/embulk_run'
  rescue LoadError
    require_relative 'embulk_run'
  end

else
  # GEM_HOME is set by embulk_run.rb
  ENV.delete('GEM_HOME')
  ENV.delete('GEM_PATH')
  ENV.delete('BUNDLE_GEMFILE')
  require_relative 'embulk_run'
end

Embulk.run(ARGV)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
embulk-0.4.2 lib/embulk/command/embulk.rb
embulk-0.4.1 lib/embulk/command/embulk.rb
embulk-0.4.0 lib/embulk/command/embulk.rb
embulk-0.3.2 lib/embulk/command/embulk.rb
embulk-0.3.1 lib/embulk/command/embulk.rb
embulk-0.3.0 lib/embulk/command/embulk.rb
embulk-0.2.1 lib/embulk/command/embulk.rb
embulk-0.2.0 lib/embulk/command/embulk.rb
embulk-0.1.0 lib/embulk/command/embulk.rb