-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
42 lines (33 loc) · 1.13 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
require "pathname"
def version
return @version if @version
vstring = File.read("adgear-ad-manager.php").split("\n").grep(/\*\s+Version:\s/).first
@version = vstring.split(":").last.strip
end
directory "tmp"
BASE = Pathname.new(File.expand_path(File.dirname(__FILE__)))
task :clean do
rm "REVISION"
rm_rf "tmp/adgear-ad-manager-#{version}.zip"
end
file "REVISION" do
sh "git show --pretty=oneline | head -n 1 | cut -c -40 > REVISION"
end
file "tmp/adgear-ad-manager-#{version}.zip" => "REVISION" do
cmdline = "/usr/bin/zip -FS -1 -r --latest-time"
cmdline << " #{BASE + "tmp/adgear-ad-manager-#{version}.zip"}"
cmdline << " #{BASE.basename}"
[BASE + "tmp/\\*", BASE + ".git/\\*"].each do |exclusion|
cmdline << " --exclude #{exclusion.to_s.sub(BASE.parent.to_s + "/", "")}"
end
cmdline << " --exclude .DS_Store"
cmdline << " --exclude .gitignore"
chdir(BASE + "..") do
sh cmdline
end
end
task :build => ["tmp", "tmp/adgear-ad-manager-#{version}.zip"]
task :push do
sh "/usr/bin/scp #{BASE + "adgear-ad-manager.php"} [email protected]:wp.teksol.info/wp-content/plugins/"
end
task :default => :push