Class: Freely::Dependency
- Inherits:
-
Object
- Object
- Freely::Dependency
- Defined in:
- lib/freely/dependency.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
-
.from_path(path) ⇒ Object
Fetch dependencies from binary at path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Dependency
constructor
A new instance of Dependency.
- #to_s ⇒ Object
-
#track ⇒ Object
Recursively read sub-dependencies.
Constructor Details
#initialize(path) ⇒ Dependency
Returns a new instance of Dependency.
8 9 10 11 12 |
# File 'lib/freely/dependency.rb', line 8 def initialize path @path = path @name = Tools.read_name path @dependencies = Tools.fyi(Dependency.from_path @path) end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
6 7 8 |
# File 'lib/freely/dependency.rb', line 6 def dependencies @dependencies end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/freely/dependency.rb', line 6 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/freely/dependency.rb', line 6 def path @path end |
Class Method Details
.from_path(path) ⇒ Object
Fetch dependencies from binary at path
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/freely/dependency.rb', line 15 def self.from_path path Tools.read_deps(path).split(/$/).map do |str| if \ %r|\s(\S+)\s| =~ str \ and not str.include? Options::SYSTEM_LIBS \ and not str.include? Options::SYSTEM_FRAMEWORKS \ and not str.include? path new $1 # construct dependency end end.compact end |
Instance Method Details
#to_s ⇒ Object
38 39 40 |
# File 'lib/freely/dependency.rb', line 38 def to_s @name end |
#track ⇒ Object
Recursively read sub-dependencies
29 30 31 32 33 34 35 36 |
# File 'lib/freely/dependency.rb', line 29 def track unless @dependencies.empty? # sub-dependencies + me Tools.fyi(@dependencies.map!{|d| d.track}).push self else self # just me end end |