-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (49 loc) · 1.4 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
task :default => [:test]
desc "bump"
task :bump, [:new_version] do |task, args|
if args[:new_version]
version_bump(args[:new_version])
else
puts "Error: Version number required\n"
puts
puts "Usage: to bump a new version run: rake bump[0.0.0]"
end
end
desc "release"
task :release, [:new_version] do |task, args|
if args[:new_version]
git_release(args[:new_version])
else
puts "Error: Version number required\n"
puts
puts "Usage: to release a new version run: rake release[0.0.0]"
end
end
desc "test"
task :test do
sh "test/run"
end
def version_bump(new_version)
if new_version
current_version = `grep return autoload/linny_version.vim | cut -d"'" -f2`.gsub("\n","")
files = [
"autoload/linny_version.vim",
"test/feature/mapping.vader"
]
files.each do |filename|
puts "Updating version numbers in #{filename}"
`sed -i.bak -e "s/#{current_version}/#{new_version}/" #{filename}`
end
end
end
def git_release(new_version)
name = File.basename(Dir.getwd)
message = "Bumped version number to v#{new_version}." # unless message = ARGV[1]
puts "git commit -am \"#{message}\""
`git commit -am "#{message}"`
`git push`
puts "git tag -a v#{new_version} -m \"#{name} v#{new_version}\""
`git tag -a v#{new_version} -m "#{name} v#{new_version}"`
puts "git push origin v#{new_version}"
`git push origin v#{new_version}`
end