vagrant-cachier 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 358ed900ee09d49b65042a0bf76b3d6b888c60b8
4
+ data.tar.gz: c24d390fbd5c1fc4446a956c6c65bacb56dee603
5
+ SHA512:
6
+ metadata.gz: 2e64ed67cbd86f0fb5ab18583f4a637ba9114f33a3bb64032b20293b09fc41cb1d2677fb1fc8980139efcfad27523bb92c1d5f026b9fa6b38ce43a6efa94899d
7
+ data.tar.gz: 266406520e8f8cd08a9e6914399b526813b512fb9279ca21aef489f7c1cf00bda47a0e0db98de047501cd217c367507b4c62cb1698dea9ce2117be27482eac32
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
- ## 0.1.1 (unreleased)
1
+ ## [0.2.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.1.0...v0.2.0) (July 10, 2013)
2
2
 
3
- ## 0.1.0 (June 9, 2013)
3
+ FEATURES:
4
+
5
+ - Support enabling NFS for root cache folder. [GH-7]
6
+ - Support RVM bucket
7
+
8
+ ## [0.1.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.0.6...v0.1.0) (June 9, 2013)
4
9
 
5
10
  IMPROVEMENTS:
6
11
 
data/Gemfile.lock CHANGED
@@ -20,7 +20,7 @@ GIT
20
20
  PATH
21
21
  remote: .
22
22
  specs:
23
- vagrant-cachier (0.0.6)
23
+ vagrant-cachier (0.2.0)
24
24
 
25
25
  GEM
26
26
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -24,6 +24,8 @@ from within your `Vagrantfile`:
24
24
  Vagrant.configure("2") do |config|
25
25
  config.vm.box = 'your-box'
26
26
  config.cache.auto_detect = true
27
+ # If you are using VirtualBox, you might want to enable NFS for shared folders
28
+ # config.cache.enable_nfs = true
27
29
  end
28
30
  ```
29
31
 
@@ -182,6 +184,21 @@ it is already installed before enabling the bucket, otherwise you won't benefit
182
184
  from this plugin.
183
185
 
184
186
 
187
+ #### RVM
188
+
189
+ ```ruby
190
+ Vagrant.configure("2") do |config|
191
+ config.vm.box = 'some-box-with-rvm-installed'
192
+ config.cache.enable :rvm
193
+ end
194
+ ```
195
+
196
+ Compatible with probably with any type of linux guest distro, will hook into the `cache`
197
+ folder under the result of running `rvm info` as the default SSH user (usualy
198
+ `vagrant`) on your guest. If you use rvm on the guest machine, make sure
199
+ it is already installed before enabling the bucket, otherwise you won't benefit
200
+ from this plugin.
201
+
185
202
  ## Finding out disk space used by buckets
186
203
 
187
204
  _TODO_
@@ -9,6 +9,11 @@ Vagrant.configure("2") do |config|
9
9
 
10
10
  config.cache.scope = :machine
11
11
  config.cache.auto_detect = true
12
+ config.cache.enable_nfs = true
13
+
14
+ config.vm.provider :virtualbox do |_, vb|
15
+ vb.vm.network :private_network, ip: "192.168.50.123"
16
+ end
12
17
 
13
18
  debian_like_configs = lambda do |debian|
14
19
  debian.vm.provision :shell, inline: '
@@ -49,4 +54,10 @@ Vagrant.configure("2") do |config|
49
54
  time sudo pacman -Syu --noconfirm libffi git
50
55
  fi'
51
56
  end
57
+
58
+ config.vm.provision :shell, inline: '
59
+ if ! [ -d /home/vagrant/.rvm ]; then
60
+ HOME=/home/vagrant su -p vagrant -c "curl -L https://get.rvm.io | bash -s stable"
61
+ fi
62
+ '
52
63
  end
@@ -16,7 +16,8 @@ module VagrantPlugins
16
16
 
17
17
  FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist?
18
18
 
19
- env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', id: "vagrant-cache"
19
+ nfs_flag = env[:machine].config.cache.enable_nfs
20
+ env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', id: "vagrant-cache", nfs: nfs_flag
20
21
 
21
22
  @app.call env
22
23
 
@@ -37,3 +37,4 @@ require_relative "bucket/apt"
37
37
  require_relative "bucket/gem"
38
38
  require_relative "bucket/pacman"
39
39
  require_relative "bucket/yum"
40
+ require_relative "bucket/rvm"
@@ -0,0 +1,39 @@
1
+ module VagrantPlugins
2
+ module Cachier
3
+ class Bucket
4
+ class Rvm < Bucket
5
+ def self.capability
6
+ :rvm_path
7
+ end
8
+
9
+ def install
10
+ machine = @env[:machine]
11
+ guest = machine.guest
12
+
13
+ if guest.capability?(:rvm_path)
14
+ if rvm_path = guest.capability(:rvm_path)
15
+ prefix = rvm_path.split('/').last
16
+ bucket_path = "/tmp/vagrant-cache/#{@name}/#{prefix}"
17
+ machine.communicate.tap do |comm|
18
+ comm.execute("mkdir -p #{bucket_path}")
19
+
20
+ rvm_cache_path = "#{rvm_path}/archives"
21
+
22
+ @env[:cache_dirs] << rvm_cache_path
23
+
24
+ unless comm.test("test -L #{rvm_cache_path}")
25
+ comm.sudo("rm -rf #{rvm_cache_path}")
26
+ comm.sudo("mkdir -p `dirname #{rvm_cache_path}`")
27
+ comm.sudo("ln -s #{bucket_path} #{rvm_cache_path}")
28
+ end
29
+ end
30
+ end
31
+ else
32
+ # TODO: Raise a better error
33
+ raise "You've configured a RVM cache for a guest machine that does not support it!"
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,21 @@
1
+ module VagrantPlugins
2
+ module Cachier
3
+ module Cap
4
+ module Linux
5
+ module RvmPath
6
+ def self.rvm_path(machine)
7
+ rvm_path = nil
8
+ machine.communicate.tap do |comm|
9
+ return unless comm.test('rvm info')
10
+ comm.execute 'echo $rvm_path' do |buffer, output|
11
+ rvm_path = output.chomp if buffer == :stdout
12
+ end
13
+ end
14
+ return rvm_path
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -1,12 +1,13 @@
1
1
  module VagrantPlugins
2
2
  module Cachier
3
3
  class Config < Vagrant.plugin(2, :config)
4
- attr_accessor :scope, :auto_detect
4
+ attr_accessor :scope, :auto_detect, :enable_nfs
5
5
  attr_reader :buckets
6
6
 
7
7
  def initialize
8
8
  @scope = UNSET_VALUE
9
9
  @auto_detect = UNSET_VALUE
10
+ @enable_nfs = UNSET_VALUE
10
11
  end
11
12
 
12
13
  def enable(bucket, opts = {})
@@ -18,6 +19,7 @@ module VagrantPlugins
18
19
 
19
20
  @scope = :box if @scope == UNSET_VALUE
20
21
  @auto_detect = false if @auto_detect == UNSET_VALUE
22
+ @enable_nfs = false if @enable_nfs == UNSET_VALUE
21
23
  @buckets = @buckets ? @buckets.dup : {}
22
24
  end
23
25
 
@@ -13,6 +13,11 @@ module VagrantPlugins
13
13
  Cap::Linux::Gemdir
14
14
  end
15
15
 
16
+ guest_capability 'linux', 'rvm_path' do
17
+ require_relative 'cap/linux/rvm_path'
18
+ Cap::Linux::RvmPath
19
+ end
20
+
16
21
  guest_capability 'debian', 'apt_cache_dir' do
17
22
  require_relative 'cap/debian/apt_cache_dir'
18
23
  Cap::Debian::AptCacheDir
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Cachier
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-cachier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Fabio Rehm
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-10 00:00:00.000000000 Z
11
+ date: 2013-07-11 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Speed up vagrant boxes provisioning
15
14
  email:
@@ -32,10 +31,12 @@ files:
32
31
  - lib/vagrant-cachier/bucket/apt.rb
33
32
  - lib/vagrant-cachier/bucket/gem.rb
34
33
  - lib/vagrant-cachier/bucket/pacman.rb
34
+ - lib/vagrant-cachier/bucket/rvm.rb
35
35
  - lib/vagrant-cachier/bucket/yum.rb
36
36
  - lib/vagrant-cachier/cap/arch/pacman_cache_dir.rb
37
37
  - lib/vagrant-cachier/cap/debian/apt_cache_dir.rb
38
38
  - lib/vagrant-cachier/cap/linux/gemdir.rb
39
+ - lib/vagrant-cachier/cap/linux/rvm_path.rb
39
40
  - lib/vagrant-cachier/cap/redhat/yum_cache_dir.rb
40
41
  - lib/vagrant-cachier/config.rb
41
42
  - lib/vagrant-cachier/plugin.rb
@@ -44,27 +45,25 @@ files:
44
45
  homepage: https://github.com/fgrehm/vagrant-cachier
45
46
  licenses:
46
47
  - MIT
48
+ metadata: {}
47
49
  post_install_message:
48
50
  rdoc_options: []
49
51
  require_paths:
50
52
  - lib
51
53
  required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
54
  requirements:
54
- - - ! '>='
55
+ - - '>='
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
59
  requirements:
60
- - - ! '>='
60
+ - - '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 1.8.23
65
+ rubygems_version: 2.0.0
66
66
  signing_key:
67
- specification_version: 3
67
+ specification_version: 4
68
68
  summary: Speed up vagrant boxes provisioning
69
69
  test_files: []
70
- has_rdoc: