Class: Berkshelf::Installer::Worker
- Inherits:
-
Object
- Object
- Berkshelf::Installer::Worker
- Includes:
- Celluloid
- Defined in:
- lib/berkshelf/installer.rb
Instance Attribute Summary collapse
-
#berksfile ⇒ Object
readonly
Returns the value of attribute berksfile.
-
#downloader ⇒ Object
readonly
Returns the value of attribute downloader.
Instance Method Summary collapse
-
#initialize(berksfile) ⇒ Worker
constructor
A new instance of Worker.
-
#install(dependency) ⇒ CachedCookbook
Install a specific dependency.
Constructor Details
#initialize(berksfile) ⇒ Worker
Returns a new instance of Worker.
70 71 72 73 |
# File 'lib/berkshelf/installer.rb', line 70 def initialize(berksfile) @berksfile = berksfile @downloader = Downloader.new(berksfile) end |
Instance Attribute Details
#berksfile ⇒ Object (readonly)
Returns the value of attribute berksfile.
67 68 69 |
# File 'lib/berkshelf/installer.rb', line 67 def berksfile @berksfile end |
#downloader ⇒ Object (readonly)
Returns the value of attribute downloader.
68 69 70 |
# File 'lib/berkshelf/installer.rb', line 68 def downloader @downloader end |
Instance Method Details
#install(dependency) ⇒ CachedCookbook
Install a specific dependency.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/berkshelf/installer.rb', line 81 def install(dependency) Berkshelf.log.info "Installing #{dependency}" if dependency.installed? Berkshelf.log.debug " Already installed - skipping install" Berkshelf.formatter.use(dependency) dependency.cached_cookbook else name, version = dependency.name, dependency.locked_version.to_s source = berksfile.source_for(name, version) Berkshelf.log.debug " Downloading #{dependency.name} (#{dependency.locked_version}) from #{source}" cookbook = source.cookbook(name, version) Berkshelf.log.debug " => #{cookbook.inspect}" Berkshelf.formatter.install(source, cookbook) stash = downloader.download(name, version) CookbookStore.import(name, version, stash) end end |