Class: Dependencies

Inherits:
Object
  • Object
show all
Includes:
TSort
Defined in:
ext/dependencies.rb

Instance Method Summary collapse

Constructor Details

#initialize(cmake, options) ⇒ Dependencies

Returns a new instance of Dependencies.



6
7
8
9
10
11
12
13
14
15
# File 'ext/dependencies.rb', line 6

def initialize(cmake, options)
  @cmake = cmake
  @options = options
  @static_lib_shape = nil
  @nodes = {}
  @graph = Hash.new {|h, k| h[k] = []}

  generate_dot
  parse_dot
end

Instance Method Details

#libsObject



17
18
19
20
21
22
23
24
25
26
# File 'ext/dependencies.rb', line 17

def libs
  tsort.filter_map {|node|
    label, shape = @nodes[node]
    if shape == @static_lib_shape
      label.gsub(/\\n\([^)]+\)/, '')
    else
      nil
    end
  }.reverse.collect {|lib| "lib#{lib}.a"}
end

#to_sObject



28
29
30
# File 'ext/dependencies.rb', line 28

def to_s
  libs.join(" ")
end