Class: Caterer::Action::Berkshelf::Clean
- Inherits:
-
Caterer::Action::Base
- Object
- Caterer::Action::Base
- Caterer::Action::Berkshelf::Clean
- Defined in:
- lib/caterer/action/berkshelf/clean.rb
Instance Attribute Summary collapse
-
#shelf ⇒ Object
readonly
Returns the value of attribute shelf.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Clean
constructor
A new instance of Clean.
Constructor Details
Instance Attribute Details
#shelf ⇒ Object (readonly)
Returns the value of attribute shelf.
6 7 8 |
# File 'lib/caterer/action/berkshelf/clean.rb', line 6 def shelf @shelf end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/caterer/action/berkshelf/clean.rb', line 13 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 or env[:force_berks_clean] ::Berkshelf.formatter.msg "cleaning Caterer's shelf" FileUtils.remove_dir(shelf, fore: true) end end end @app.call(env) end |