Class: Gemchain::Workspace

Inherits:
Object
  • Object
show all
Defined in:
lib/gemchain/workspace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Workspace

Returns a new instance of Workspace.



26
27
28
29
30
# File 'lib/gemchain/workspace.rb', line 26

def initialize(config)
  @config = config
  @gems = load_gems
  @graph = DependencyGraph.new(@gems)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



24
25
26
# File 'lib/gemchain/workspace.rb', line 24

def config
  @config
end

#gemsObject (readonly)

Returns the value of attribute gems.



24
25
26
# File 'lib/gemchain/workspace.rb', line 24

def gems
  @gems
end

#graphObject (readonly)

Returns the value of attribute graph.



24
25
26
# File 'lib/gemchain/workspace.rb', line 24

def graph
  @graph
end

Instance Method Details

#cascade_order(start_gem = nil) ⇒ Object



40
41
42
# File 'lib/gemchain/workspace.rb', line 40

def cascade_order(start_gem = nil)
  @graph.cascade_order(start_gem)
end

#dependencies_of(gem_name) ⇒ Object



36
37
38
# File 'lib/gemchain/workspace.rb', line 36

def dependencies_of(gem_name)
  @graph.dependencies_of(gem_name)
end

#dependents_of(gem_name) ⇒ Object



32
33
34
# File 'lib/gemchain/workspace.rb', line 32

def dependents_of(gem_name)
  @graph.dependents_of(gem_name)
end

#find(name) ⇒ Object



44
45
46
# File 'lib/gemchain/workspace.rb', line 44

def find(name)
  @gems.find { |g| g.name == name }
end

#transitive_dependents(gem_name) ⇒ Object

All gems that directly or transitively depend on gem_name.



49
50
51
# File 'lib/gemchain/workspace.rb', line 49

def transitive_dependents(gem_name)
  @graph.transitive_dependents(gem_name)
end