Sha256: 8f084104ece5dc9d6a73ad8e1243425a5ce1bcad12c5c809575aef31bfc09773

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 Bytes

Contents

module Berkshelf::Vagrant
  module Action
    # @author Jamie Winsor <reset@riotgames.com>
    class Install
      include Berkshelf::Vagrant::EnvHelpers

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

      def call(env)
        env[:berkshelf].berksfile = Berkshelf::Berksfile.from_file(env[:global_config].berkshelf.berksfile_path)

        if chef_solo?(env)
          install(env)
        end

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

      private

        def install(env)
          env[:berkshelf].ui.info "Updating Vagrant's berkshelf: '#{env[:berkshelf].shelf}'"
          opts = {
            path: env[:berkshelf].shelf
          }.merge(env[:global_config].berkshelf.to_hash).symbolize_keys!
          env[:berkshelf].berksfile.install(opts)
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
berkshelf-vagrant-1.0.4 lib/berkshelf/vagrant/action/install.rb
berkshelf-vagrant-1.0.3 lib/berkshelf/vagrant/action/install.rb
berkshelf-vagrant-1.0.0.rc1 lib/berkshelf/vagrant/action/install.rb