forked from fgrehm/rails-base-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
33 lines (26 loc) · 972 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
desc 'Recreates .box file'
task :rebuild do
unless Dir.exists?('./modules')
sh 'librarian-puppet install'
end
unless `vagrant plugin list`.include? 'vagrant-cachier'
sh 'vagrant plugin install vagrant-cachier'
end
sh "vagrant destroy -f"
provider = ENV['PROVIDER'] || ENV['VAGRANT_DEFAULT_PROVIDER']
extra = provider ? "--provider=#{provider}" : ''
sh "vagrant up --no-provision #{extra}"
sh 'vagrant ssh -c "sudo apt-get update && sudo apt-get upgrade -y"'
sh 'vagrant reload'
sh 'vagrant ssh -c "rm /home/vagrant/.rbenv/cache/*"'
unless provider == 'lxc'
# FROM: https://gist.github.com/3775253
sh 'vagrant ssh -c "sudo /vagrant/purge.sh"'
end
# Ensure vagrant-cachier symlinks gets removed
sh 'vagrant halt'
provider = provider ? "#{provider}-" : ''
require 'time'
box_file_name = "#{provider}quantal64-rails-#{Date.today}.box"
sh "rm -f #{box_file_name} && vagrant package --output #{box_file_name}"
end