Top Level Namespace

Defined Under Namespace

Modules: Async, ThreeScale

Constant Summary collapse

BUNDLER_GEM =
'bundler'

Instance Method Summary collapse

Instance Method Details

#bundled_with(lockfile) ⇒ Object



8
9
10
11
12
13
# File 'ext/mkrf_conf.rb', line 8

def bundled_with(lockfile)
  File.read(lockfile).
    lines.each_cons(2).find do |f, _|
      f == "BUNDLED WITH\n".freeze
    end.last.strip
end

#bundler_requirements(version, reqtype = '=') ⇒ Object



15
16
17
# File 'ext/mkrf_conf.rb', line 15

def bundler_requirements(version, reqtype = '=')
  ["#{reqtype} #{version}"]
end

#gem_install_bundler(requirements) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'ext/mkrf_conf.rb', line 19

def gem_install_bundler(requirements)
  require 'rubygems/command'
  require 'rubygems/commands/install_command'
  begin
    Gem::Command.build_args = ARGV
  rescue NoMethodError
  end

  instcmd = Gem::Commands::InstallCommand.new
  instcmd.handle_options ['-N', BUNDLER_GEM, '--version', *requirements]
  begin
    instcmd.execute
  rescue Gem::SystemExitException => e
    raise e unless e.exit_code.zero?
  end
end

#get_bundler(requirements) ⇒ Object



36
37
38
# File 'ext/mkrf_conf.rb', line 36

def get_bundler(requirements)
  Gem::Specification.find_by_name(BUNDLER_GEM, *requirements)
end