-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
71 lines (59 loc) · 1.96 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
# frozen_string_literal: true
require "date"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "standard/rake"
require "rubocop/rake_task"
RSpec::Core::RakeTask.new :spec
RuboCop::RakeTask.new :rubocop do |task|
task.options = %w[--format quiet]
end
desc "Run all checks and tests"
task default: :test
desc "Run all checks and tests"
task test: [:rubocop, :standard, :vcr, :spec]
desc "Fix RuboCop and StandardRB violations"
task fix: ["rubocop:auto_correct", "standard:fix"]
# TODO: Make these a proper lib/rake_tasks.rb task and avoid exec'ing out
desc "Check VCR cassettes for Redox credential leak"
task "vcr" do
raise "Possible credential leak, run rake vcr:fix" unless system "bin/check-vcr-cassettes"
end
desc "Scrub VCR cassettes, replacing suspected real creds with test ones"
task "vcr:fix" do
system "bin/check-vcr-cassettes --scrub"
end
task "prepare:changelog" do
repo = "https://github.com/patient-discovery/redox-client"
changelog = IO.readlines("CHANGELOG.md").map(&:chomp)
entries = [
"## [#{Redox::VERSION}] - #{Date.today}",
"[#{Redox::VERSION}]: #{repo}/releases/tag/v#{Redox::VERSION}",
"[Unreleased]: #{repo}/compare/v#{Redox::VERSION}...HEAD"
]
unless entries.all? { |x| changelog.include? x }
puts "\nAdd these to CHANGELOG.md:\n\n"
puts entries.join("\n")
puts "\n\n"
abort "ERROR: CHANGELOG version entries needed"
end
puts "CHANGELOG looks good"
end
task "prepare:version" do
if system("git show-ref --tags v#{Redox::VERSION}")
abort("ERROR: Tag already exists. Check version.rb")
end
end
task "prepare:tag" do
unless system("git tag -m 'Version #{Redox::VERSION}' v#{Redox::VERSION}")
abort("ERROR: Unable to tag")
end
end
desc "Prepare a gem release"
task "prepare:release": [
"release:guard_clean", "test", "prepare:version", "prepare:changelog", "prepare:tag"
] do
puts "Release tagged. To create release run:\n\n"
puts "git push --follow-tags"
end
CLEAN.include "coverage"