Sha256: 19e401c22eba635668e269f7bf30606ac93d2fc06d74cc9a82c430932f79a6d2

Contents?: true

Size: 681 Bytes

Versions: 7

Compression:

Stored size: 681 Bytes

Contents

module Berkshelf
  module Vagrant
    module Action
      class Clean
        include Berkshelf::Vagrant::EnvHelpers

        def initialize(app, env)
          @app = app
        end

        def call(env)
          if env[:berkshelf].shelf && File.exist?(env[:berkshelf].shelf)
            env[:berkshelf].ui.info "Cleaning Vagrant's berkshelf"

            FileUtils.remove_dir(env[:berkshelf].shelf, force: true)
            FileUtils.rm_f(cache_file(env))
            env[:berkshelf].shelf = nil
          end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-berkshelf-3.0.1 lib/berkshelf/vagrant/action/clean.rb
vagrant-berkshelf-3.0.0 lib/berkshelf/vagrant/action/clean.rb
vagrant-berkshelf-3.0.0.rc2 lib/berkshelf/vagrant/action/clean.rb
vagrant-berkshelf-3.0.0.rc1 lib/berkshelf/vagrant/action/clean.rb
vagrant-berkshelf-2.0.1 lib/berkshelf/vagrant/action/clean.rb
vagrant-berkshelf-2.0.0.rc4 lib/berkshelf/vagrant/action/clean.rb
vagrant-berkshelf-2.0.0.rc3 lib/berkshelf/vagrant/action/clean.rb