Sha256: fbc0568d61feaf1e7533811c1d2f6feb8eb15944016e5ab73bd1cc0626670677

Contents?: true

Size: 645 Bytes

Versions: 8

Compression:

Stored size: 645 Bytes

Contents

module Berkshelf
  module Vagrant
    module Action
      # @author Jamie Winsor <jamie@vialstudios.com>
      class Clean
        attr_reader :shelf

        def initialize(app, env)
          @app = app
          @shelf = Berkshelf::Vagrant.shelf_for(env)
        end

        def call(env)
          if Berkshelf::Vagrant.chef_solo?(env[:vm].config) && self.shelf
            Berkshelf.formatter.msg "cleaning Vagrant's shelf"
            FileUtils.remove_dir(self.shelf, fore: true)
          end

          @app.call(env)
        rescue BerkshelfError => e
          raise VagrantWrapperError.new(e)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
berkshelf-1.1.6 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.5 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.4 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.3 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.2 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.1 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.0 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.1.0.rc1 lib/berkshelf/vagrant/action/clean.rb