-
Notifications
You must be signed in to change notification settings - Fork 14
/
Rakefile
51 lines (43 loc) · 1.12 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
require 'rubygems'
require 'rake'
$:.unshift File.expand_path('../lib', __FILE__)
require 'numerizer/version'
def version
Numerizer::VERSION
end
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.test_files = Dir['test/test_*.rb']
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
rescue LoadError
task :rcov do
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
end
end
desc "Release Numerizer version #{version}"
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push origin v#{version}"
sh "gem push pkg/numerizer-#{version}.gem"
end
desc 'Build a gem from the gemspec'
task :build do
FileUtils.mkdir_p 'pkg'
sh 'gem build numerizer.gemspec'
FileUtils.mv("./numerizer-#{version}.gem", "pkg")
end
task :default => :test