aboutsummaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2017-08-01 17:34:14 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-08-01 17:34:14 -0400
commitfeb1ddae021c38174f9c22bbd1298c8b73431b45 (patch)
tree09a38695596cf80dc362dd4d93cf94d6f7415e7b /tasks
parent3540e60c385286f3517ff56270b31a91ed3024a3 (diff)
parentf9a43f28c087f8ffd35ff7c33a60c938b60f2be2 (diff)
downloadrails-feb1ddae021c38174f9c22bbd1298c8b73431b45.tar.gz
rails-feb1ddae021c38174f9c22bbd1298c8b73431b45.tar.bz2
rails-feb1ddae021c38174f9c22bbd1298c8b73431b45.zip
Merge remote-tracking branch 'origin/master' into unlock-minitest
Diffstat (limited to 'tasks')
-rw-r--r--tasks/release.rb108
-rw-r--r--tasks/release_announcement_draft.erb38
2 files changed, 94 insertions, 52 deletions
diff --git a/tasks/release.rb b/tasks/release.rb
index 038fdc584a..b3bbbb0076 100644
--- a/tasks/release.rb
+++ b/tasks/release.rb
@@ -142,7 +142,7 @@ namespace :all do
task push: FRAMEWORKS.map { |f| "#{f}:push" } + ["rails:push"]
task :ensure_clean_state do
- unless `git status -s | grep -v 'RAILS_VERSION\\|CHANGELOG\\|Gemfile.lock\\|package.json\\|version.rb'`.strip.empty?
+ unless `git status -s | grep -v 'RAILS_VERSION\\|CHANGELOG\\|Gemfile.lock\\|package.json\\|version.rb\\|tasks/release.rb'`.strip.empty?
abort "[ABORTING] `git status` reports a dirty tree. Make sure all changes are committed"
end
@@ -152,6 +152,32 @@ namespace :all do
end
end
+ task verify: :install do
+ app_name = "pkg/verify-#{version}-#{Time.now.to_i}"
+ sh "rails _#{version}_ new #{app_name} --skip-bundle" # Generate with the right version.
+ cd app_name
+
+ # Replace the generated gemfile entry with the exact version.
+ File.write("Gemfile", File.read("Gemfile").sub(/^gem 'rails.*/, "gem 'rails', '#{version}'"))
+ sh "bundle"
+
+ sh "rails generate scaffold user name admin:boolean && rails db:migrate"
+
+ puts "Booting a Rails server. Verify the release by:"
+ puts
+ puts "- Seeing the correct release number on the root page"
+ puts "- Viewing /users"
+ puts "- Creating a user"
+ puts "- Updating a user (e.g. disable the admin flag)"
+ puts "- Deleting a user on /users"
+ puts "- Whatever else you want."
+ begin
+ sh "rails server"
+ rescue Interrupt
+ # Server passes along interrupt. Prevent halting verify task.
+ end
+ end
+
task :bundle do
sh "bundle check"
end
@@ -179,69 +205,47 @@ namespace :all do
task release: %w(prep_release tag push)
end
-task :announce do
- Dir.chdir("pkg/") do
- if gem_version.segments[2] == 0 || gem_version.segments[3].is_a?(Integer)
- # Not major releases, and not security releases
- raise "Only valid for patch releases"
+module Announcement
+ class Version
+ def initialize(version)
+ @version, @gem_version = version, Gem::Version.new(version)
end
- sums = "$ shasum -a 256 *-#{version}.gem\n" + `shasum -a 256 *-#{version}.gem`
+ def to_s
+ @version
+ end
- puts "Hi everyone,"
- puts
+ def previous
+ @gem_version.segments[0, 3].tap { |v| v[2] -= 1 }.join(".")
+ end
- puts "I am happy to announce that Rails #{version} has been released."
- puts
+ def major_or_security?
+ @gem_version.segments[2].zero? || @gem_version.segments[3].is_a?(Integer)
+ end
+
+ def rc?
+ @version =~ /rc/
+ end
+ end
+end
- previous_version = gem_version.segments[0, 3]
- previous_version[2] -= 1
- previous_version = previous_version.join(".")
+task :announce do
+ Dir.chdir("pkg/") do
+ versions = ENV["VERSIONS"] ? ENV["VERSIONS"].split(",") : [ version ]
+ versions = versions.sort.map { |v| Announcement::Version.new(v) }
- if version =~ /rc/
+ raise "Only valid for patch releases" if versions.any?(&:major_or_security?)
+
+ if versions.any?(&:rc?)
require "date"
future_date = Date.today + 5
future_date += 1 while future_date.saturday? || future_date.sunday?
github_user = `git config github.user`.chomp
-
- puts <<MSG
-If no regressions are found, expect the final release on #{future_date.strftime('%A, %B %-d, %Y')}.
-If you find one, please open an [issue on GitHub](https://github.com/rails/rails/issues/new)
-#{"and mention me (@#{github_user}) on it, " unless github_user.empty?}so that we can fix it before the final release.
-
-MSG
end
- puts <<MSG
-## CHANGES since #{previous_version}
-
-To view the changes for each gem, please read the changelogs on GitHub:
-
-MSG
- FRAMEWORKS.sort.each do |framework|
- puts "* [#{FRAMEWORK_NAMES[framework]} CHANGELOG](https://github.com/rails/rails/blob/v#{version}/#{framework}/CHANGELOG.md)"
- end
- puts <<MSG
-
-*Full listing*
-
-To see the full list of changes, [check out all the commits on
-GitHub](https://github.com/rails/rails/compare/v#{previous_version}...v#{version}).
-
-## SHA-256
-
-If you'd like to verify that your gem is the same as the one I've uploaded,
-please use these SHA-256 hashes.
-
-Here are the checksums for #{version}:
-
-```
-#{sums}
-```
-
-As always, huge thanks to the many contributors who helped with this release.
-
-MSG
+ require "erb"
+ template = File.read("../tasks/release_announcement_draft.erb")
+ puts ERB.new(template, nil, "<>").result(binding)
end
end
diff --git a/tasks/release_announcement_draft.erb b/tasks/release_announcement_draft.erb
new file mode 100644
index 0000000000..3dbb8c053f
--- /dev/null
+++ b/tasks/release_announcement_draft.erb
@@ -0,0 +1,38 @@
+Hi everyone,
+
+I am happy to announce that Rails <%= versions.join(" and ") %> <%= versions.size > 1 ? "have" : "has" %> been released.
+
+<% if future_date %>
+If no regressions are found, expect the final release on <%= future_date.strftime("%A, %B %-d, %Y") %>.
+If you find one, please open an [issue on GitHub](https://github.com/rails/rails/issues/new)
+<%= "and mention me (@#{github_user}) on it, " unless github_user.empty? %>so that we can fix it before the final release.
+<% end %>
+<% versions.each do |version| %>
+
+## CHANGES since <%= version.previous %>
+
+To view the changes for each gem, please read the changelogs on GitHub:
+ <% FRAMEWORKS.sort.each do |framework| %>
+<%= "* [#{FRAMEWORK_NAMES[framework]} CHANGELOG](https://github.com/rails/rails/blob/v#{version}/#{framework}/CHANGELOG.md)" %>
+ <% end %>
+
+*Full listing*
+
+To see the full list of changes, [check out all the commits on
+GitHub](https://github.com/rails/rails/compare/v<%= "#{version.previous}...v#{version}" %>).
+ <% end %>
+## SHA-256
+
+If you'd like to verify that your gem is the same as the one I've uploaded,
+please use these SHA-256 hashes.
+
+<% versions.each do |version| %>
+Here are the checksums for <%= version %>:
+
+```
+$ shasum -a 256 *-<%= version %>.gem
+<%= `shasum -a 256 *-#{version}.gem` %>
+```
+
+<% end %>
+As always, huge thanks to the many contributors who helped with this release.