forked from cookbooks/cs-chef-red5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
29 lines (26 loc) · 761 Bytes
/
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
# encoding: utf-8
$:.unshift File.expand_path("../", __FILE__)
project_root = File.expand_path("..", __FILE__)
version_file = File.join(project_root, "VERSION")
VERSION = File.open(version_file) { |f| f.read }
# Inspired by `require_clean_work_tree'
# http://stackoverflow.com/questions/3878624
def work_tree_clean?
`git update-index -q --ignore-submodules --refresh`
if `git diff-files --quiet --ignore-submodules --` && !$?.success?
false
elsif `git diff-index --cached --quiet HEAD --ignore-submodules --` && !$?.success?
false
else
true
end
end
desc "Create tag v#{VERSION}"
task :tag do
if work_tree_clean?
sh "git tag v#{VERSION}"
sh "git push origin v#{VERSION}"
else
fail "Your work tree isn't clean!"
end
end