Class: VagrantPlugins::Berkshelf::Action::Install

Inherits:
Base
  • Object
show all
Defined in:
lib/vagrant-berkshelf/action/install.rb

Instance Method Summary collapse

Methods inherited from Base

clean, #initialize, provision, setup

Methods included from Helpers

#berks, #berks_bin, #berkshelf_enabled?, #chef_client?, #chef_solo?, #chef_zero?, #datafile_path, #provision_enabled?, #provisioners, #with_clean_env

Constructor Details

This class inherits a constructor from VagrantPlugins::Berkshelf::Action::Base

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-berkshelf/action/install.rb', line 7

def call(env)
  if !berkshelf_enabled?(env)
    @logger.info "Berkshelf disabled, skipping"
    return @app.call(env)
  end

  if !provision_enabled?(env)
    @logger.info "Provisioning disabled, skipping"
    return @app.call(env)
  end

  vendor(env)
  @app.call(env)
end

#vendor(env) ⇒ Object

Vendor the cookbooks in the Berkshelf shelf.



23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-berkshelf/action/install.rb', line 23

def vendor(env)
  shelf = env[:berkshelf].shelf
  env[:machine].ui.info "Updating Vagrant's Berkshelf..."

  options = env[:machine].config.berkshelf.to_hash

  result = berks('vendor', shelf, options)
  env[:machine].ui.output(result.stdout)
end