Merge pull request #55 from fgrehm/release-0.5.0

Release 0.5.0
This commit is contained in:
Fabio Rehm 2013-11-08 12:48:50 -08:00
commit fc9a07dfba
9 changed files with 105 additions and 7 deletions

View file

@ -1,4 +1,8 @@
## [0.4.2](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.1...master) (unreleased)
## [0.5.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.1...v0.5.0) (Nov 6, 2013)
FEATURES:
- Support for [zypper] [GH-54]
## [0.4.1](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.0...v0.4.1) (Oct 27, 2013)

View file

@ -31,7 +31,7 @@ GIT
PATH
remote: .
specs:
vagrant-cachier (0.4.1)
vagrant-cachier (0.5.0)
GEM
remote: https://rubygems.org/

View file

@ -142,7 +142,20 @@ _Please note that to avoid re-downloading packages, you should avoid `apt-get cl
as much as possible in order to make a better use of the cache, even if you are
packaging a box_
##### Yum
##### Zypper
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'some-suse-box'
config.cache.enable :zypper
end
```
Used by SuSE guests, will get configured under guest's `/var/cache/zypp/packages`. It will
also [make sure](lib/vagrant-cachier/bucket/zypper.rb#L20) that `keep-packages` is enabled
for all repositories.
###### Yum
```ruby
Vagrant.configure("2") do |config|

View file

@ -14,9 +14,6 @@ Vagrant.configure("2") do |config|
config.cache.auto_detect = true
config.cache.enable_nfs = true
config.vm.provider :virtualbox do |_, vb|
vb.vm.network :private_network, ip: "192.168.50.123"
end
config.omnibus.chef_version = :latest
config.vm.provision :chef_solo do |chef|
@ -62,6 +59,10 @@ Vagrant.configure("2") do |config|
fi
'
configure_private_network = lambda do |node, suffix|
node.vm.network :private_network, ip: "192.168.50.#{suffix}"
end
debian_like_configs = lambda do |debian|
# Here we have the RubyGems cache bucket configured to the right path, so we
# bundle the project
@ -74,22 +75,26 @@ Vagrant.configure("2") do |config|
config.vm.define :ubuntu do |ubuntu|
ubuntu.vm.box = "quantal64"
debian_like_configs.call ubuntu
configure_private_network.call ubuntu, 10
end
config.vm.define :lucid do |lucid|
lucid.vm.box = "lucid64"
debian_like_configs.call lucid
configure_private_network.call lucid, 11
end
config.vm.define :debian do |debian|
debian.vm.box = "squeeze64"
debian.vm.box_url = 'http://f.willianfernandes.com.br/vagrant-boxes/DebianSqueeze64.box'
debian_like_configs.call debian
configure_private_network.call debian, 12
end
config.vm.define :centos do |centos|
centos.vm.box = 'centos6_64'
centos.vm.box_url = 'http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box'
configure_private_network.call centos, 13
# Here we have the RubyGems cache bucket configured to the right path, so we
# bundle the project
centos.vm.provision :shell, inline: '
@ -100,8 +105,24 @@ Vagrant.configure("2") do |config|
config.vm.define :arch do |arch|
arch.vm.box = 'arch64'
arch.vm.box_url = 'http://vagrant.pouss.in/archlinux_2012-07-02.box'
configure_private_network.call arch, 14
arch.vm.provision :shell, inline: '
pacman -Syu --noconfirm libffi git
HOME=/home/vagrant su -p vagrant -l -c "cd /vagrant && bundle"'
end
# Please note that we are not able to install chef on the VM, so when bringing
# this up we should always pass in `--provision-with=shell`
#
# TODO: Find out how to install chef on this or other box or find one that has
# it pre installed
config.vm.define :opensuse do |suse|
suse.vm.box = 'opensuse-12'
suse.vm.box_url = 'http://sourceforge.net/projects/opensusevagrant/files/12.3/opensuse-12.3-64.box/download'
configure_private_network.call suse, 15
suse.cache.enable_nfs = false
# This seems to not be working
suse.omnibus.chef_version = nil
suse.vm.provision :shell, inline: 'time zypper install -y git'
end
end

View file

@ -42,3 +42,4 @@ require_relative "bucket/rvm"
require_relative "bucket/apt_cacher"
require_relative "bucket/composer"
require_relative "bucket/npm"
require_relative "bucket/zypper"

View file

@ -0,0 +1,36 @@
module VagrantPlugins
module Cachier
class Bucket
class Zypper < Bucket
def self.capability
:zypper_cache_dir
end
def install
machine = @env[:machine]
guest = machine.guest
if guest.capability?(:zypper_cache_dir)
guest_path = guest.capability(:zypper_cache_dir)
@env[:cache_dirs] << guest_path
machine.communicate.tap do |comm|
# Ensure caching is enabled
comm.sudo("zypper modifyrepo --keep-packages --all")
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
unless comm.test("test -L #{guest_path}")
comm.sudo("rm -rf #{guest_path}")
comm.sudo("mkdir -p `dirname #{guest_path}`")
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
end
end
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Zypper')
end
end
end
end
end
end

View file

@ -0,0 +1,14 @@
module VagrantPlugins
module Cachier
module Cap
module SuSE
module ZypperCacheDir
def self.zypper_cache_dir(machine)
# TODO: Find out if there is a config file we can read from
'/var/cache/zypp/packages'
end
end
end
end
end
end

View file

@ -56,11 +56,20 @@ module VagrantPlugins
Cap::RedHat::YumCacheDir
end
guest_capability 'suse', 'yum_cache_dir' do
# Disable Yum on suse guests
end
guest_capability 'arch', 'pacman_cache_dir' do
require_relative 'cap/arch/pacman_cache_dir'
Cap::Arch::PacmanCacheDir
end
guest_capability 'suse', 'zypper_cache_dir' do
require_relative 'cap/suse/zypper_cache_dir'
Cap::SuSE::ZypperCacheDir
end
# 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|

View file

@ -1,5 +1,5 @@
module VagrantPlugins
module Cachier
VERSION = "0.4.2.dev"
VERSION = "0.5.0"
end
end