Class: CobraCommander::Dependencies::Bundler

Inherits:
Object
  • Object
show all
Defined in:
lib/cobra_commander/dependencies/bundler.rb

Overview

Calculates ruby bundler dependencies

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Bundler

Returns a new instance of Bundler.



13
14
15
16
# File 'lib/cobra_commander/dependencies/bundler.rb', line 13

def initialize(root)
  @root = Pathname.new(root)
  @path = @root.join("Gemfile.lock").realpath
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



11
12
13
# File 'lib/cobra_commander/dependencies/bundler.rb', line 11

def path
  @path
end

Instance Method Details

#componentsObject



22
23
24
25
26
# File 'lib/cobra_commander/dependencies/bundler.rb', line 22

def components
  components_source.specs.map do |spec|
    { path: spec.loaded_from, name: spec.name, dependencies: spec.dependencies.map(&:name) }
  end
end

#dependenciesObject



18
19
20
# File 'lib/cobra_commander/dependencies/bundler.rb', line 18

def dependencies
  lockfile.dependencies.values.map(&:name)
end