Sha256: 6c7864c3170c1ce8192d8c8cdc552e80721bbc81c2c262b38c092cc45efd2844

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

module Berkshelf
  module Vagrant
    module Action
      # @author Jamie Winsor <reset@riotgames.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

2 entries across 2 versions & 1 rubygems

Version Path
berkshelf-1.2.1 lib/berkshelf/vagrant/action/clean.rb
berkshelf-1.2.0.rc1 lib/berkshelf/vagrant/action/clean.rb