Class: Berkshelf::Vagrant::Action::ConfigureChef

Inherits:
Object
  • Object
show all
Includes:
EnvHelpers
Defined in:
lib/berkshelf/vagrant/action/configure_chef.rb

Constant Summary

Constants included from EnvHelpers

EnvHelpers::BERKS_CONSTRAINT

Instance Method Summary collapse

Methods included from EnvHelpers

#berks, #berksfile_path, #berkshelf_enabled?, #cache_file, #chef_client?, #chef_solo?, #provision_disabled?, #provisioners

Constructor Details

#initialize(app, env) ⇒ ConfigureChef

Returns a new instance of ConfigureChef.



7
8
9
# File 'lib/berkshelf/vagrant/action/configure_chef.rb', line 7

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/berkshelf/vagrant/action/configure_chef.rb', line 11

def call(env)
  unless berkshelf_enabled?(env)
    return @app.call(env)
  end

  if chef_solo?(env) && shelf = env[:berkshelf].shelf
    provisioners(:chef_solo, env).each do |provisioner|
      provisioner.config.cookbooks_path = provisioner.config.send(:prepare_folders_config, shelf)
    end
  end

  @app.call(env)
end