Compare commits

..

No commits in common. "master" and "v0.7.2" have entirely different histories.

44 changed files with 110 additions and 565 deletions

View file

@ -1,79 +1,3 @@
## [1.2.1](https://github.com/fgrehm/vagrant-cachier/compare/v1.2.0...v1.2.1) (July 3, 2015)
IMPROVEMENTS:
- Add chef\_zero support to chef bucket [[GH-153]]
[GH-153]: https://github.com/fgrehm/vagrant-cachier/issues/153
## [1.2.0](https://github.com/fgrehm/vagrant-cachier/compare/v1.1.0...v1.2.0) (Jan 14, 2015)
FEATURES:
- [Chef Gems bucket](http://fgrehm.viewdocs.io/vagrant-cachier/buckets/chef_rubygems) [[GH-129]]
[GH-129]: https://github.com/fgrehm/vagrant-cachier/pull/129
BUG FIXES:
- Fix provisioner resolution on Vagrant 1.7+ [[GH-133]] / [[GH-134]]
- Do not modify Vagrant core object, preventing unpredictable behavior [[GH-135]]
[GH-133]: https://github.com/fgrehm/vagrant-cachier/issues/133
[GH-134]: https://github.com/fgrehm/vagrant-cachier/pull/134
[GH-135]: https://github.com/fgrehm/vagrant-cachier/pull/135
## [1.1.0](https://github.com/fgrehm/vagrant-cachier/compare/v1.0.0...v1.1.0) (Oct 15, 2014)
FEATURES:
- [Bower bucket](http://fgrehm.viewdocs.io/vagrant-cachier/buckets/bower) [[GH-125]]
[GH-125]: https://github.com/fgrehm/vagrant-cachier/pull/125
IMPROVEMENTS:
- Resolve $HOME even if VM spits bogus new lines [[GH-122]] / [[GH-124]]
[GH-122]: https://github.com/fgrehm/vagrant-cachier/issues/122
[GH-124]: https://github.com/fgrehm/vagrant-cachier/pull/124
## [1.0.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.9.0...v1.0.0) (Sep 22, 2014)
Public API is considered stable.
## [0.9.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.8.0...v0.9.0) (Aug 9, 2014)
FEATURES:
- Suport for caching packages for Docker containers that doesn't have a base box specified [[GH-116]]
[GH-116]: https://github.com/fgrehm/vagrant-cachier/pull/116
## [0.8.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.7.2...v0.8.0) (Jul 20, 2014)
BACKWARDS INCOMPATIBILITIES:
- Removed deprecated `config.enable_nfs` config.
- Changed composer cache bucket to use `$HOME/.composer/cache` [[GH-89]]
IMPROVEMENTS:
- Set composer cache bucket ownership to the configured SSH user.
BUG FIXES:
- Automatically disable apt-lists bucket when a Windows host is detected [[GH-106]]
- Skip `chmod 777` for `smb` mounted folders [[GH-107]]
- Do not error if base box has been removed and `:box` is configured as the cache scope [[GH-86]]
[GH-86]: https://github.com/fgrehm/vagrant-cachier/issues/86
[GH-89]: https://github.com/fgrehm/vagrant-cachier/issues/89
[GH-106]: https://github.com/fgrehm/vagrant-cachier/issues/106
[GH-107]: https://github.com/fgrehm/vagrant-cachier/issues/107
## [0.7.2](https://github.com/fgrehm/vagrant-cachier/compare/v0.7.1...v0.7.2) (May 08, 2014)
IMPROVEMENTS:

View file

@ -1,13 +1,14 @@
source 'https://rubygems.org'
group :development do
gem 'vagrant', github: 'mitchellh/vagrant', tag: 'v1.7.2'
gem 'vagrant', github: 'mitchellh/vagrant', tag: 'v1.5.2'
gem 'rake'
end
group :plugins do
gemspec
gem 'vagrant-lxc', github: 'fgrehm/vagrant-lxc'
gem 'vagrant-pristine', github: 'fgrehm/vagrant-pristine'
gem 'vagrant-lxc', github: 'fgrehm/vagrant-lxc'
gem 'vagrant-pristine', github: 'fgrehm/vagrant-pristine'
gem 'vagrant-global-status', github: 'fgrehm/vagrant-global-status'
gem 'vagrant-omnibus'
end

View file

@ -1,8 +1,14 @@
GIT
remote: git://github.com/fgrehm/vagrant-global-status.git
revision: 6a93c79c7595b76392a2b559674985eabc004aa8
specs:
vagrant-global-status (0.1.5.dev)
GIT
remote: git://github.com/fgrehm/vagrant-lxc.git
revision: c9cd671a32f730fff4b6e4fdd3687a531af0663c
revision: 3bd22955dd26d814f05f51e9f6a196d066985cd2
specs:
vagrant-lxc (1.1.0)
vagrant-lxc (1.0.0.alpha.2.dev)
GIT
remote: git://github.com/fgrehm/vagrant-pristine.git
@ -12,108 +18,53 @@ GIT
GIT
remote: git://github.com/mitchellh/vagrant.git
revision: 1cd667b243f4a263cd5322b6455165cc676b6f7f
tag: v1.7.2
revision: 5b360d0990f0f6fb286dadf65581c345c55d3b32
tag: v1.5.2
specs:
vagrant (1.7.2)
bundler (>= 1.5.2, < 1.8.0)
vagrant (1.5.2)
bundler (~> 1.5.2)
childprocess (~> 0.5.0)
erubis (~> 2.7.0)
hashicorp-checkpoint (~> 0.1.1)
i18n (~> 0.6.0)
listen (~> 2.8.0)
listen (~> 2.4.0)
log4r (~> 1.1.9, < 1.1.11)
net-scp (~> 1.1.0)
net-sftp (~> 2.1)
net-ssh (>= 2.6.6, < 2.10.0)
nokogiri (= 1.6.3.1)
net-ssh (>= 2.6.6, < 2.8.0)
rb-kqueue (~> 0.2.0)
rest-client (>= 1.6.0, < 2.0)
wdm (~> 0.1.0)
winrm (~> 1.1.3)
PATH
remote: .
specs:
vagrant-cachier (0.7.2)
GEM
remote: https://rubygems.org/
specs:
akami (1.2.2)
gyoku (>= 0.4.0)
nokogiri
builder (3.2.2)
celluloid (0.16.0)
timers (~> 4.0.0)
childprocess (0.5.5)
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
erubis (2.7.0)
ffi (1.9.6)
gssapi (1.0.3)
ffi (>= 1.0.1)
gyoku (1.2.2)
builder (>= 2.1.2)
hashicorp-checkpoint (0.1.4)
hitimes (1.2.2)
httpclient (2.6.0.1)
httpi (0.9.7)
rack
i18n (0.6.11)
listen (2.8.5)
ffi (1.9.3)
i18n (0.6.9)
listen (2.4.1)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
little-plugger (1.1.3)
log4r (1.1.10)
logging (1.8.2)
little-plugger (>= 1.1.3)
multi_json (>= 1.8.4)
mime-types (2.4.3)
mini_portile (0.6.0)
multi_json (1.10.1)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.9.2)
netrc (0.10.2)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
nori (1.1.5)
rack (1.6.0)
rake (10.4.2)
net-ssh (2.7.0)
rake (10.3.1)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rb-inotify (0.9.4)
ffi (>= 0.5.0)
rb-kqueue (0.2.3)
rb-kqueue (0.2.2)
ffi (>= 0.5.0)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rubyntlm (0.1.1)
savon (0.9.5)
akami (~> 1.0)
builder (>= 2.1.2)
gyoku (>= 0.4.0)
httpi (~> 0.9)
nokogiri (>= 1.4.0)
nori (~> 1.0)
wasabi (~> 1.0)
timers (4.0.1)
hitimes
uuidtools (2.1.5)
timers (1.1.0)
vagrant-omnibus (1.4.1)
wasabi (1.0.0)
nokogiri (>= 1.4.0)
wdm (0.1.0)
winrm (1.1.3)
gssapi (~> 1.0.0)
httpclient (~> 2.2, >= 2.2.0.2)
logging (~> 1.6, >= 1.6.1)
nokogiri (~> 1.5)
rubyntlm (~> 0.1.1)
savon (= 0.9.5)
uuidtools (~> 2.1.2)
PLATFORMS
ruby
@ -122,9 +73,7 @@ DEPENDENCIES
rake
vagrant!
vagrant-cachier!
vagrant-global-status!
vagrant-lxc!
vagrant-omnibus
vagrant-pristine!
BUNDLED WITH
1.10.4

View file

@ -1,19 +1,14 @@
🟢 We plan to support and maintain vagrant-lxc, as well as clean it up.<br/>
🟢 Please feel free to contribute Issues and pull requests.<br/>
🟢 P.S: Thanks [Fabio Rehm](https://fabiorehm.com) for the amazing initial project.
--------
# vagrant-cachier
[![Gem Version](https://badge.fury.io/rb/vagrant-cachier.png)](http://badge.fury.io/rb/vagrant-cachier) [![Gitter chat](https://badges.gitter.im/fgrehm/vagrant-cachier.png)](https://gitter.im/fgrehm/vagrant-cachier)
[![Gem Version](https://badge.fury.io/rb/vagrant-cachier.png)](http://badge.fury.io/rb/vagrant-cachier) [![Gittip](http://img.shields.io/gittip/fgrehm.svg)](https://www.gittip.com/fgrehm/)
A [Vagrant](http://www.vagrantup.com/) plugin that helps you reduce the amount of
coffee you drink while waiting for boxes to be provisioned by sharing a common
package cache among similar VM instances. Kinda like [vagrant-apt_cache](https://github.com/avit/vagrant-apt_cache)
or [this magical snippet](http://gist.github.com/juanje/3797297) but targeting
package cache among similiar VM instances. Kinda like [vagrant-apt_cache](https://github.com/avit/vagrant-apt_cache)
or [this magical snippet](http://gist.github.com/juanje/3797297) but targetting
multiple package managers and Linux distros.
## Installation
Make sure you have Vagrant 1.4+ and run:
@ -32,9 +27,9 @@ Vagrant.configure("2") do |config|
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
config.cache.scope = :box
# OPTIONAL: If you are using VirtualBox, you might want to use that to enable
# NFS for shared folders. This is also very useful for vagrant-libvirt if you
# want bi-directional sync
# If you are using VirtualBox, you might want to use that to enable NFS for
# shared folders. This is also very useful for vagrant-libvirt if you want
# bi-directional sync
config.cache.synced_folder_opts = {
type: :nfs,
# The nolock option can be useful for an NFSv3 client that wants to avoid the
@ -54,14 +49,12 @@ http://fgrehm.viewdocs.io/vagrant-cachier.
## Providers that are known to work
* Vagrant's built in VirtualBox and Docker providers
* Vagrant's built in VirtualBox provider
* [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc)
* [VMware providers](http://www.vagrantup.com/vmware) with NFS enabled (See
[GH-24](https://github.com/fgrehm/vagrant-cachier/issues/24) for more info)
* [vagrant-parallels](https://github.com/Parallels/vagrant-parallels)
* [vagrant-libvirt](https://github.com/pradels/vagrant-libvirt)
* [vagrant-kvm](https://github.com/adrahon/vagrant-kvm)
* _[Let us know if it is compatible with other providers!](https://github.com/fgrehm/vagrant-cachier/issues/new)_
* [docker-provider](https://github.com/fgrehm/docker-provider)
* _[Let me know if it is compatible with other providers!](https://github.com/fgrehm/vagrant-cachier/issues/new)_
_Please note that as of v0.6.0 the plugin will automatically disable any
previously defined configs for [cloud providers](lib/vagrant-cachier/plugin.rb#L19-22)_

View file

@ -16,12 +16,3 @@ Vagrant.configure("2") do |config|
config.cache.enable :apt_lists
end
```
## Heads up!
This bucket is automatically disabled for Windows hosts, please have a look at
the following issues for more information:
* https://github.com/fgrehm/vagrant-cachier/issues/106
* https://github.com/fgrehm/vagrant-cachier/issues/109
* https://github.com/fgrehm/vagrant-cachier/issues/113

View file

@ -1,13 +0,0 @@
# [Bower](http://bower.io/)
Compatible with probably any type of linux guest distro, will cache guests'
`$HOME/.cache/bower` if bower is detected.
To manually enable it:
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-bower-installed'
config.cache.enable :bower
end
```

View file

@ -1,18 +0,0 @@
# Chef RubyGems
When a Chef installation is detected, this bucket caches its embedded gems.
Most of these gems are part of the Chef omnibus package but sometimes cookbooks
need to install extra gems to run within the context of a Chef recipe using the
`chef_gem` resource.
The embedded Chef gem location is returned by running the
`/opt/chef/embedded/bin/gem env gemdir` command.
To manually enable it:
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'some-box-using-chef-provisioner'
config.cache.enable :chef_gem
end
```

View file

@ -1,7 +1,7 @@
# [Composer](http://getcomposer.org/)
Compatible with probably any type of linux guest distro, will cache guests'
`$HOME/.composer/cache` if PHP is detected.
`$HOME/.composer` if PHP is detected.
To manually enable it:

View file

@ -1,20 +0,0 @@
# DNF
Used by Fedora guests, will get configured under guest's `/var/cache/dnf`. It will
also [make sure](lib/vagrant-cachier/bucket/dnf.rb#L20) that `keepcache` is set to
`1` on guest's `/etc/dnf/dnf.conf`.
To manually enable it:
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'some-fedora-box'
config.cache.enable :dnf
end
```
### :warning: Notice about Windows hosts :warning:
In case this bucket is enabled and a Windows host is in use, you might see an
ugly stacktrace as described on [this comment](https://github.com/fgrehm/vagrant-cachier/issues/117#issuecomment-50548393)
if some DNF repository is not available during provisioning.

View file

@ -1,15 +0,0 @@
# [pip](https://pip.pypa.io/)
Compatible with probably any type of linux guest distro, will hook into pip's
http and wheels cache directory under `$HOME/.cache/pip/http` and `$HOME/.cache/pip/wheels` as
the default SSH user (usually `vagrant`) on your guest.
To manually enable it:
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-pip-installed'
config.cache.enable :pip
end
```

View file

@ -12,9 +12,3 @@ Vagrant.configure("2") do |config|
config.cache.enable :yum
end
```
### :warning: Notice about Windows hosts :warning:
In case this bucket is enabled and a Windows host is in use, you might see an
ugly stacktrace as described on [this comment](https://github.com/fgrehm/vagrant-cachier/issues/117#issuecomment-50548393)
if some Yum repository is not available during provisioning.

View file

@ -11,7 +11,7 @@ Regarding configurations, right now the plugin does not make any assumptions for
you and you have to configure things properly from your `Vagrantfile`. In other
words, _the plugin is disabled by default_.
Cache buckets will always be available from `/tmp/vagrant-cache` on your guest and
Cache buckets will always be available from `/tmp/vagrant-cachier` on your guest and
the appropriate folders will get symlinked to the right path _after_ the machine is
up but _right before_ it gets provisioned. We _could_ potentially do it on one go
and share bucket's folders directly to the right path if we were only using VirtualBox

View file

@ -28,9 +28,9 @@ Vagrant.configure("2") do |config|
# More info on the "Usage" link above
config.cache.scope = :box
# OPTIONAL: If you are using VirtualBox, you might want to use that to enable
# NFS for shared folders. This is also very useful for vagrant-libvirt if you
# want bi-directional sync
# If you are using VirtualBox, you might want to use that to enable NFS for
# shared folders. This is also very useful for vagrant-libvirt if you want
# bi-directional sync
config.cache.synced_folder_opts = {
type: :nfs,
# The nolock option can be useful for an NFSv3 client that wants to avoid the

View file

@ -87,25 +87,18 @@
<li><a tabindex="-1" href="buckets/apt-lists">apt-lists</a></li>
<li><a tabindex="-1" href="buckets/apt-cacher">apt-cacher</a></li>
<li><a tabindex="-1" href="buckets/chef">Chef</a></li>
<li><a tabindex="-1" href="buckets/chef_rubygems">Chef Gems</a></li>
<li><a tabindex="-1" href="buckets/composer">Composer</a></li>
<li><a tabindex="-1" href="buckets/dnf">DNF</a></li>
<li><a tabindex="-1" href="buckets/bower">Bower</a></li>
<li><a tabindex="-1" href="buckets/pacman">Pacman</a></li>
<li><a tabindex="-1" href="buckets/npm">npm</a></li>
<li><a tabindex="-1" href="buckets/rubygems">RubyGems</a></li>
<li><a tabindex="-1" href="buckets/rvm">rvm</a></li>
<li><a tabindex="-1" href="buckets/yum">Yum</a></li>
<li><a tabindex="-1" href="buckets/zypper">Zypper</a></li>
<li><a tabindex="-1" href="buckets/pip">pip</a></li>
</ul>
</li>
<li>
<a href="development">Development</a>
</li>
<li>
<li><a href="https://gitter.im/fgrehm/vagrant-cachier" target="_blank">Chat</li>
</li>
</ul>
<ul class="nav navbar-nav navbar-right visible-md visible-lg">

View file

@ -33,34 +33,13 @@ module VagrantPlugins
def cache_root
@cache_root ||= case @env[:machine].config.cache.scope.to_sym
when :box
@box_name = box_name
# Box is optional with docker provider
if @box_name.nil? && @env[:machine].provider_name.to_sym == :docker
@image_name = image_name
# Use the image name if it's set
if @image_name
bucket_name = @image_name.gsub(':', '-')
else
raise "Cachier plugin only supported with docker provider when image is used"
end
else
bucket_name = @box_name
end
@env[:home_path].join('cache', bucket_name)
@env[:home_path].join('cache', @env[:machine].box.name)
when :machine
@env[:machine].data_dir.parent.join('cache')
else
raise "Unknown cache scope: '#{@env[:machine].config.cache.scope}'"
end
end
def box_name
@env[:machine].config.vm.box
end
def image_name
@env[:machine].provider_config.image
end
end
end
end

View file

@ -20,13 +20,8 @@ module VagrantPlugins
end
def chmod_bucket_root(machine)
machine.communicate.sudo 'mkdir -p /tmp/vagrant-cache'
# https://github.com/fgrehm/vagrant-cachier/issues/107
if ! smb_synced_folder_enabled?(machine)
@logger.info "'chmod'ing bucket root dir to 777..."
machine.communicate.sudo 'chmod 777 /tmp/vagrant-cache'
end
@logger.info "'chmod'ing bucket root dir to 777..."
machine.communicate.sudo 'mkdir -p /tmp/vagrant-cache && chmod 777 /tmp/vagrant-cache'
end
def configure_cache_buckets(env)
@ -46,20 +41,6 @@ module VagrantPlugins
data_file = env[:machine].data_dir.join('cache_dirs')
data_file.open('w') { |f| f.print env[:cache_dirs].uniq.join("\n") }
end
def smb_synced_folder_enabled?(machine)
synced_folder_opts = machine.config.cache.synced_folder_opts
synced_folder_opts ||= {}
# If smb was explicitly enabled
if synced_folder_opts[:type] && synced_folder_opts[:type].to_s == 'smb'
return true
elsif machine.provider_name.to_sym == :hyperv
# If the provider in use is hyperv, the default synced folder is 'smb'
# unless specified
return synced_folder_opts[:type] == nil
end
end
end
end
end

View file

@ -43,13 +43,13 @@ module VagrantPlugins
end
# TODO: "merge" symlink and user_symlink methods
def symlink(guest_path, bucket_path = "/tmp/vagrant-cache/#{@name}")
def symlink(guest_path, bucket_path = "/tmp/vagrant-cache/#{@name}", create_parent: true)
return if @env[:cache_dirs].include?(guest_path)
@env[:cache_dirs] << guest_path
comm.execute("mkdir -p #{bucket_path}")
unless symlink?(guest_path)
comm.sudo("mkdir -p `dirname #{guest_path}`")
comm.sudo("mkdir -p `dirname #{guest_path}`") if create_parent
if empty_dir?(bucket_path) && !empty_dir?(guest_path)
# Warm up cache with guest machine data
comm.sudo("shopt -s dotglob && mv #{guest_path}/* #{bucket_path}")
@ -90,16 +90,12 @@ end
require_relative "bucket/apt"
require_relative "bucket/chef"
require_relative "bucket/gem"
require_relative "bucket/chef_gem"
require_relative "bucket/pacman"
require_relative "bucket/yum"
require_relative "bucket/dnf"
require_relative "bucket/rvm"
require_relative "bucket/apt_cacher"
require_relative "bucket/apt_lists"
require_relative "bucket/composer"
require_relative "bucket/bower"
require_relative "bucket/npm"
require_relative "bucket/zypper"
require_relative "bucket/generic"
require_relative "bucket/pip"

View file

@ -7,10 +7,6 @@ module VagrantPlugins
end
def install
# Apt lists bucket can't be used on windows hosts
# https://github.com/fgrehm/vagrant-cachier/issues/106
return if Vagrant::Util::Platform.windows?
if guest.capability?(:apt_lists_dir)
guest_path = guest.capability(:apt_lists_dir)

View file

@ -1,21 +0,0 @@
module VagrantPlugins
module Cachier
class Bucket
class Bower < Bucket
def self.capability
:bower_path
end
def install
if guest.capability?(:bower_path)
if bower_path = guest.capability(:bower_path)
user_symlink(bower_path)
end
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Bower')
end
end
end
end
end
end

View file

@ -1,25 +0,0 @@
module VagrantPlugins
module Cachier
class Bucket
class ChefGem < Bucket
def self.capability
:chef_gemdir
end
def install
if guest.capability?(:chef_gemdir)
if gemdir_path = guest.capability(:chef_gemdir)
prefix = gemdir_path.split('/').last
bucket_path = "/tmp/vagrant-cache/#{@name}/#{prefix}"
gem_cache_path = "#{gemdir_path}/cache"
symlink(gem_cache_path, bucket_path)
end
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'ChefRubyGems')
end
end
end
end
end
end

View file

@ -9,7 +9,7 @@ module VagrantPlugins
def install
if guest.capability?(:composer_path)
if composer_path = guest.capability(:composer_path)
user_symlink(composer_path)
symlink(composer_path, create_parent: false)
end
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Composer')

View file

@ -1,27 +0,0 @@
module VagrantPlugins
module Cachier
class Bucket
class Dnf < Bucket
def self.capability
:dnf_cache_dir
end
def install
if guest.capability?(:dnf_cache_dir)
if guest_path = guest.capability(:dnf_cache_dir)
return if @env[:cache_dirs].include?(guest_path)
# Ensure caching is enabled
comm.sudo("sed -i '/keepcache=/d' /etc/dnf/dnf.conf")
comm.sudo("sed -i '/^[main]/a keepcache=1' /etc/dnf/dnf.conf")
symlink(guest_path)
end
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'DNF')
end
end
end
end
end
end

View file

@ -1,22 +0,0 @@
module VagrantPlugins
module Cachier
class Bucket
class Pip < Bucket
def self.capability
:pip_cache_dir
end
def install
if guest.capability?(:pip_cache_dir)
if guest_path = guest.capability(:pip_cache_dir)
symlink("#{guest_path}/http", "/tmp/vagrant-cache/#{@name}/http")
symlink("#{guest_path}/wheels", "/tmp/vagrant-cache/#{@name}/wheels")
end
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'pip')
end
end
end
end
end
end

View file

@ -8,14 +8,13 @@ module VagrantPlugins
def install
if guest.capability?(:yum_cache_dir)
if guest_path = guest.capability(:yum_cache_dir)
return if @env[:cache_dirs].include?(guest_path)
guest_path = guest.capability(:yum_cache_dir)
return if @env[:cache_dirs].include?(guest_path)
# Ensure caching is enabled
comm.sudo("sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf")
# Ensure caching is enabled
comm.sudo("sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf")
symlink(guest_path)
end
symlink(guest_path)
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Yum')
end

View file

@ -4,6 +4,7 @@ module VagrantPlugins
module Arch
module PacmanCacheDir
def self.pacman_cache_dir(machine)
# TODO: Find out if there is a config file we can read from
'/var/cache/pacman/pkg'
end
end

View file

@ -4,6 +4,7 @@ module VagrantPlugins
module Debian
module AptCacheDir
def self.apt_cache_dir(machine)
# TODO: Find out if there is a config file we can read from
'/var/cache/apt/archives'
end
end

View file

@ -1,20 +0,0 @@
module VagrantPlugins
module Cachier
module Cap
module Linux
module BowerPath
def self.bower_path(machine)
bower_path = nil
machine.communicate.tap do |comm|
return unless comm.test('which bower')
comm.execute 'echo $HOME' do |buffer, output|
bower_path = output.chomp if buffer == :stdout
end
end
return "#{bower_path}/.cache/bower"
end
end
end
end
end
end

View file

@ -5,8 +5,8 @@ module VagrantPlugins
module ChefFileCachePath
def self.chef_provisioner?(machine)
provisioners = machine.config.vm.provisioners
chef_provisioners = [:chef_solo, :chef_client, :chef_zero]
compat_provisioners = provisioners.select { |p| chef_provisioners.include? p.name || p.type }
chef_provisioners = [:chef_solo, :chef_client]
compat_provisioners = provisioners.keep_if { |p| chef_provisioners.include? p.name }
if compat_provisioners.size > 1
raise "One machine is using multiple chef provisioners, which is unsupported."
@ -19,6 +19,7 @@ module VagrantPlugins
def self.chef_file_cache_path(machine)
chef_file_cache_path = nil
# TODO: Determine paths rather than using default.
chef_file_cache_path = '/var/chef/cache' if chef_provisioner?(machine)
return chef_file_cache_path

View file

@ -1,20 +0,0 @@
module VagrantPlugins
module Cachier
module Cap
module Linux
module ChefGemdir
def self.chef_gemdir(machine)
gemdir = nil
machine.communicate.tap do |comm|
return unless comm.test('test -f /opt/chef/embedded/bin/gem')
comm.execute '/opt/chef/embedded/bin/gem env gemdir' do |buffer, output|
gemdir = output.chomp if buffer == :stdout
end
end
return gemdir
end
end
end
end
end
end

View file

@ -7,14 +7,11 @@ module VagrantPlugins
composer_path = nil
machine.communicate.tap do |comm|
return unless comm.test('which php')
# on some VMs an extra new line seems to come out, so we loop over
# the output just in case
composer_path = ''
comm.execute 'echo $HOME' do |buffer, output|
composer_path += output.chomp if buffer == :stdout
composer_path = output.chomp if buffer == :stdout
end
end
return "#{composer_path}/.composer/cache"
return "#{composer_path}/.composer"
end
end
end

View file

@ -1,20 +0,0 @@
module VagrantPlugins
module Cachier
module Cap
module Linux
module PipCacheDir
def self.pip_cache_dir(machine)
pip_cache_dir = nil
machine.communicate.tap do |comm|
return unless comm.test('which pip')
comm.execute 'echo $HOME' do |buffer, output|
pip_cache_dir = output.chomp if buffer == :stdout
end
end
return "#{pip_cache_dir}/.cache/pip"
end
end
end
end
end
end

View file

@ -1,18 +0,0 @@
module VagrantPlugins
module Cachier
module Cap
module RedHat
module DnfCacheDir
def self.dnf_cache_dir(machine)
dnf_cache_dir = nil
machine.communicate.tap do |comm|
return unless comm.test('which dnf')
dnf_cache_dir = '/var/cache/dnf'
end
return dnf_cache_dir
end
end
end
end
end
end

View file

@ -4,13 +4,8 @@ module VagrantPlugins
module RedHat
module YumCacheDir
def self.yum_cache_dir(machine)
yum_cache_dir = nil
machine.communicate.tap do |comm|
# In case yum is only forwarding to dnf do not cache
return unless not comm.test('yum --version 2>&1 | grep /usr/bin/dnf')
yum_cache_dir = '/var/cache/yum'
end
return yum_cache_dir
# TODO: Find out if there is a config file we can read from
'/var/cache/yum'
end
end
end

View file

@ -4,6 +4,7 @@ module VagrantPlugins
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

View file

@ -6,11 +6,6 @@ module VagrantPlugins
Cap::Linux::Gemdir
end
guest_capability 'linux', 'chef_gemdir' do
require_relative 'cap/linux/chef_gemdir'
Cap::Linux::ChefGemdir
end
guest_capability 'linux', 'rvm_path' do
require_relative 'cap/linux/rvm_path'
Cap::Linux::RvmPath
@ -21,11 +16,6 @@ module VagrantPlugins
Cap::Linux::ComposerPath
end
guest_capability 'linux', 'bower_path' do
require_relative 'cap/linux/bower_path'
Cap::Linux::BowerPath
end
guest_capability 'linux', 'chef_file_cache_path' do
require_relative 'cap/linux/chef_file_cache_path'
Cap::Linux::ChefFileCachePath
@ -36,11 +26,6 @@ module VagrantPlugins
Cap::Linux::NpmCacheDir
end
guest_capability 'linux', 'pip_cache_dir' do
require_relative 'cap/linux/pip_cache_dir'
Cap::Linux::PipCacheDir
end
guest_capability 'debian', 'apt_cache_dir' do
require_relative 'cap/debian/apt_cache_dir'
Cap::Debian::AptCacheDir
@ -61,11 +46,6 @@ module VagrantPlugins
Cap::RedHat::YumCacheDir
end
guest_capability 'redhat', 'dnf_cache_dir' do
require_relative 'cap/redhat/dnf_cache_dir'
Cap::RedHat::DnfCacheDir
end
guest_capability 'suse', 'yum_cache_dir' do
# Disable Yum on suse guests
end

View file

@ -17,6 +17,14 @@ module VagrantPlugins
(@buckets ||= {})[bucket] = opts
end
def enable_nfs=(value)
@ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \
"and will be removed on 0.7.0, please use " \
"`synced_folder_opts = { type: :nfs }` instead.\n"
@synced_folder_opts = { type: :nfs } if value
end
def validate(machine)
errors = _detected_errors

View file

@ -1,3 +1,5 @@
# 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
@ -18,7 +20,7 @@ module VagrantPlugins
# Keep an eye on https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins#wiki-providers
# for more.
CLOUD_PROVIDERS = %w( aws cloudstack digitalocean hp joyent openstack rackspace
softlayer proxmox managed azure brightbox cloudstack vcloud
softlayer proxmox managed azure brightbox cloudstack vcloud
vsphere )
end
end

View file

@ -1,5 +1,5 @@
module VagrantPlugins
module Cachier
VERSION = "1.2.1"
VERSION = "0.7.2"
end
end

View file

@ -9,6 +9,11 @@ en:
nfs_required: |-
The '%{bucket}' cache bucket requires NFS to be enabled, please add
`config.cache.synced_folder_opts = {type: :nfs}` 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
'%{new_path}' as it is the new path for keeping machine
scoped cache dirs starting with the 0.3.0 version of the plugin.
unable_to_ssh: |-
vagrant-cachier was unable to SSH into the VM to remove symlinks!
backed_by_cloud_provider: |-

View file

@ -1,14 +1,10 @@
Vagrant.require_plugin 'vagrant-cachier'
Vagrant.require_plugin 'vagrant-lxc'
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |_, override|
override.vm.box = "chef/ubuntu-14.04"
end
config.vm.provider :lxc do |_, override|
override.vm.box = "fgrehm/trusty64-lxc"
end
config.cache.auto_detect = true
config.cache.scope = :machine
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
config.vm.provision :shell, inline: 'apt-get update && apt-get install -y git'
end

View file

@ -1,12 +1,8 @@
Vagrant.require_plugin 'vagrant-cachier'
Vagrant.require_plugin 'vagrant-lxc'
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |_, override|
override.vm.box = "chef/ubuntu-14.04"
end
config.vm.provider :lxc do |_, override|
override.vm.box = "fgrehm/trusty64-lxc"
end
config.cache.auto_detect = true
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
config.vm.provision :shell, inline: 'echo Hello!'
end

View file

@ -1,8 +1,6 @@
Vagrant.require_plugin 'vagrant-cachier'
Vagrant.require_plugin 'vagrant-lxc'
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |_, override|
override.vm.box = "chef/ubuntu-14.04"
end
config.vm.provider :lxc do |_, override|
override.vm.box = "fgrehm/trusty64-lxc"
end
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
end

View file

@ -1,10 +1,7 @@
Vagrant.require_plugin 'vagrant-cachier'
Vagrant.require_plugin 'vagrant-lxc'
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |_, override|
override.vm.box = "chef/ubuntu-14.04"
end
config.vm.provider :lxc do |_, override|
override.vm.box = "fgrehm/trusty64-lxc"
end
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
config.vm.provision :shell, inline: 'echo Hello!'
end

View file

@ -17,4 +17,14 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.post_install_message = %q{
If you are new to vagrant-cachier just follow along with the docs available
at http://fgrehm.viewdocs.io/vagrant-cachier.
If you are a long time user, please note that plugin has gone through many
backwards incompatible changes since 0.6.0 so checkout
https://github.com/fgrehm/vagrant-cachier/blob/master/CHANGELOG.md
before continuing and caching all the things :)
}
end