Module: Cbradeps

Defined in:
lib/cobradeps.rb,
lib/cobradeps/gemfile_scraper.rb

Defined Under Namespace

Classes: GemfileScraper

Class Method Summary collapse

Class Method Details

.output_dot(root_path = nil) ⇒ Object



35
36
37
38
# File 'lib/cobradeps.rb', line 35

def self.output_dot(root_path = nil)
  path = root_path || current_path
  graph(path).output(:dot => "graph.dot")
end

.output_graph(root_path = nil) ⇒ Object



30
31
32
33
# File 'lib/cobradeps.rb', line 30

def self.output_graph(root_path = nil)
  path = root_path || current_path
  graph(path).output(:png => "graph.png")
end

.output_text(root_path = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cobradeps.rb', line 8

def self.output_text(root_path = nil)
  path = root_path || current_path
  app = GemfileScraper.new(path)

  outputs "APP"
  outputs app.to_s

  outputs "\n\nDEPENDENCIES"
  cobra_deps = app.transitive_cobra_dependencies.to_set

  cobra_deps.each do |dep|
    outputs "\n#{dep[:options][:path]}"
    gem = GemfileScraper.new(dep[:options][:path])
    outputs gem.to_s

    cobra_deps = cobra_deps.merge gem.cobra_dependencies
  end

  outputs "\n\n ALL PARTS"
  outputs cobra_deps.to_a
end