Caches gem tarballs on dev boxes
This commit is contained in:
parent
185b47dfc7
commit
dc2d8f8572
1 changed files with 16 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
# -*- mode: ruby -*-
|
# -*- mode: ruby -*-
|
||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
def local_cache(box_name)
|
def local_apt_cache(box_name)
|
||||||
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
|
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
|
||||||
'cache',
|
'cache',
|
||||||
'apt',
|
'apt',
|
||||||
|
@ -11,6 +11,16 @@ def local_cache(box_name)
|
||||||
cache_dir
|
cache_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def local_gem_cache(box_name)
|
||||||
|
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
|
||||||
|
'cache',
|
||||||
|
'gems',
|
||||||
|
'source',
|
||||||
|
box_name)
|
||||||
|
FileUtils.mkdir_p(cache_dir) unless File.exists? cache_dir
|
||||||
|
cache_dir
|
||||||
|
end
|
||||||
|
|
||||||
Vagrant.require_plugin 'vagrant-lxc'
|
Vagrant.require_plugin 'vagrant-lxc'
|
||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
|
@ -18,8 +28,11 @@ Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
config.vm.synced_folder "../", "/vagrant", name: 'vagrant-root'
|
config.vm.synced_folder "../", "/vagrant", name: 'vagrant-root'
|
||||||
|
|
||||||
cache_dir = local_cache(config.vm.box)
|
cache_dir = local_apt_cache(config.vm.box)
|
||||||
config.vm.synced_folder cache_dir, "/var/cache/apt/archives", name: "vagrant-cache"
|
config.vm.synced_folder cache_dir, "/var/cache/apt/archives", name: "vagrant-apt-cache"
|
||||||
|
|
||||||
|
cache_dir = local_gem_cache(config.vm.box)
|
||||||
|
config.vm.synced_folder cache_dir, "/home/vagrant/gems/cache", name: "vagrant-gem-cache"
|
||||||
|
|
||||||
config.vm.define :vbox do |vb_config|
|
config.vm.define :vbox do |vb_config|
|
||||||
vb_config.vm.box_url = "https://github.com/downloads/roderik/VagrantQuantal64Box/quantal64.box"
|
vb_config.vm.box_url = "https://github.com/downloads/roderik/VagrantQuantal64Box/quantal64.box"
|
||||||
|
|
Loading…
Reference in a new issue