Class: Daedalus::DependencyGrapher
- Inherits:
-
Object
- Object
- Daedalus::DependencyGrapher
- Defined in:
- lib/daedalus/dependency_grapher.rb
Defined Under Namespace
Modules: Conditional, Container Classes: Define, Else, ElseIf, ExpressionEvaluator, FileParser, If, IfDefined, IfNotDefined, IncludedFile, Node, ParseError, SourceFile, Undefine
Constant Summary collapse
- DEV_NULL =
RUBY_PLATFORM =~ /mingw|mswin/ ? 'NUL' : '/dev/null'
Instance Attribute Summary collapse
-
#defines ⇒ Object
Returns the value of attribute defines.
-
#directories ⇒ Object
Returns the value of attribute directories.
-
#file_names ⇒ Object
Returns the value of attribute file_names.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
-
#system_defines ⇒ Object
Returns the value of attribute system_defines.
Instance Method Summary collapse
- #get_system_defines ⇒ Object
-
#initialize(cc, files, directories = [], defines = nil) ⇒ DependencyGrapher
constructor
A new instance of DependencyGrapher.
- #print_dependencies(out, max = 72) ⇒ Object
- #process ⇒ Object
Constructor Details
#initialize(cc, files, directories = [], defines = nil) ⇒ DependencyGrapher
Returns a new instance of DependencyGrapher.
406 407 408 409 410 411 412 413 414 |
# File 'lib/daedalus/dependency_grapher.rb', line 406 def initialize(cc, files, directories=[], defines=nil) @cc = cc @file_names = files @directories = directories @defines = defines @system_defines = {} @sources = [] end |
Instance Attribute Details
#defines ⇒ Object
Returns the value of attribute defines.
403 404 405 |
# File 'lib/daedalus/dependency_grapher.rb', line 403 def defines @defines end |
#directories ⇒ Object
Returns the value of attribute directories.
403 404 405 |
# File 'lib/daedalus/dependency_grapher.rb', line 403 def directories @directories end |
#file_names ⇒ Object
Returns the value of attribute file_names.
403 404 405 |
# File 'lib/daedalus/dependency_grapher.rb', line 403 def file_names @file_names end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
404 405 406 |
# File 'lib/daedalus/dependency_grapher.rb', line 404 def sources @sources end |
#system_defines ⇒ Object
Returns the value of attribute system_defines.
403 404 405 |
# File 'lib/daedalus/dependency_grapher.rb', line 403 def system_defines @system_defines end |
Instance Method Details
#get_system_defines ⇒ Object
416 417 418 419 420 421 422 423 424 |
# File 'lib/daedalus/dependency_grapher.rb', line 416 def get_system_defines lines = `#{@cc} -dM -E #{@defines} - < #{DEV_NULL}`.split("\n") source = SourceFile.new "sytem_defines", self parser = FileParser.new source, @directories parser.parse lines source.execute @system_defines end |
#print_dependencies(out, max = 72) ⇒ Object
441 442 443 444 445 |
# File 'lib/daedalus/dependency_grapher.rb', line 441 def print_dependencies(out, max=72) @sources.each do |source| source.print_dependencies out, max end end |
#process ⇒ Object
426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/daedalus/dependency_grapher.rb', line 426 def process get_system_defines @file_names.each do |name| source = SourceFile.new name, self parser = FileParser.new source, @directories parser.parse_file name source.execute @system_defines.dup source.collect_dependencies @sources << source end end |