Class: Vendor::VendorFile::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/vendor/vendor_file/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLoader

Returns a new instance of Loader.



11
12
13
14
# File 'lib/vendor/vendor_file/loader.rb', line 11

def initialize
  @dsl = Vendor::VendorFile::DSL.new
  @libraries = []
end

Instance Attribute Details

#dslObject (readonly)

Returns the value of attribute dsl.



8
9
10
# File 'lib/vendor/vendor_file/loader.rb', line 8

def dsl
  @dsl
end

#librariesObject

Returns the value of attribute libraries.



9
10
11
# File 'lib/vendor/vendor_file/loader.rb', line 9

def libraries
  @libraries
end

Instance Method Details

#install(project) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/vendor/vendor_file/loader.rb', line 34

def install(project)
  unless @graph.version_conflicts?
    @graph.libraries_to_install.each do |lib|
      library, targets = lib
      library.install project, :targets => targets
    end
  end
end

#libraries_to_installObject



26
27
28
29
30
31
32
# File 'lib/vendor/vendor_file/loader.rb', line 26

def libraries_to_install
  unless @graph.version_conflicts?
    @graph.libraries_to_install.each do |library,targets|
      yield library, targets if block_given?
    end
  end
end

#load(filename) ⇒ Object



21
22
23
24
# File 'lib/vendor/vendor_file/loader.rb', line 21

def load(filename)
  @dsl.instance_eval(File.read(filename), filename)
  self.libraries = @dsl.libraries
end