Merge pull request #47 from fgrehm/0.4.0

Say hi to 0.4.0
This commit is contained in:
Fabio Rehm 2013-10-23 17:28:34 -07:00
commit d558a0ac7f
6 changed files with 43 additions and 14 deletions

View file

@ -1,9 +1,15 @@
## [0.4.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.3.3...v0.4.0) (unreleased) ## [0.4.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.3.3...v0.4.0) (Oct 23, 2013)
FEATURES: FEATURES:
- Support for [npm](https://npmjs.org/) [GH-51]
- Support for [Composer](http://getcomposer.org/) [GH-48]
- Support for `apt-cacher-ng` [GH-30] - Support for `apt-cacher-ng` [GH-30]
BUG FIXES:
- Allow halting nonresponsive machine when plugin is installed [GH-8]
## [0.3.3](https://github.com/fgrehm/vagrant-cachier/compare/v0.3.2...v0.3.3) (Sep 11, 2013) ## [0.3.3](https://github.com/fgrehm/vagrant-cachier/compare/v0.3.2...v0.3.3) (Sep 11, 2013)
BUG FIXES: BUG FIXES:

View file

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

View file

@ -208,7 +208,7 @@ folder under the result of running `rvm info` as the default SSH user (usualy
it is already installed before enabling the bucket, otherwise you won't benefit it is already installed before enabling the bucket, otherwise you won't benefit
from this plugin. from this plugin.
#### npm #### [npm](https://npmjs.org/)
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
@ -225,6 +225,18 @@ If you use
on the guest machine, make sure it is already installed before enabling on the guest machine, make sure it is already installed before enabling
the bucket, otherwise you won't benefit from this plugin. the bucket, otherwise you won't benefit from this plugin.
#### [Composer](http://getcomposer.org/)
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-php-installed'
config.cache.enable :composer
end
```
Compatible with probably any type of linux guest distro, will cache guests'
`$HOME/.composer` if PHP is detected.
##### APT-CACHER ##### APT-CACHER
```ruby ```ruby
@ -234,7 +246,10 @@ Vagrant.configure("2") do |config|
end end
``` ```
This is useful, if you are using containers inside your VMs, e.g VirtualBox -> LXC. This would allow you to reuse packages without sharing folder inside VirtualBox. Only works with NFS-shared folders (since `vboxsf` is enforcing `vagrant`-user and `apt-cacher` is running under `apt-cacher-ng` user) This is useful, if you are using containers inside your VMs, e.g VirtualBox -> LXC.
This would allow you to reuse packages without sharing folder inside VirtualBox. Only
works with NFS-shared folders (since `vboxsf` is enforcing `vagrant`-user and `apt-cacher`
is running under `apt-cacher-ng` user)
# install apt-cacher on (Host)-VM # install apt-cacher on (Host)-VM
$ sudo apt-get install apt-cacher-ng $ sudo apt-get install apt-cacher-ng

View file

@ -1,4 +1,5 @@
# Apt-Cacher NG is a caching proxy for software packages which are downloaded by Unix/Linux system distribution mechanisms from mirror servers accessible via HTTP. # Apt-Cacher NG is a caching proxy for software packages which are downloaded by
# Unix/Linux system distribution mechanisms from mirror servers accessible via HTTP.
module VagrantPlugins module VagrantPlugins
module Cachier module Cachier
class Bucket class Bucket
@ -12,17 +13,21 @@ module VagrantPlugins
guest = machine.guest guest = machine.guest
if guest.capability?(:apt_cacher_dir) if guest.capability?(:apt_cacher_dir)
guest_path = guest.capability(:apt_cacher_dir) if machine.config.cache.enable_nfs
guest_path = guest.capability(:apt_cacher_dir)
@env[:cache_dirs] << guest_path @env[:cache_dirs] << guest_path
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}") comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
unless comm.test("test -L #{guest_path}") unless comm.test("test -L #{guest_path}")
comm.sudo("rm -rf #{guest_path}") comm.sudo("rm -rf #{guest_path}")
comm.sudo("mkdir -p `dirname #{guest_path}`") comm.sudo("mkdir -p `dirname #{guest_path}`")
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}") comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
end
end end
else
@env[:ui].info I18n.t('vagrant_cachier.nfs_required', bucket: 'apt-cacher')
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher') @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher')

View file

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

View file

@ -6,6 +6,9 @@ en:
Skipping %{bucket} cache bucket as the guest machine does not support it Skipping %{bucket} cache bucket as the guest machine does not support it
unknown_cache_scope: |- unknown_cache_scope: |-
Unknown cache scope '%{cache_scope}' (allowed scopes: %{allowed}) Unknown cache scope '%{cache_scope}' (allowed scopes: %{allowed})
nfs_required: |-
The '%{bucket}' cache bucket requires NFS to be enabled, please add
`config.cache.enable_nfs = true` to your Vagrantfile.
will_fix_machine_cache_dir: |- will_fix_machine_cache_dir: |-
A vagrant-cachier provider specific cache dir was found under A vagrant-cachier provider specific cache dir was found under
'%{current_path}' and it will be moved to '%{current_path}' and it will be moved to