-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
70 lines (56 loc) · 2.12 KB
/
Rakefile
File metadata and controls
70 lines (56 loc) · 2.12 KB
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
# frozen_string_literal: true
require "rspec/core/rake_task"
require "standard/rake"
require "bump/tasks"
RSpec::Core::RakeTask.new(:spec)
namespace :yard do
desc "Run yard-lint to check YARD documentation"
task :lint do
sh "bundle exec yard-lint"
end
end
task default: %i[spec standard]
desc "Release current version (creates git tag and triggers GitHub Actions)"
task :release do
require_relative "lib/superthread"
version = Superthread::VERSION
# Check if tag already exists
if system("git rev-parse v#{version} >/dev/null 2>&1")
warn "\e[31mError: Tag v#{version} already exists\e[0m"
abort
end
# Check for uncommitted changes to version file
unless system("git diff --quiet lib/superthread/version.rb")
warn "\e[31mError: lib/superthread/version.rb has uncommitted changes\e[0m"
warn "\e[90mCommit version changes first or run 'bin/rake bump:patch'\e[0m"
abort
end
# Check that Gemfile.lock matches the current version
lockfile = File.read("Gemfile.lock")
unless lockfile.include?("superthread (#{version})")
warn "\e[31mError: Gemfile.lock still references an old version\e[0m"
warn "\e[90mRun 'bundle install' and commit the updated Gemfile.lock\e[0m"
abort
end
puts "\e[1mRelease v#{version}\e[0m"
puts "\e[90mThis will:\e[0m"
puts "\e[90m 1. Create tag: v#{version}\e[0m"
puts "\e[90m 2. Push tag to origin\e[0m"
puts "\e[90m 3. Trigger GitHub Actions to build and release\e[0m"
puts "\e[90m 4. Update Homebrew formula automatically\e[0m"
puts
print "Continue? [y/N] "
answer = $stdin.gets.chomp.downcase
abort "Cancelled." unless answer == "y"
puts "\e[90mCreating tag v#{version}...\e[0m"
system("git tag -a 'v#{version}' -m 'Release v#{version}'") || abort("Failed to create tag")
puts "\e[90mPushing to origin...\e[0m"
system("git push origin 'v#{version}'") || abort("Failed to push tag")
puts
puts "\e[32mRelease v#{version} created!\e[0m"
puts "\e[90mCheck progress: https://github.com/steveclarke/superthread/actions\e[0m"
end
desc "Open console with library loaded"
task :console do
exec "bundle exec irb -r ./lib/superthread"
end