diff --git a/CHANGELOG.md b/CHANGELOG.md index 082f9ed..31eb711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: + - Support for [npm](https://npmjs.org/) [GH-51] + - Support for [Composer](http://getcomposer.org/) [GH-48] - 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) BUG FIXES: diff --git a/Gemfile.lock b/Gemfile.lock index ffc6056..1c5beff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GIT PATH remote: . specs: - vagrant-cachier (0.4.0.dev) + vagrant-cachier (0.4.0) GEM remote: https://rubygems.org/ diff --git a/README.md b/README.md index fae0eed..5771af2 100644 --- a/README.md +++ b/README.md @@ -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 from this plugin. -#### npm +#### [npm](https://npmjs.org/) ```ruby Vagrant.configure("2") do |config| @@ -225,6 +225,18 @@ If you use on the guest machine, make sure it is already installed before enabling 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 ```ruby @@ -234,7 +246,10 @@ Vagrant.configure("2") do |config| 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 $ sudo apt-get install apt-cacher-ng diff --git a/lib/vagrant-cachier/bucket/apt_cacher.rb b/lib/vagrant-cachier/bucket/apt_cacher.rb index de71661..3f4a194 100644 --- a/lib/vagrant-cachier/bucket/apt_cacher.rb +++ b/lib/vagrant-cachier/bucket/apt_cacher.rb @@ -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 Cachier class Bucket @@ -12,17 +13,21 @@ module VagrantPlugins guest = machine.guest 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| - 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}") + machine.communicate.tap do |comm| + 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.nfs_required', bucket: 'apt-cacher') end else @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher') diff --git a/lib/vagrant-cachier/version.rb b/lib/vagrant-cachier/version.rb index 552f73d..3abef5c 100644 --- a/lib/vagrant-cachier/version.rb +++ b/lib/vagrant-cachier/version.rb @@ -1,5 +1,5 @@ module VagrantPlugins module Cachier - VERSION = "0.4.0.dev" + VERSION = "0.4.0" end end diff --git a/locales/en.yml b/locales/en.yml index b8147ad..8badb39 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -6,6 +6,9 @@ en: Skipping %{bucket} cache bucket as the guest machine does not support it unknown_cache_scope: |- 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: |- A vagrant-cachier provider specific cache dir was found under '%{current_path}' and it will be moved to