Class: Appraisal::GemManager::OreAdapter

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

Overview

Ore-light adapter for gem management operations. Ore-light is a fast, Go-based alternative to Bundler for gem installation. See: github.com/contriboss/ore-light

Constant Summary collapse

ORE_EXECUTABLE =
"ore"

Instance Attribute Summary

Attributes inherited from Base

#gemfile_path, #project_root

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/appraisal/gem_manager/ore_adapter.rb', line 17

def available?
  system("which #{ORE_EXECUTABLE} > /dev/null 2>&1")
end

#install(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/appraisal/gem_manager/ore_adapter.rb', line 25

def install(options = {})
  validate_availability!

  lockfile = "#{gemfile_path}.lock"

  # Run ore lock first if lockfile doesn't exist
  unless File.exist?(lockfile)
    lock_command = [ORE_EXECUTABLE, "lock", "-gemfile", gemfile_path]
    run_ore_command(lock_command)
  end

  command = install_command(options)
  run_ore_command(command)
end

#nameObject



13
14
15
# File 'lib/appraisal/gem_manager/ore_adapter.rb', line 13

def name
  "ore"
end

#update(gems = []) ⇒ Object



40
41
42
43
44
45
# File 'lib/appraisal/gem_manager/ore_adapter.rb', line 40

def update(gems = [])
  validate_availability!

  command = update_command(gems)
  run_ore_command(command)
end

#validate_availability!Object



21
22
23
# File 'lib/appraisal/gem_manager/ore_adapter.rb', line 21

def validate_availability!
  raise OreNotAvailableError unless available?
end