Class: Caterer::Action::Berkshelf::Install
- Inherits:
-
Caterer::Action::Base
- Object
- Caterer::Action::Base
- Caterer::Action::Berkshelf::Install
- Defined in:
- lib/caterer/action/berkshelf/install.rb
Instance Attribute Summary collapse
-
#berksfile ⇒ Object
readonly
Returns the value of attribute berksfile.
-
#cachefile ⇒ Object
readonly
Returns the value of attribute cachefile.
-
#shelf ⇒ Object
readonly
Returns the value of attribute shelf.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Install
constructor
A new instance of Install.
Constructor Details
#initialize(app, env) ⇒ Install
Returns a new instance of Install.
12 13 14 15 16 17 18 |
# File 'lib/caterer/action/berkshelf/install.rb', line 12 def initialize(app, env) super @shelf = Caterer::Berkshelf.shelf_for(env) @berksfile = ::Berkshelf::Berksfile.from_file(env[:config].berkshelf.berksfile_path) @cachefile = "#{shelf}/.cache" end |
Instance Attribute Details
#berksfile ⇒ Object (readonly)
Returns the value of attribute berksfile.
9 10 11 |
# File 'lib/caterer/action/berkshelf/install.rb', line 9 def berksfile @berksfile end |
#cachefile ⇒ Object (readonly)
Returns the value of attribute cachefile.
10 11 12 |
# File 'lib/caterer/action/berkshelf/install.rb', line 10 def cachefile @cachefile end |
#shelf ⇒ Object (readonly)
Returns the value of attribute shelf.
8 9 10 |
# File 'lib/caterer/action/berkshelf/install.rb', line 8 def shelf @shelf end |
Instance Method Details
#call(env) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/caterer/action/berkshelf/install.rb', line 21 def call(env) config = env[:config] image = config.images[env[:image]] if image image.provisioners.each do |provisioner| if provisioner.is_a? Caterer::Provisioner::ChefSolo configure_cookbooks_path(provisioner) end end end if needs_update? or env[:force_berks_install] ::Berkshelf.formatter.msg "installing cookbooks..." install(env) update_cache else ::Berkshelf.formatter.msg "up-to-date" end @app.call(env) end |