Skip to content

Commit 60b3f5b

Browse files
setup release tasks
1 parent e664326 commit 60b3f5b

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

Rakefile

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
require 'pathname'
2+
3+
class ThisProject
4+
def self.this_file_path
5+
Pathname.new( __FILE__ ).expand_path
6+
end
7+
8+
def self.project_root
9+
this_file_path.dirname
10+
end
11+
12+
def self.this_file_path
13+
Pathname.new( __FILE__ ).expand_path
14+
end
15+
16+
def self.project_path( *relative_path )
17+
project_root.join( *relative_path )
18+
end
19+
20+
def self.version
21+
path = project_path( "init.rb" )
22+
line = path.read[/^\s*VERSION\s*=\s*.*/]
23+
if line then
24+
return line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
25+
end
26+
end
27+
28+
def self.release_branch
29+
"main"
30+
end
31+
end
32+
33+
task :version do
34+
puts ThisProject.version
35+
end
36+
37+
task :release_check do
38+
unless `git branch` =~ /^\* #{ThisProject.release_branch}/
39+
abort "You must be on the #{ThisProject.release_branch} branch to release!"
40+
end
41+
unless `git status` =~ /^nothing to commit/m
42+
abort "Nope, sorry, you have unfinished business"
43+
end
44+
end
45+
46+
desc "Create tag v#{ThisProject.version} and generate release on github"
47+
task :release => [ :release_check ] do
48+
sh "git commit --allow-empty -a -m 'Release #{ThisProject.version}'"
49+
sh "git tag -a -m 'v#{ThisProject.version}' v#{ThisProject.version}"
50+
sh "git push origin #{ThisProject.release_branch}"
51+
sh "git push origin v#{ThisProject.version}"
52+
end

init.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
require 'byebug'
1111

12+
VERSION = "0.5.0"
13+
1214
Redmine::Plugin.register :redmine_freshbooks_sync do
1315
name 'FreshBooks Sync'
1416
author 'Jeremy Hinegardner'
1517
description 'This is a Redmine // FreshBooks Synchronization tool'
16-
version '0.5.0'
18+
version VERSION
1719
url 'https://github.com/dojo4/redmine_freshbooks_sync'
1820
author_url 'https://github.com/copiousfreetime'
1921

0 commit comments

Comments
 (0)