Sha256: 667b86d2d1205e7282b79bc5a1f3e0494defa5dca535337bb1a40313a6107d57

Contents?: true

Size: 1.36 KB

Versions: 27

Compression:

Stored size: 1.36 KB

Contents

# reset context class loader set by org.jruby.Main.main to nil. embulk manages
# multiple classloaders. default classloader should be Plugin.class.getClassloader().
java.lang.Thread.current_thread.set_context_class_loader(nil)

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

27 entries across 27 versions & 1 rubygems

Version Path
embulk-0.6.12 lib/embulk/command/embulk.rb
embulk-0.6.11 lib/embulk/command/embulk.rb
embulk-0.6.10 lib/embulk/command/embulk.rb
embulk-0.6.9 lib/embulk/command/embulk.rb
embulk-0.6.8 lib/embulk/command/embulk.rb
embulk-0.6.7 lib/embulk/command/embulk.rb
embulk-0.6.6 lib/embulk/command/embulk.rb
embulk-0.6.5 lib/embulk/command/embulk.rb
embulk-0.6.4 lib/embulk/command/embulk.rb
embulk-0.6.3 lib/embulk/command/embulk.rb
embulk-0.6.2 lib/embulk/command/embulk.rb
embulk-0.6.1 lib/embulk/command/embulk.rb
embulk-0.6.0 lib/embulk/command/embulk.rb
embulk-0.5.5 lib/embulk/command/embulk.rb
embulk-0.5.4 lib/embulk/command/embulk.rb
embulk-0.5.3 lib/embulk/command/embulk.rb
embulk-0.5.2 lib/embulk/command/embulk.rb
embulk-0.5.1 lib/embulk/command/embulk.rb
embulk-0.5.0 lib/embulk/command/embulk.rb
embulk-0.4.10 lib/embulk/command/embulk.rb