module Berkshelf::Vagrant module Action autoload :Clean, 'berkshelf/vagrant/action/clean' autoload :ConfigureChef, 'berkshelf/vagrant/action/configure_chef' autoload :Install, 'berkshelf/vagrant/action/install' autoload :LoadShelf, 'berkshelf/vagrant/action/load_shelf' autoload :SetUI, 'berkshelf/vagrant/action/set_ui' autoload :Upload, 'berkshelf/vagrant/action/upload' class << self # Return the Berkshelf install middleware stack. When placed in the action chain # this stack will find retrieve and resolve the cookbook dependencies describe # in your configured Berksfile. # # Cookbooks will installed into a temporary directory, called a Shelf, and mounted # into the VM. This mounted path will be appended to the chef_solo.cookbooks_path value. # # @return [::Vagrant::Action::Builder] def install @install ||= ::Vagrant::Action::Builder.new.tap do |b| b.use Berkshelf::Vagrant::Action::Install end end # Return the Berkshelf upload middleware stack. When placed in the action chain # this stack will upload cookbooks to a Chef Server if the Chef-Client provisioner # is used. The Chef Server where the cookbooks will be uploaded to is the same Chef # Server used in the Chef-Client provisioner. # # Nothing will be done if the Chef-Solo provisioner is used. # # @return [::Vagrant::Action::Builder] def upload @upload ||= ::Vagrant::Action::Builder.new.tap do |b| b.use Berkshelf::Vagrant::Action::Upload end end # Return the Berkshelf clean middleware stack. When placed in the action chain # this stack will clean up any temporary directories or files created by the other # middleware stacks. # # @return [::Vagrant::Action::Builder] def clean @clean ||= ::Vagrant::Action::Builder.new.tap do |b| b.use setup b.use Berkshelf::Vagrant::Action::Clean end end def setup @setup ||= ::Vagrant::Action::Builder.new.tap do |b| b.use ::Vagrant::Action::Builtin::EnvSet, berkshelf: Berkshelf::Vagrant::Env.new b.use Berkshelf::Vagrant::Action::SetUI b.use Berkshelf::Vagrant::Action::LoadShelf b.use Berkshelf::Vagrant::Action::ConfigureChef end end end end end