2017-08-13 13:14:22 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-06 17:28:46 +00:00
|
|
|
require "net/http"
|
2007-10-15 00:10:39 +00:00
|
|
|
|
2017-05-15 14:17:28 +00:00
|
|
|
$:.unshift __dir__
|
2010-11-16 23:42:39 +00:00
|
|
|
require "tasks/release"
|
2016-08-06 17:28:46 +00:00
|
|
|
require "railties/lib/rails/api/task"
|
2024-02-13 03:53:39 +00:00
|
|
|
require "tools/preview_docs"
|
2010-11-16 23:42:39 +00:00
|
|
|
|
|
|
|
desc "Build gem files for all projects"
|
2016-08-06 17:40:54 +00:00
|
|
|
task build: "all:build"
|
2010-11-16 23:42:39 +00:00
|
|
|
|
2017-07-22 15:49:40 +00:00
|
|
|
desc "Build, install and verify the gem files in a generated Rails app."
|
|
|
|
task verify: "all:verify"
|
|
|
|
|
2015-12-18 16:56:26 +00:00
|
|
|
desc "Prepare the release"
|
2016-08-06 17:40:54 +00:00
|
|
|
task prep_release: "all:prep_release"
|
2015-12-18 16:56:26 +00:00
|
|
|
|
2013-06-21 08:57:00 +00:00
|
|
|
desc "Release all gems to rubygems and create a tag"
|
2016-08-06 17:40:54 +00:00
|
|
|
task release: "all:release"
|
2010-11-16 23:42:39 +00:00
|
|
|
|
2016-08-06 17:28:46 +00:00
|
|
|
desc "Run all tests by default"
|
2016-08-06 17:40:54 +00:00
|
|
|
task default: %w(test test:isolated)
|
2007-10-15 00:10:39 +00:00
|
|
|
|
2010-07-23 22:35:22 +00:00
|
|
|
%w(test test:isolated package gem).each do |task_name|
|
2007-10-15 00:10:39 +00:00
|
|
|
desc "Run #{task_name} task for all projects"
|
|
|
|
task task_name do
|
2009-05-18 09:13:51 +00:00
|
|
|
errors = []
|
2015-12-17 15:12:03 +00:00
|
|
|
FRAMEWORKS.each do |project|
|
2016-03-21 00:00:46 +00:00
|
|
|
system(%(cd #{project} && #{$0} #{task_name} --trace)) || errors << project
|
|
|
|
end
|
2009-05-18 09:13:51 +00:00
|
|
|
fail("Errors in #{errors.join(', ')}") unless errors.empty?
|
2007-10-15 00:10:39 +00:00
|
|
|
end
|
|
|
|
end
|
2008-06-19 03:49:31 +00:00
|
|
|
|
2009-12-28 20:28:37 +00:00
|
|
|
desc "Smoke-test all projects"
|
2024-06-12 03:18:01 +00:00
|
|
|
task :smoke, [:frameworks, :isolated] do |task, args|
|
|
|
|
frameworks = args[:frameworks] ? args[:frameworks].split(" ") : FRAMEWORKS
|
|
|
|
# The arguments are positional, and users may want to specify only the isolated flag.. so we allow 'all' as a default for the first argument:
|
|
|
|
if frameworks.include?("all")
|
|
|
|
frameworks = FRAMEWORKS
|
|
|
|
end
|
|
|
|
|
|
|
|
isolated = args[:isolated].nil? ? true : args[:isolated] == "true"
|
|
|
|
test_task = isolated ? "test:isolated" : "test"
|
|
|
|
|
|
|
|
(frameworks - ["activerecord"]).each do |project|
|
|
|
|
system %(cd #{project} && #{$0} #{test_task} --trace)
|
|
|
|
end
|
|
|
|
|
|
|
|
if frameworks.include? "activerecord"
|
|
|
|
test_task = isolated ? "sqlite3:isolated_test" : "sqlite3:test"
|
|
|
|
system %(cd activerecord && #{$0} #{test_task} --trace)
|
2009-12-28 20:28:37 +00:00
|
|
|
end
|
|
|
|
end
|
2009-12-01 00:46:09 +00:00
|
|
|
|
2010-02-21 13:18:40 +00:00
|
|
|
desc "Install gems for all projects."
|
2016-08-06 17:40:54 +00:00
|
|
|
task install: "all:install"
|
2009-08-27 10:00:14 +00:00
|
|
|
|
2008-06-19 03:49:31 +00:00
|
|
|
desc "Generate documentation for the Rails framework"
|
2016-08-06 17:28:46 +00:00
|
|
|
if ENV["EDGE"]
|
|
|
|
Rails::API::EdgeTask.new("rdoc")
|
2013-07-06 20:40:02 +00:00
|
|
|
else
|
2016-08-06 17:28:46 +00:00
|
|
|
Rails::API::StableTask.new("rdoc")
|
2013-07-06 20:40:02 +00:00
|
|
|
end
|
2008-06-19 03:49:31 +00:00
|
|
|
|
2024-02-13 03:53:39 +00:00
|
|
|
desc "Generate documentation for previewing"
|
|
|
|
task :preview_docs do
|
|
|
|
FileUtils.mkdir_p("preview")
|
|
|
|
PreviewDocs.new.render("preview")
|
|
|
|
|
|
|
|
require "guides/rails_guides"
|
|
|
|
Rake::Task[:rdoc].invoke
|
|
|
|
|
2024-04-24 01:02:56 +00:00
|
|
|
FileUtils.mv("doc/rdoc", "preview/api")
|
|
|
|
FileUtils.mv("guides/output", "preview/guides")
|
2024-02-13 03:53:39 +00:00
|
|
|
|
2024-04-26 07:13:01 +00:00
|
|
|
system("tar -czf preview.tar.gz -C preview .")
|
2024-02-13 03:53:39 +00:00
|
|
|
end
|
|
|
|
|
2016-08-06 17:28:46 +00:00
|
|
|
desc "Bump all versions to match RAILS_VERSION"
|
2016-08-06 17:40:54 +00:00
|
|
|
task update_versions: "all:update_versions"
|
2010-11-16 13:07:55 +00:00
|
|
|
|
2013-05-05 12:26:24 +00:00
|
|
|
# We have a webhook configured in GitHub that gets invoked after pushes.
|
2010-11-16 13:07:55 +00:00
|
|
|
# This hook triggers the following tasks:
|
|
|
|
#
|
|
|
|
# * updates the local checkout
|
|
|
|
# * updates Rails Contributors
|
|
|
|
# * generates and publishes edge docs
|
|
|
|
# * if there's a new stable tag, generates and publishes stable docs
|
|
|
|
#
|
|
|
|
# Everything is automated and you do NOT need to run this task normally.
|
2016-08-06 17:28:46 +00:00
|
|
|
desc "Publishes docs, run this AFTER a new stable tag has been pushed"
|
2010-11-16 13:07:55 +00:00
|
|
|
task :publish_docs do
|
2016-08-06 17:28:46 +00:00
|
|
|
Net::HTTP.new("api.rubyonrails.org", 8080).start do |http|
|
|
|
|
request = Net::HTTP::Post.new("/rails-master-hook")
|
2010-11-16 13:07:55 +00:00
|
|
|
response = http.request(request)
|
|
|
|
puts response.body
|
|
|
|
end
|
|
|
|
end
|