Class: Depends::Definition
- Inherits:
-
Object
- Object
- Depends::Definition
- Defined in:
- lib/depends/definition.rb
Instance Attribute Summary collapse
-
#default_source ⇒ Object
readonly
Returns the value of attribute default_source.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
-
#unmet_dependencies ⇒ Object
readonly
Returns the value of attribute unmet_dependencies.
Instance Method Summary collapse
-
#initialize(sources, dependencies, options = {}) ⇒ Definition
constructor
A new instance of Definition.
- #inspect ⇒ Object
- #map(deps) ⇒ Object
Constructor Details
#initialize(sources, dependencies, options = {}) ⇒ Definition
Returns a new instance of Definition.
10 11 12 13 |
# File 'lib/depends/definition.rb', line 10 def initialize(sources,dependencies, ={}) @sources = sources map(dependencies) end |
Instance Attribute Details
#default_source ⇒ Object (readonly)
Returns the value of attribute default_source.
8 9 10 |
# File 'lib/depends/definition.rb', line 8 def default_source @default_source end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
6 7 8 |
# File 'lib/depends/definition.rb', line 6 def dependencies @dependencies end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
5 6 7 |
# File 'lib/depends/definition.rb', line 5 def sources @sources end |
#unmet_dependencies ⇒ Object (readonly)
Returns the value of attribute unmet_dependencies.
7 8 9 |
# File 'lib/depends/definition.rb', line 7 def unmet_dependencies @unmet_dependencies end |
Instance Method Details
#inspect ⇒ Object
41 42 43 |
# File 'lib/depends/definition.rb', line 41 def inspect "#{self} sources=> #{sources} dependencies => #{dependencies}" end |
#map(deps) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/depends/definition.rb', line 15 def map(deps) @dependencies = [] @unmet_dependencies = [] Log.debug " :definition => #{@def.inspect}" deps.each do |dep| dependency_met = false sources.each do |source| begin server_dep = source.get_dep_version(dep[:name], dep[:version] ) server_dep[:source] = source server_dep[:destination] = dep[:destination] server_dep[:name] = dep[:name] Log.debug ":server_dep => #{server_dep}" @dependencies << server_dep dependency_met = true rescue Nestful::ResourceNotFound => e Log.debug ":resource_not_found => #{e.inspect}" end end @unmet_dependencies << dep unless dependency_met end end |