Sha256: fa66b3004956d05b0c83b38abcc7ed9788d56c3471bff9e2dcd8a62709a90e00

Contents?: true

Size: 800 Bytes

Versions: 6

Compression:

Stored size: 800 Bytes

Contents

module Embulk
  def self.add_embedded_gem_path
    begin
      resource_class = org.embulk.command.Runner.java_class
    rescue NameError
      begin
        Embulk.require_classpath
        resource_class = org.embulk.command.Runner.java_class
      rescue NameError
        return nil
      end
    end

    gem_path = resource_class.resource("/embulk/gems").to_s.sub(/^jar:/, '')
    unless gem_path.empty?
      # GEM_PATH can't include ':'
      gem_path = gem_path.gsub(/\w{0,5}:(?:\/(?=\/))*/, "")
      orig = ENV['GEM_PATH'].to_s
      if orig.empty?
        ENV['GEM_PATH'] = gem_path
      elsif !orig.split(Gem.path_separator).include?(gem_path)
        ENV['GEM_PATH'] = "#{gem_path}:#{orig}"
      end
      Gem.clear_paths
      return ENV['GEM_PATH']
    end
    return nil
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
embulk-0.6.27 lib/embulk/gems.rb
embulk-0.6.26 lib/embulk/gems.rb
embulk-0.6.25 lib/embulk/gems.rb
embulk-0.6.24 lib/embulk/gems.rb
embulk-0.6.23 lib/embulk/gems.rb
embulk-0.6.22 lib/embulk/gems.rb