Class: Appraisal::GemManager::Base

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

Overview

Abstract base class defining the interface for gem managers. Subclasses must implement all public methods.

Direct Known Subclasses

BundlerAdapter, OreAdapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gemfile_path, project_root) ⇒ Base

Returns a new instance of Base.

Parameters:

  • gemfile_path (String)

    path to the gemfile

  • project_root (Pathname)

    root directory of the project



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

def initialize(gemfile_path, project_root)
  @gemfile_path = gemfile_path
  @project_root = project_root
end

Instance Attribute Details

#gemfile_pathObject (readonly)

Returns the value of attribute gemfile_path.



8
9
10
# File 'lib/appraisal/gem_manager/base.rb', line 8

def gemfile_path
  @gemfile_path
end

#project_rootObject (readonly)

Returns the value of attribute project_root.



8
9
10
# File 'lib/appraisal/gem_manager/base.rb', line 8

def project_root
  @project_root
end

Instance Method Details

#available?Boolean

Check if the gem manager is available on the system

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/appraisal/gem_manager/base.rb', line 39

def available?
  raise NotImplementedError, "#{self.class}#available? must be implemented"
end

#install(options = {}) ⇒ void

This method returns an undefined value.

Install gems for the given gemfile

Parameters:

  • options (Hash) (defaults to: {})

    install options (jobs, retry, without, path, etc.)

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/appraisal/gem_manager/base.rb', line 20

def install(options = {})
  raise NotImplementedError, "#{self.class}#install must be implemented"
end

#nameString

Name of the gem manager for display

Returns:

  • (String)

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/appraisal/gem_manager/base.rb', line 33

def name
  raise NotImplementedError, "#{self.class}#name must be implemented"
end

#update(gems = []) ⇒ void

This method returns an undefined value.

Update gems (all or specific gems)

Parameters:

  • gems (Array<String>) (defaults to: [])

    list of gems to update, empty = all

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/appraisal/gem_manager/base.rb', line 27

def update(gems = [])
  raise NotImplementedError, "#{self.class}#update must be implemented"
end

#validate_availability!void

This method returns an undefined value.

Validate that the gem manager is available, raising an error if not

Raises:



46
47
48
# File 'lib/appraisal/gem_manager/base.rb', line 46

def validate_availability!
  # Default implementation does nothing (bundler is always available)
end