forked from bensheldon/good_job
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
71 lines (56 loc) · 1.93 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
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require_relative "lib/good_job/version"
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'GoodJob'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end
require 'bundler/gem_tasks'
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.user = 'bensheldon'
config.project = 'good_job'
config.future_release = GoodJob::VERSION
end
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
desc 'Commit version and changelog'
task :commit_version, [:version_bump] do |_t, args|
version_bump = args[:version_bump]
if version_bump.blank?
puts "Pass a version [major|minor|patch|pre|release] or a given version number [x.x.x]:"
puts "$ bundle exec commit_version[VERSION_BUMP]"
return
end
puts "\n== Bumping version number =="
system! "gem bump --no-commit --version #{version_bump}"
puts "\n== Reloading GoodJob::VERSION"
load File.expand_path('lib/good_job/version.rb', __dir__)
puts GoodJob::VERSION
puts "\n== Updating Changelog =="
system! "bundle exec foreman run rake changelog"
puts "\n== Updating Gemfile.lock version =="
system! "bundle install"
system! "bundle exec appraisal install"
puts "\n== Creating git commit =="
system! "git add lib/good_job/version.rb CHANGELOG.md Gemfile.lock gemfiles/*.gemfile.lock"
system! "git commit -m \"Bump good_job to v#{GoodJob::VERSION}\""
system! "git tag v#{GoodJob::VERSION}"
puts "\n== Next steps =="
puts "Push commit and tag to Github:"
puts "$ git push origin v#{GoodJob::VERSION}"
puts "\n"
puts "Push to rubygems"
puts "$ gem release"
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:rspec)
task default: :rspec