-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRakefile
38 lines (32 loc) · 982 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
34
35
36
37
38
require 'rake/packagetask'
require 'find'
PACKAGE_NAME = "chef-el-rvm-bootstrap"
PACKAGE_VERSION="0.10.8-1"
PACKAGE_FULL="#{PACKAGE_NAME}-#{PACKAGE_VERSION}"
PACKAGE_DIR = "tmp"
INCLUDE_FILES = "**/*"
EXCLUDE_FILES = "tmp"
def load_package_task
Rake::PackageTask.new(PACKAGE_NAME, PACKAGE_VERSION) do |p|
p.package_dir = PACKAGE_DIR
p.need_tar_gz = true
p.package_files.include(*INCLUDE_FILES)
p.package_files.exclude(*EXCLUDE_FILES)
end
end
desc "Build a bootstrap tar.gz"
task :build_bootstrap do
rm_rf PACKAGE_DIR
# Delay until after cleanup, also don't need the other tasks it provides
load_package_task
Rake::Task[ "package" ].invoke
# Package again, chef-solo requires cookbooks/ in path (CHEF-2001)
chdir(PACKAGE_DIR) do
rm_f File.join("#{PACKAGE_FULL}.tar.gz")
chdir(PACKAGE_FULL) do
sh %{mkdir cookbooks}
sh %{mv -f * cookbooks || :}
sh %{tar zcvf ../#{PACKAGE_FULL}.tar.gz cookbooks}
end
end
end