-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rakefile
38 lines (32 loc) · 1.08 KB
/
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
34
35
36
37
38
require 'rubygems'
require 'rake'
#require 'cucumber'
require 'json'
task :default => :usage
task :usage do
system("rake -T")
end
#test_dir = File.expand_path('tests')
#Cucumber::Rake::Task.new(:run) do |task|
# task.cucumber_opts = ["features"]
#end
desc "Setup shared Bakery directories"
task :share do
if !File.exists?('shared') || !File.exists?('shared/bakery6') || !File.exists?('shared/bakery7')
raise "Create folder ./shared with subdirectories 'bakery6' and 'bakery7' for Bakery versions 6 and 7 respectively"
end
bakery = JSON.parse(File.read("config/node.json"))
puts "Removing per-site Bakery modules and symlinking to shared"
bakery['sites'].each do |site|
vagrant_ssh("sudo rm -rf /var/www/#{site['name']}/htdocs/sites/all/modules/bakery")
vagrant_ssh("sudo ln -s /var/bakery/bakery#{site['core']} /var/www/#{site['name']}/htdocs/sites/all/modules/bakery")
end
puts "Done"
end
def vagrant_command(command)
system "vagrant #{command}"
end
# Execute shell command on vagrant machine
def vagrant_ssh(command)
return vagrant_command "ssh -c \"#{command}\""
end