2014-02-01 18:18:58 +00:00
|
|
|
# TODO: Switch to Vagrant.require_version before 1.0.0
|
|
|
|
# see: https://github.com/mitchellh/vagrant/blob/bc55081e9ffaa6820113e449a9f76b293a29b27d/lib/vagrant.rb#L202-L228
|
|
|
|
unless Gem::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(Vagrant::VERSION))
|
|
|
|
raise 'vagrant-cachier requires Vagrant >= 1.4.0 in order to work!'
|
|
|
|
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-10-21 09:17:59 +00:00
|
|
|
guest_capability 'linux', 'composer_path' do
|
|
|
|
require_relative 'cap/linux/composer_path'
|
|
|
|
Cap::Linux::ComposerPath
|
|
|
|
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-10-23 12:44:49 +00:00
|
|
|
guest_capability 'linux', 'npm_cache_dir' do
|
|
|
|
require_relative 'cap/linux/npm_cache_dir'
|
|
|
|
Cap::Linux::NpmCacheDir
|
|
|
|
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
|
|
|
|
|
2013-11-06 21:43:12 +00:00
|
|
|
guest_capability 'suse', 'yum_cache_dir' do
|
|
|
|
# Disable Yum on suse guests
|
|
|
|
end
|
|
|
|
|
2013-05-22 22:38:26 +00:00
|
|
|
guest_capability 'arch', 'pacman_cache_dir' do
|
|
|
|
require_relative 'cap/arch/pacman_cache_dir'
|
|
|
|
Cap::Arch::PacmanCacheDir
|
|
|
|
end
|
|
|
|
|
2013-11-05 14:00:39 +00:00
|
|
|
guest_capability 'suse', 'zypper_cache_dir' do
|
|
|
|
require_relative 'cap/suse/zypper_cache_dir'
|
|
|
|
Cap::SuSE::ZypperCacheDir
|
|
|
|
end
|
|
|
|
|
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
|
2014-02-01 19:21:46 +00:00
|
|
|
|
|
|
|
action_hook ALL_ACTIONS do |hook|
|
|
|
|
require_relative 'action/configure_bucket_root'
|
2014-02-01 19:50:12 +00:00
|
|
|
require_relative 'action/install_buckets'
|
|
|
|
|
2014-02-01 19:21:46 +00:00
|
|
|
hook.before Vagrant::Action::Builtin::Provision, Action::ConfigureBucketRoot
|
2014-02-01 19:50:12 +00:00
|
|
|
# This will do the initial buckets installation
|
|
|
|
hook.after Vagrant::Action::Builtin::Provision, Action::InstallBuckets
|
|
|
|
end
|
|
|
|
|
|
|
|
# This ensure buckets are reconfigured after provisioners runs
|
|
|
|
action_hook :provisioner_run do |hook|
|
|
|
|
require_relative 'action/install_buckets'
|
|
|
|
hook.after :run_provisioner, Action::InstallBuckets
|
2014-02-01 19:21:46 +00:00
|
|
|
end
|
2013-05-22 22:38:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|