Skip to content

Commit 1e7acf8

Browse files
committed
Add task to verify a release.
Basically revises the release flow to: * Update the version in RAILS_VERSION + rake changelog:header * Run rake all:verify (click around in the booted app) * If that checks out, run rake release.
1 parent c1972c2 commit 1e7acf8

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Diff for: Rakefile

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ require "railties/lib/rails/api/task"
77
desc "Build gem files for all projects"
88
task build: "all:build"
99

10+
desc "Build, install and verify the gem files in a generated Rails app."
11+
task verify: "all:verify"
12+
1013
desc "Prepare the release"
1114
task prep_release: "all:prep_release"
1215

Diff for: tasks/release.rb

+22-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
task push: FRAMEWORKS.map { |f| "#{f}:push" } + ["rails:push"]
143143

144144
task :ensure_clean_state do
145-
unless `git status -s | grep -v 'RAILS_VERSION\\|CHANGELOG\\|Gemfile.lock\\|package.json\\|version.rb'`.strip.empty?
145+
unless `git status -s | grep -v 'RAILS_VERSION\\|CHANGELOG\\|Gemfile.lock\\|package.json\\|version.rb\\|tasks/release.rb'`.strip.empty?
146146
abort "[ABORTING] `git status` reports a dirty tree. Make sure all changes are committed"
147147
end
148148

@@ -152,6 +152,27 @@
152152
end
153153
end
154154

155+
task verify: :install do
156+
app_name = "pkg/verify-#{version}-#{Time.now.to_i}"
157+
sh "rails new #{app_name}"
158+
cd app_name
159+
sh "rails generate scaffold user name admin:boolean && rails db:migrate"
160+
161+
puts "Booting a Rails server. Verify the release by:"
162+
puts
163+
puts "- Seeing the correct release number on the root page"
164+
puts "- Viewing /users"
165+
puts "- Creating a user"
166+
puts "- Updating a user (e.g. disable the admin flag)"
167+
puts "- Deleting a user on /users"
168+
puts "- Whatever else you want."
169+
begin
170+
sh "rails server"
171+
rescue Interrupt
172+
# Server passes along interrupt. Prevent halting verify task.
173+
end
174+
end
175+
155176
task :bundle do
156177
sh "bundle check"
157178
end

0 commit comments

Comments
 (0)