Class: Librarian::Chef::Source::Site::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/librarian/chef/source/site.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, name) ⇒ Line

Returns a new instance of Line.


24
25
26
27
# File 'lib/librarian/chef/source/site.rb', line 24

def initialize(source, name)
  self.source = source
  self.name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name


21
22
23
# File 'lib/librarian/chef/source/site.rb', line 21

def name
  @name
end

#sourceObject

Returns the value of attribute source


21
22
23
# File 'lib/librarian/chef/source/site.rb', line 21

def source
  @source
end

Instance Method Details

#install_version!(version, install_path) ⇒ Object


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/librarian/chef/source/site.rb', line 29

def install_version!(version, install_path)
  cache_version_unpacked! version

  if install_path.exist?
    debug { "Deleting #{relative_path_to(install_path)}" }
    install_path.rmtree
  end

  unpacked_path = version_unpacked_cache_path(version)

  debug { "Copying #{relative_path_to(unpacked_path)} to #{relative_path_to(install_path)}" }
  FileUtils.cp_r(unpacked_path, install_path)
end

#manifestsObject


43
44
45
46
47
# File 'lib/librarian/chef/source/site.rb', line 43

def manifests
  version_uris.map do |version_uri|
    Manifest.new(source, name, version_uri)
  end
end

#to_version(version_uri) ⇒ Object


49
50
51
# File 'lib/librarian/chef/source/site.rb', line 49

def to_version(version_uri)
  (version_uri)["version"]
end

#version_dependencies(version) ⇒ Object


53
54
55
# File 'lib/librarian/chef/source/site.rb', line 53

def version_dependencies(version)
  version_manifest(version)["dependencies"]
end