2013-08-03 17:30:39 +00:00
|
|
|
require_relative 'provision_ext'
|
2013-07-21 23:46:20 +00:00
|
|
|
Vagrant::Action::Builtin::Provision.class_eval do
|
2013-08-03 17:30:39 +00:00
|
|
|
include VagrantPlugins::Cachier::ProvisionExt
|
2013-07-21 23:46:20 +00:00
|
|
|
end
|
|
|
|
|
2013-08-03 17:26:10 +00:00
|
|
|
# Add our custom translations to the load path
|
|
|
|
I18n.load_path << File.expand_path("../../../locales/en.yml", __FILE__)
|
|
|
|
|
2013-06-08 02:37:02 +00:00
|
|
|
module VagrantPlugins
|
2013-05-22 22:38:26 +00:00
|
|
|
module Cachier
|
|
|
|
class Plugin < Vagrant.plugin('2')
|
|
|
|
name 'vagrant-cachier'
|
|
|
|
|
|
|
|
config 'cache' do
|
|
|
|
require_relative "config"
|
|
|
|
Config
|
|
|
|
end
|
|
|
|
|
|
|
|
guest_capability 'linux', 'gemdir' do
|
|
|
|
require_relative 'cap/linux/gemdir'
|
|
|
|
Cap::Linux::Gemdir
|
|
|
|
end
|
|
|
|
|
2013-06-25 19:51:59 +00:00
|
|
|
guest_capability 'linux', 'rvm_path' do
|
|
|
|
require_relative 'cap/linux/rvm_path'
|
|
|
|
Cap::Linux::RvmPath
|
2013-06-21 19:08:42 +00:00
|
|
|
end
|
|
|
|
|
2013-06-11 19:43:42 +00:00
|
|
|
guest_capability 'linux', 'chef_file_cache_path' do
|
|
|
|
require_relative 'cap/linux/chef_file_cache_path'
|
|
|
|
Cap::Linux::ChefFileCachePath
|
|
|
|
end
|
|
|
|
|
2013-05-22 22:38:26 +00:00
|
|
|
guest_capability 'debian', 'apt_cache_dir' do
|
|
|
|
require_relative 'cap/debian/apt_cache_dir'
|
|
|
|
Cap::Debian::AptCacheDir
|
|
|
|
end
|
|
|
|
|
2013-07-17 09:38:02 +00:00
|
|
|
guest_capability 'debian', 'apt_cacher_dir' do
|
|
|
|
require_relative 'cap/debian/apt_cacher_dir'
|
|
|
|
Cap::Debian::AptCacherDir
|
|
|
|
end
|
|
|
|
|
2013-05-22 22:38:26 +00:00
|
|
|
guest_capability 'redhat', 'yum_cache_dir' do
|
|
|
|
require_relative 'cap/redhat/yum_cache_dir'
|
|
|
|
Cap::RedHat::YumCacheDir
|
|
|
|
end
|
|
|
|
|
|
|
|
guest_capability 'arch', 'pacman_cache_dir' do
|
|
|
|
require_relative 'cap/arch/pacman_cache_dir'
|
|
|
|
Cap::Arch::PacmanCacheDir
|
|
|
|
end
|
|
|
|
|
2013-08-03 18:08:20 +00:00
|
|
|
# TODO: This should be generic, we don't want to hard code every single
|
|
|
|
# possible provider action class that Vagrant might have
|
|
|
|
ensure_single_cache_root = lambda do |hook|
|
|
|
|
require_relative 'action/ensure_single_cache_root'
|
2013-08-03 19:07:42 +00:00
|
|
|
hook.before VagrantPlugins::ProviderVirtualBox::Action::Boot, Action::EnsureSingleCacheRoot
|
2013-08-03 18:08:20 +00:00
|
|
|
|
|
|
|
if defined?(Vagrant::LXC)
|
|
|
|
# TODO: Require just the boot action file once its "require dependencies" are sorted out
|
|
|
|
require 'vagrant-lxc/action'
|
2013-08-03 19:07:42 +00:00
|
|
|
hook.before Vagrant::LXC::Action::Boot, Action::EnsureSingleCacheRoot
|
2013-08-03 18:08:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
action_hook 'ensure-single-cache-root-exists-on-up', :machine_action_up, &ensure_single_cache_root
|
|
|
|
action_hook 'ensure-single-cache-root-exists-on-reload', :machine_action_reload, &ensure_single_cache_root
|
|
|
|
|
2013-05-22 22:38:26 +00:00
|
|
|
clean_action_hook = lambda do |hook|
|
2013-07-21 22:46:22 +00:00
|
|
|
require_relative 'action/clean'
|
2013-08-03 19:13:57 +00:00
|
|
|
hook.before Vagrant::Action::Builtin::GracefulHalt, Action::Clean
|
2013-05-22 22:38:26 +00:00
|
|
|
end
|
2013-08-03 19:13:57 +00:00
|
|
|
action_hook 'remove-guest-symlinks-on-halt', :machine_action_halt, &clean_action_hook
|
|
|
|
action_hook 'remove-guest-symlinks-on-package', :machine_action_package, &clean_action_hook
|
2013-05-22 22:38:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|