-
Notifications
You must be signed in to change notification settings - Fork 22
/
Thorfile
33 lines (28 loc) · 912 Bytes
/
Thorfile
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
$:.push File.expand_path('../lib', __FILE__)
require 'thor'
require 'thor-scmversion'
class ThorSCMVersion < Thor
namespace 'scmver'
desc "build", "Build the gem"
def build
system("gem build -V 'thor-scmversion.gemspec'")
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), 'pkg'))
FileUtils.mv("thor-scmversion-#{current_version}.gem", 'pkg')
end
desc "install", "Build and install latest to system gems"
def install
invoke "build", []
system("gem install pkg/thor-scmversion-#{current_version}.gem")
end
desc "release [TYPE]", "Bump version, make a build, and push to Rubygems"
def release(type='auto')
@current_version = nil
invoke "version:bump", [type]
invoke "build", []
system("gem push pkg/thor-scmversion-#{current_version}.gem")
end
private
def current_version
@current_version ||= ::ThorSCMVersion.versioner.from_path
end
end