-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
58 lines (46 loc) · 1.4 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'fileutils'
require 'pathname'
ROOT_PATH = Pathname.new(File.expand_path("../../", __FILE__))
RUBYGEM_PATH = Pathname.new(File.expand_path("../", __FILE__))
task build: [:import_externals, :version, :manifest]
task default: :build
task :import_externals do
puts "building rubygem"
Rake::Task[:clean].invoke
FileUtils.rm_r(RUBYGEM_PATH + "man") rescue nil
FileUtils.rm_r(RUBYGEM_PATH + "build") rescue nil
# manpages
FileUtils.mkdir(RUBYGEM_PATH + "man")
FileUtils.cp_r(ROOT_PATH + "man/build", RUBYGEM_PATH + "man")
# multi-arch binaries
FileUtils.cp_r(ROOT_PATH + "build", RUBYGEM_PATH + "build")
Rake::Task[:manifest].invoke
Rake::Task[:build].invoke
end
task :version do
version = File.read('../VERSION').chomp
File.open('lib/zeus/version.rb', 'w') { |f| f.puts <<END
module Zeus
VERSION = "#{version}"
end
END
}
end
task manifest: :version do
files = `find . -type f | sed 's|^\./||'`.lines.map(&:chomp)
exceptions = [
/.gitignore$/,
/^MANIFEST$/,
/^pkg\//,
]
files.reject! { |f| exceptions.any? {|ex| f =~ ex }}
File.open('MANIFEST', 'w') {|f| f.puts files.join("\n") }
end
task :clean do
FileUtils.rm(RUBYGEM_PATH + "lib/zeus/version.rb") rescue nil
FileUtils.rm_r(RUBYGEM_PATH + "man") rescue nil
FileUtils.rm_r(RUBYGEM_PATH + "build") rescue nil
FileUtils.rm_r(RUBYGEM_PATH + "pkg") rescue nil
end