vagrant-cachier 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e29dab2a44617162f50a1deb9d7876d29884703
4
- data.tar.gz: d59cd1552a6f2218c86fed45a181e0c89590a2e8
3
+ metadata.gz: aa1898e86e3760ce3e427d1d46ec53f4240a7f61
4
+ data.tar.gz: d0e4b10327abed29d0b4a4ac68e724f7a9eeb780
5
5
  SHA512:
6
- metadata.gz: e5918455a5a95171335c2544d78844cba773f3355f45067e46634808ecb91556b2862cf960a24a8db7ed8b3a9ff397f56bc7630e4d1e32f44b29a875bcbf2969
7
- data.tar.gz: 7160457fe320c9c600347290bade8ff2831756557a76554904d0106792ef0efdee1a9cee1275b5527bbd8fc555b984f55e8eae5cf54a8daabea30ae4a01167eb
6
+ metadata.gz: 25080e62dcbb8421053c858f5961415e88592de246a822f3909e23dc12609df91a181abd29a817e10c0d58d4d29bae4da7d7bef2d65ae38d00e7029c4a02d1f0
7
+ data.tar.gz: c3f6801886da3fa6e959deb9bfd59ddba73e9bcc711178ce3d301af59a241d41e7dfec53430ca4106326f1481d9cbe4e842d8f0d92496413c16d739c23949dbe
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.3.2](https://github.com/fgrehm/vagrant-cachier/compare/v0.3.1...v0.3.2) (Aug 14, 2013)
2
+
3
+ BUG FIXES:
4
+
5
+ - Prevent errors when caching is disabled and a provisioner is enabled [GH-41]
6
+
1
7
  ## [0.3.1](https://github.com/fgrehm/vagrant-cachier/compare/v0.3.0...v0.3.1) (Aug 13, 2013)
2
8
 
3
9
  BUG FIXES:
data/Gemfile.lock CHANGED
@@ -25,7 +25,7 @@ GIT
25
25
  PATH
26
26
  remote: .
27
27
  specs:
28
- vagrant-cachier (0.3.1)
28
+ vagrant-cachier (0.3.2)
29
29
 
30
30
  GEM
31
31
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -226,6 +226,25 @@ $ vagrant cache clean apt
226
226
  ```
227
227
 
228
228
 
229
+ ## Development
230
+
231
+ If you want to install the plugin from sources:
232
+
233
+ ```bash
234
+ git clone https://github.com/fgrehm/vagrant-cachier.git
235
+ cd vagrant-cachier
236
+ bundle install
237
+ bundle exec rake build
238
+ vagrant plugin install pkg/vagrant-cachier-VERSION.gem
239
+ ```
240
+
241
+ There are also some [Bats](https://github.com/sstephenson/bats) tests that basically
242
+ acts as a [sanity check](spec/acceptance/sanity_check.bats) that you can run with
243
+ `bats spec/acceptance` in case you are planning to submit a Pull Request :) Just
244
+ keep in mind that it might take a while to run if you are using the default
245
+ VirtualBox provider.
246
+
247
+
229
248
  ## Contributing
230
249
 
231
250
  1. Fork it
@@ -30,13 +30,27 @@ Vagrant.configure("2") do |config|
30
30
  }
31
31
  end
32
32
 
33
+ # Installs RVM
34
+ config.vm.provision :shell, inline: '
35
+ if ! [ -d /home/vagrant/.rvm ]; then
36
+ HOME=/home/vagrant su -p vagrant -l -c "curl -L https://get.rvm.io | bash -s stable"
37
+ fi
38
+ '
39
+
40
+ # Here we have the RVM cache bucket configured, so we install 2.0.0
41
+ config.vm.provision :shell, inline: '
42
+ if ! [ -d /home/vagrant/.rvm/rubies/ruby-1.9.3* ]; then
43
+ HOME=/home/vagrant su -p vagrant -l -c "rvm install 1.9.3 && rvm use 1.9.3 --default"
44
+ fi
45
+ '
46
+
33
47
  debian_like_configs = lambda do |debian|
48
+ # Here we have the RubyGems cache bucket configured to the right path, so we
49
+ # bundle the project
34
50
  debian.vm.provision :shell, inline: '
35
- if ! (which bundle > /dev/null); then
36
- sudo gem install bundler --no-ri --no-rdoc
37
- sudo apt-get install -y build-essential libffi-dev ruby1.9.1-dev git
38
- cd /vagrant && bundle
39
- fi'
51
+ sudo apt-get install git -y
52
+ HOME=/home/vagrant su -p vagrant -l -c "cd /vagrant && bundle"
53
+ '
40
54
  end
41
55
 
42
56
  config.vm.define :ubuntu do |ubuntu|
@@ -53,26 +67,19 @@ Vagrant.configure("2") do |config|
53
67
  config.vm.define :centos do |centos|
54
68
  centos.vm.box = 'centos6_64'
55
69
  centos.vm.box_url = 'http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box'
70
+ # Here we have the RubyGems cache bucket configured to the right path, so we
71
+ # bundle the project
56
72
  centos.vm.provision :shell, inline: '
57
- if ! (which bundle > /dev/null); then
58
- time sudo gem install bundler --no-ri --no-rdoc
59
- time sudo yum install -y libffi-devel ruby-devel git
60
- fi'
73
+ yum install -y libffi-devel ruby-devel git
74
+ HOME=/home/vagrant su -p vagrant -l -c "cd /vagrant && bundle"'
61
75
  end
62
76
 
63
77
  config.vm.define :arch do |arch|
64
78
  arch.vm.box = 'arch64'
65
79
  arch.vm.box_url = 'http://vagrant.pouss.in/archlinux_2012-07-02.box'
66
80
  arch.vm.provision :shell, inline: '
67
- if ! (which bundle > /dev/null); then
68
- time sudo gem install bundler --no-ri --no-rdoc
69
- time sudo pacman -Syu --noconfirm libffi git
70
- fi'
81
+ pacman -Syu --noconfirm libffi git
82
+ HOME=/home/vagrant su -p vagrant -l -c "cd /vagrant && bundle"'
71
83
  end
72
84
 
73
- config.vm.provision :shell, inline: '
74
- if ! [ -d /home/vagrant/.rvm ]; then
75
- HOME=/home/vagrant su -p vagrant -c "curl -L https://get.rvm.io | bash -s stable"
76
- fi
77
- '
78
85
  end
@@ -11,10 +11,10 @@ module VagrantPlugins
11
11
 
12
12
  alias :old_call :call
13
13
  def call(env)
14
- return old_call(env) unless env[:machine].config.cache.enabled?
15
-
16
14
  @env = env
17
15
 
16
+ return old_call(env) unless env[:machine].config.cache.enabled?
17
+
18
18
  FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist?
19
19
 
20
20
  nfs_flag = env[:machine].config.cache.enable_nfs
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Cachier
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -0,0 +1,9 @@
1
+ Vagrant.require_plugin 'vagrant-cachier'
2
+ Vagrant.require_plugin 'vagrant-lxc'
3
+ Vagrant.configure("2") do |config|
4
+ config.cache.auto_detect = true
5
+ config.cache.scope = :machine
6
+
7
+ config.vm.box = 'raring64'
8
+ config.vm.provision :shell, inline: 'apt-get update && apt-get install -y git'
9
+ end
@@ -0,0 +1,7 @@
1
+ Vagrant.require_plugin 'vagrant-cachier'
2
+ Vagrant.require_plugin 'vagrant-lxc'
3
+ Vagrant.configure("2") do |config|
4
+ config.cache.auto_detect = true
5
+ config.vm.box = 'quantal64'
6
+ config.vm.provision :shell, inline: 'echo Hello!'
7
+ end
@@ -0,0 +1,5 @@
1
+ Vagrant.require_plugin 'vagrant-cachier'
2
+ Vagrant.require_plugin 'vagrant-lxc'
3
+ Vagrant.configure("2") do |config|
4
+ config.vm.box = 'quantal64'
5
+ end
@@ -0,0 +1,6 @@
1
+ Vagrant.require_plugin 'vagrant-cachier'
2
+ Vagrant.require_plugin 'vagrant-lxc'
3
+ Vagrant.configure("2") do |config|
4
+ config.vm.box = 'quantal64'
5
+ config.vm.provision :shell, inline: 'echo Hello!'
6
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load test_helper
4
+
5
+ @test "Vagrantfile without cachier statement does not blow up when bringing the VM up" {
6
+ configure_env "no-cachier-simple.rb"
7
+ vagrant_up
8
+ [ "$status" -eq 0 ]
9
+ vagrant_destroy
10
+
11
+ configure_env "no-cachier-with-provisioning.rb"
12
+ vagrant_up
13
+ [ "$status" -eq 0 ]
14
+ vagrant_destroy
15
+ }
16
+
17
+ @test "Vagrantfile with cachier auto_detect statement does not blow up when bringing the VM up" {
18
+ configure_env "auto-detect.rb"
19
+ vagrant_up
20
+ [ "$status" -eq 0 ]
21
+ vagrant_destroy
22
+ }
23
+
24
+ @test "APT cache bucket configures the cache dir properly and keeps cache dir around" {
25
+ configure_env "auto-detect-with-provisioning.rb"
26
+
27
+ # Make sure cache dir does not exist
28
+ test ! -d tmp/.vagrant/machines/default/cache/apt
29
+
30
+ vagrant_up
31
+ [ "$status" -eq 0 ]
32
+
33
+ # Make sure packages are being cached
34
+ test -d tmp/.vagrant/machines/default/cache/apt
35
+ FILES=(`ls tmp/.vagrant/machines/default/cache/apt/git*.deb`)
36
+ [ ${#FILES[@]} -gt 0 ]
37
+
38
+ vagrant_destroy
39
+
40
+ # Make sure packages are not removed between machine rebuilds
41
+ FILES=(`ls tmp/.vagrant/machines/default/cache/apt/git*.deb`)
42
+ [ ${#FILES[@]} -gt 0 ]
43
+
44
+ empty_cache
45
+ }
@@ -0,0 +1,26 @@
1
+ vagrant_up() {
2
+ pushd tmp
3
+ run bundle exec vagrant up > /tmp/vagrant-cachier-tests.log
4
+ popd
5
+ }
6
+
7
+ vagrant_destroy() {
8
+ pushd tmp
9
+ run bundle exec vagrant destroy -f
10
+ popd
11
+ }
12
+
13
+ configure_env() {
14
+ fixture=$1
15
+
16
+ mkdir -p tmp/
17
+ cp spec/acceptance/fixtures/${fixture} tmp/Vagrantfile
18
+
19
+ vagrant_destroy
20
+ [ "$status" -eq 0 ]
21
+ rm -rf tmp/.vagrant
22
+ }
23
+
24
+ empty_cache() {
25
+ rm -rf tmp/.vagrant/cache
26
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-cachier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-13 00:00:00.000000000 Z
11
+ date: 2013-08-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Speed up vagrant boxes provisioning
14
14
  email:
@@ -49,6 +49,12 @@ files:
49
49
  - lib/vagrant-cachier/provision_ext.rb
50
50
  - lib/vagrant-cachier/version.rb
51
51
  - locales/en.yml
52
+ - spec/acceptance/fixtures/auto-detect-with-provisioning.rb
53
+ - spec/acceptance/fixtures/auto-detect.rb
54
+ - spec/acceptance/fixtures/no-cachier-simple.rb
55
+ - spec/acceptance/fixtures/no-cachier-with-provisioning.rb
56
+ - spec/acceptance/sanity_check.bats
57
+ - spec/acceptance/test_helper.bash
52
58
  - vagrant-cachier.gemspec
53
59
  homepage: https://github.com/fgrehm/vagrant-cachier
54
60
  licenses:
@@ -74,4 +80,10 @@ rubygems_version: 2.0.0
74
80
  signing_key:
75
81
  specification_version: 4
76
82
  summary: Speed up vagrant boxes provisioning
77
- test_files: []
83
+ test_files:
84
+ - spec/acceptance/fixtures/auto-detect-with-provisioning.rb
85
+ - spec/acceptance/fixtures/auto-detect.rb
86
+ - spec/acceptance/fixtures/no-cachier-simple.rb
87
+ - spec/acceptance/fixtures/no-cachier-with-provisioning.rb
88
+ - spec/acceptance/sanity_check.bats
89
+ - spec/acceptance/test_helper.bash