Class: Appraisal::GemManager::BundlerAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/appraisal/gem_manager/bundler_adapter.rb

Overview

Bundler adapter for gem management operations. This is the default gem manager and is always available.

Constant Summary collapse

DEFAULT_INSTALL_OPTIONS =
{"jobs" => 1}.freeze

Instance Attribute Summary

Attributes inherited from Base

#gemfile_path, #project_root

Instance Method Summary collapse

Methods inherited from Base

#initialize, #validate_availability!

Constructor Details

This class inherits a constructor from Appraisal::GemManager::Base

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/appraisal/gem_manager/bundler_adapter.rb', line 16

def available?
  true # Bundler is always available (it's a dependency of appraisal2)
end

#install(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/appraisal/gem_manager/bundler_adapter.rb', line 20

def install(options = {})
  commands = [install_command(options).join(" ")]

  # Only run check command if not using --without option
  if options["without"].nil? || options["without"].empty?
    commands.unshift(check_command.join(" "))
  end

  command = commands.join(" || ")

  if Bundler.settings[:path]
    env = {"BUNDLE_DISABLE_SHARED_GEMS" => "1"}
    Command.new(command, :gemfile => gemfile_path, :env => env).run
  else
    Command.new(command, :gemfile => gemfile_path).run
  end
end

#nameObject



12
13
14
# File 'lib/appraisal/gem_manager/bundler_adapter.rb', line 12

def name
  "bundler"
end

#update(gems = []) ⇒ Object



38
39
40
# File 'lib/appraisal/gem_manager/bundler_adapter.rb', line 38

def update(gems = [])
  Command.new(update_command(gems), :gemfile => gemfile_path).run
end