forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzip.rb
47 lines (39 loc) · 981 Bytes
/
zip.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
43
44
45
46
47
def uber_jar(args)
if !jar?
puts "Unable to run uber_jar task"
exit -1
end
out = "build/#{args[:out]}"
file out => args[:src] + args[:deps] do
puts "Building: #{args[:out]}"
dir = "build/#{args[:name]}_temp"
mkdir_p dir
args[:src].each do |src|
sh "cd #{dir} && jar xf ../../#{src}"
end
sh "cd #{dir} && jar cMf ../#{args[:out]} *"
rm_rf dir
end
task args[:name] => out
end
def zip(args)
if !jar?
puts "Unable to run zip task: no jar find"
exit -1
end
out = "build/#{args[:out]}"
file out => args[:src] + args[:deps] do
puts "Building #{args[:out]}"
short_name = args[:out].sub(".zip", "")
dir = "build/#{args[:name]}_temp/#{short_name}"
mkdir_p dir
args[:src].each do |src|
if src =~ /\.jar$/
cp src, dir
end
end
sh "cd #{dir}/.. && jar cMf ../#{args[:out]} *"
rm_rf "build/#{args[:name]}_temp"
end
task args[:name] => out
end