Class: Navo::Berksfile
- Inherits:
-
Object
- Object
- Navo::Berksfile
- Defined in:
- lib/navo/berksfile.rb
Overview
A global Berksfile to be shared amongst all threads.
This synchronizes access so we don’t have multiple threads doing the same work resolving cookbooks.
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
-
.path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
- .cache_directory ⇒ Object
- .install(logger: nil) ⇒ Object
- .load ⇒ Object
- .lockfile_path ⇒ Object
- .vendor(logger:) ⇒ Object
- .vendor_directory ⇒ Object
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/navo/berksfile.rb', line 11 def config @config end |
.path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/navo/berksfile.rb', line 10 def path @path end |
Class Method Details
.cache_directory ⇒ Object
38 39 40 |
# File 'lib/navo/berksfile.rb', line 38 def cache_directory Berkshelf::CookbookStore.default_path end |
.install(logger: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/navo/berksfile.rb', line 18 def install(logger: nil) if @installed logger.info 'Berksfile cookbooks already resolved' return end logger.info 'Installing Berksfile...' Berkshelf.logger = Celluloid.logger = logger Berkshelf.ui.mute { Berkshelf::Installer.new(berksfile).run } Celluloid.logger = nil # Ignore annoying shutdown messages @installed = true end |
.load ⇒ Object
13 14 15 16 |
# File 'lib/navo/berksfile.rb', line 13 def load require 'berkshelf' # Lazily require so we don't have to load for every command berksfile end |
.lockfile_path ⇒ Object
47 48 49 |
# File 'lib/navo/berksfile.rb', line 47 def lockfile_path berksfile.lockfile.filepath end |
.vendor(logger:) ⇒ Object
32 33 34 35 36 |
# File 'lib/navo/berksfile.rb', line 32 def vendor(logger:) Berkshelf.logger = Celluloid.logger = logger Berkshelf.ui.mute { berksfile.vendor(vendor_directory) } Celluloid.logger = nil # Ignore annoying shutdown messages end |
.vendor_directory ⇒ Object
42 43 44 45 |
# File 'lib/navo/berksfile.rb', line 42 def vendor_directory @vendor_directory ||= FileUtils.mkdir_p(File.join(config.repo_root, %w[.navo vendored-cookbooks])).first end |