/
git.task
47 lines (43 loc) · 1.32 KB
/
git.task
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 git_task(name, cmd = nil)
cmd ||= yield if block_given?
cmd ||= name
desc "git #{name} for %s"
project_task(name) do
puts '', '#'*80, "# #{subproject.name}"
if File.exist? subproject.name then system "cd #{subproject.name}; git #{cmd}; cd .."
else $stderr.puts "# missing"
end
end
end
def commit
"commit -a -m #{ENV['message'].to_s.inspect}"
end
def tag
"tag -a #{ENV['tag'].to_s.inspect} -m #{ENV['tag'].to_s.inspect}"
end
namespace :git do
namespace :big_band do
task(:header) { puts '', '#'*80, "# BigBand" }
task(:status => :header) { system "git status" }
task(:pull => :header) { system "git pull --no-ff" }
task(:push => :header) { system "git push" }
task(:diff => :header) { system "git diff" }
task(:tags => :header) { system "git push --tags" }
task(:commit => :header) { system "git #{commit}" }
task(:tag => :header) { system "git #{tag}" }
end
task :status => "big_band:status"
task :pull => "big_band:pull"
task :push => "big_band:push"
task :diff => "big_band:diff"
task :tags => "big_band:tags"
end
project_namespace :git do
git_task :status
git_task :pull, "pull --no-ff"
git_task :push
git_task :diff
git_task :tags, "push --tags"
git_task(:commit) { commit }
git_task(:tag) { tag }
end