forked from honeybadger-io/honeybadger-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
96 lines (82 loc) · 2.42 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'
require 'bump'
require 'appraisal'
require 'honeybadger/version'
require_relative 'tools/release'
NAME = Dir['*.gemspec'].first.split('.').first.freeze
VERSION = Honeybadger::VERSION
GEM_FILE = "#{NAME}-#{VERSION}.gem".freeze
GEMSPEC_FILE = "#{NAME}.gemspec".freeze
require 'rdoc/task'
RDoc::Task.new do |rdoc|
rdoc.main = 'README.md'
rdoc.markup = 'tomdoc'
rdoc.rdoc_dir = 'doc'
rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
end
require 'rspec/core/rake_task'
namespace :spec do
desc 'Run unit specs'
RSpec::Core::RakeTask.new(:units) do |t|
t.pattern = 'spec/unit/**/*_spec.rb'
t.rspec_opts = '--require spec_helper'
end
desc 'Run integration specs'
RSpec::Core::RakeTask.new(:integrations) do |t|
t.pattern = 'spec/integration/**/*_spec.rb'
t.rspec_opts = '--require spec_helper'
end
desc 'Run feature specs'
RSpec::Core::RakeTask.new(:features) do |t|
t.pattern = 'spec/features/**/*_spec.rb'
t.rspec_opts = '--require spec_helper'
end
desc 'Runs unit and feature specs'
task all: [:units, :integrations, :features]
end
desc 'Alias for spec:all (default task)'
task spec: :'spec:all'
task test: :spec
task default: :spec
namespace :bump do
current_version = Bump::Bump.current
%w(major minor patch pre).each do |bump|
version = Bump::Bump.next_version(bump)
desc "Bump v#{current_version} to v#{version}"
task bump do
Release.run_before(version)
Bump::Bump.run(bump, commit: false)
Release.run_after(version)
end
end
desc "Bump v#{current_version} to $VERSION"
task :set do
unless ENV["VERSION"] =~ /\S/
puts "ERROR: version can't be blank"
exit 1
end
Release.run_before(ENV['VERSION'])
Bump::Bump.run('set', commit: false, version: ENV["VERSION"])
Release.run_after(ENV['VERSION'])
end
end
desc "Build #{GEM_FILE} into the pkg directory"
task :build do
sh "mkdir -p pkg"
sh "gem build #{GEMSPEC_FILE}"
sh "mv #{GEM_FILE} pkg"
end
desc "Create tag v#{VERSION} and build and push #{GEM_FILE} to Rubygems"
task :release => [:spec, :build] do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -a -e -m 'Release #{VERSION}'"
sh "git tag v#{VERSION}"
sh "git push origin master"
sh "git push origin v#{VERSION}"
sh "gem push pkg/#{GEM_FILE}"
end