-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile.drake
99 lines (82 loc) · 2.32 KB
/
Rakefile.drake
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
$LOAD_PATH.unshift "./contrib/comp_tree/contrib/quix/lib"
require 'quix/subpackager'
require 'quix/fileutils'
require 'fileutils'
######################################################################
# git
def git(*args)
cmd = ["git"] + args
sh(*cmd)
end
task :add_contrib_first_time => :init_contrib do
git(*%w!merge --squash -s ours --no-commit comp_tree/master!)
git(*%w!read-tree --prefix=contrib/comp_tree -u comp_tree/master!)
git("commit", "-m", "add comp_tree package")
end
task :init_contrib do
unless `git remote`.split.include? "comp_tree"
git(*%w!remote add -f comp_tree git@github.com:quix/comp_tree.git!)
end
end
task :run_pull_contrib => :init_contrib do
git(*%w!pull --no-commit -s subtree comp_tree master!)
end
task :pull_mainline do
git(*%w!pull --no-commit
git://github.com/jimweirich/rake.git
refs/heads/master:refs/heads/origin!)
end
task :pull_contrib => [ :init_contrib, :run_pull_contrib ]
######################################################################
# drake_release
task :drake_prerelease => [:clean, :gemspec] do
rm_rf("html")
rm_rf("pkg")
unless `git status` =~ %r!nothing to commit \(working directory clean\)!
raise "Directory not clean"
end
unless `git pull` =~ %r!Already up-to-date!
raise "New stuff from remote repository"
end
%w[github.com rubyforge.org].each { |server|
unless `ping -c2 #{server}` =~ %r!0% packet loss!
raise "No ping for #{server}"
end
}
end
task :drake_publish => :rdoc do
Dir.chdir("html") {
sh(*%w(scp -r . quix@rubyforge.org:/var/www/gforge-projects/drake))
}
end
def rubyforge(command, file, *args)
sh("rubyforge",
command,
SPEC.rubyforge_project,
SPEC.rubyforge_project,
SPEC.version.to_s,
file,
*args)
end
task :drake_finish_release do
changes = File.expand_path("CHANGES.drake")
sh("rubyforge", "login")
Dir.chdir("pkg") {
gem = "#{SPEC.name}-#{SPEC.version}.gem"
md5 = "#{gem}.md5"
sh("md5sum #{gem} > #{md5}")
rubyforge(
*%W(add_release #{gem} --release_changes #{changes} --preformatted))
rubyforge("add_file", md5)
}
git("tag", "drake-" + SPEC.version.to_s)
git(*%w(push --tags origin master))
end
task :drake_release =>
[
:drake_prerelease,
:gem,
:test_all,
:drake_publish,
:drake_finish_release,
]