forked from infochimps-labs/ironfan-homebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBerksfile.inc.rb
42 lines (35 loc) · 1.55 KB
/
Berksfile.inc.rb
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
39
40
41
42
conf_file = File.join(File.dirname(__FILE__), 'Berksfile.conf')
# Move the old file to the right place
old_conf_file = "#{conf_file}.rb"
if ((File.exists? old_conf_file) && (not File.exists? conf_file))
require 'fileutils'
puts "Moving #{old_conf_file} to #{conf_file}"
FileUtils.mv(old_conf_file, conf_file)
end
if File.exists? conf_file
require 'parseconfig'
ParseConfig.new(conf_file).params.each_pair {|k,v| ENV[k] = v unless ENV[k] }
end
# ENV['USE_LOCAL'] = nil # This is already default
ENV['LOCAL_PATH'] = "vendor" unless ENV['LOCAL_PATH']
ENV['PANTRY_REPO'] = 'infochimps-labs/ironfan-pantry' unless ENV['PANTRY_REPO']
ENV['PANTRY_BRANCH'] = 'master' unless ENV['PANTRY_BRANCH']
ENV['COMMUNITY_REPO'] = 'infochimps-labs/community-pantry' unless ENV['COMMUNITY_REPO']
ENV['COMMUNITY_BRANCH'] = 'master' unless ENV['COMMUNITY_BRANCH']
def github_cookbook(name, repo, rel, branch)
if ! ENV['USE_LOCAL'].nil?
r_name = repo.split('/')[1]
cookbook name, path: "#{ENV['LOCAL_PATH']}/#{r_name}/#{rel}"
else
cookbook name, github: repo, protocol: 'ssh', rel: rel, branch: branch
end
end
def pantry_cookbook(name)
github_cookbook name, ENV['PANTRY_REPO'], ('cookbooks/' + name), ENV['PANTRY_BRANCH']
end
def community_cookbook(name)
github_cookbook name, ENV['COMMUNITY_REPO'], ('cookbooks/' + name), ENV['COMMUNITY_BRANCH']
end
def org_cookbook(name)
cookbook name, path: "org_cookbooks/#{name}"
end