Skip to content

Commit f2fac52

Browse files
committed
Rename the master branch to main
1 parent a4808ec commit f2fac52

File tree

8 files changed

+45
-45
lines changed

8 files changed

+45
-45
lines changed

bin/generate_docs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
LockFile.acquiring('docs_generation.lock') do
1010
git_manager = GitManager.new(Dir.home)
11-
git_manager.update_master
11+
git_manager.update_main
1212

1313
generator = DocsGenerator.new(Dir.home, git_manager)
1414
generator.generate

config/crontab

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BASH_ENV=~/.profile
3232

3333
# Git complains from time to time about unreachable objects. This job makes sure
3434
# the repo is kept in good shape.
35-
@daily cd ~/master && git prune && git gc
35+
@daily cd ~/main && git prune && git gc
3636
@daily cd ~/rails-contributors/shared/rails.git && git prune && git gc
3737

3838
@reboot cd ~/rails-contributors/current && bundle exec puma -C /home/rails/rails-contributors/shared/puma.rb --daemon

lib/docs_generator.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
require 'docs_compressor'
44
require 'git_manager'
55
require 'generators/release'
6-
require 'generators/master'
6+
require 'generators/main'
77
require 'version_number'
88

99
# This class is responsible for coordinating docs generation.
1010
#
11-
# The documentation is generated below `basedir`. There, each release and master
11+
# The documentation is generated below `basedir`. There, each release and main
1212
# have their own directory:
1313
#
1414
# tag1
1515
# tag2
1616
# tag3
1717
# ...
1818
# tagN
19-
# master
19+
# main
2020
#
2121
# The generator checks the current release tags of the project to detect new
2222
# releases in any of the branches from 3.2 up.
@@ -29,7 +29,7 @@
2929
# api/v4.1.0 -> basedir/v4.1.0/doc/rdoc
3030
# api/v4.1 -> api/v4.1.0
3131
# api/stable -> api/v4.1.0
32-
# api/edge -> basedir/master/doc/rdoc
32+
# api/edge -> basedir/main/doc/rdoc
3333
#
3434
# and same for guides:
3535
#
@@ -38,15 +38,15 @@
3838
# guides/v4.1.0 -> basedir/v4.1.0/guides/output
3939
# guides/v4.1 -> guides/v4.1.0
4040
# guides/stable -> guides/v4.1.0
41-
# guides/edge -> basedir/master/guides/output
41+
# guides/edge -> basedir/main/guides/output
4242
#
4343
# If new releases are detected, symlinks are adjusted as needed.
4444
#
4545
# Once everything related to release docs is done, edge docs are generated.
4646
#
4747
# Documentation files are further compressed to leverage NGINX gzip_static.
4848
#
49-
# The docs generator assumes a master directory with an up to date working
49+
# The docs generator assumes a main directory with an up to date working
5050
# copy, it is the responsability of the caller to get that in place via the
5151
# git manager. It is also the responsibility of the caller to ensure there is
5252
# only one generator being executed at the same time.
@@ -109,14 +109,14 @@ def generate_docs_for_release(tag)
109109
end
110110

111111
def generate_edge_docs
112-
generator = Generators::Master.new(git_manager.short_sha1, 'master')
112+
generator = Generators::Main.new(git_manager.short_sha1, 'main')
113113
generator.generate
114114

115115
DocsCompressor.new(generator.api_output).compress
116116
DocsCompressor.new(generator.guides_output).compress
117117

118118
# Force the recreation of the symlink to be forward compatible, if the docs
119-
# structure changes in master we need the symlink to point to the new dirs.
119+
# structure changes in main we need the symlink to point to the new dirs.
120120
create_api_symlink(generator.api_output, EDGE, force: true)
121121
create_guides_symlink(generator.guides_output, EDGE, force: true)
122122
end

lib/generators/config/master.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Generators
22
module Config
3-
module Master
3+
module Main
44
def ruby_version
55
'2.5.3'
66
end

lib/generators/master.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
require 'find'
22
require 'fileutils'
33
require 'generators/base'
4-
require 'generators/config/master'
4+
require 'generators/config/main'
55

66
module Generators
7-
class Master < Base
8-
include Config::Master
7+
class Main < Base
8+
include Config::Main
99

1010
def generate_api
1111
start = Time.now

lib/git_manager.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ def remote_rails_url
1616
'https://github.com/rails/rails.git'
1717
end
1818

19-
def update_master
19+
def update_main
2020
Dir.chdir(basedir) do
21-
unless Dir.exist?('master')
22-
log "cloning master into #{basedir}/master"
23-
log_and_system "git clone -q #{remote_rails_url} master"
21+
unless Dir.exist?('main')
22+
log "cloning main into #{basedir}/main"
23+
log_and_system "git clone -q #{remote_rails_url} main"
2424
end
2525

26-
Dir.chdir('master') do
27-
log 'updating master'
26+
Dir.chdir('main') do
27+
log 'updating main'
2828

2929
# Bundler may modify BUNDLED WITH in Gemfile.lock and that may prevent
3030
# git pull from succeeding. Starting with Bundler 1.10, if Gemfile.lock
@@ -48,7 +48,7 @@ def checkout(tag)
4848
end
4949

5050
def release_tags
51-
Dir.chdir("#{basedir}/master") do
51+
Dir.chdir("#{basedir}/main") do
5252
`git tag`.scan(/^v[\d.]+$/)
5353
end
5454
end
@@ -58,7 +58,7 @@ def short_sha1
5858
end
5959

6060
def sha1
61-
Dir.chdir("#{basedir}/master") do
61+
Dir.chdir("#{basedir}/main") do
6262
`git rev-parse HEAD`.chomp
6363
end
6464
end

test/docs_generator_test.rb

+16-16
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ def test_generates_docs
6464
mkdir 'basedir'
6565

6666
git_manager = GitManager.new('basedir')
67-
git_manager.update_master
67+
git_manager.update_main
6868

69-
mkdir_p 'master/doc/rdoc'
69+
mkdir_p 'main/doc/rdoc'
7070

71-
html_orphan = 'master/doc/rdoc/orphan.html'
71+
html_orphan = 'main/doc/rdoc/orphan.html'
7272
touch html_orphan
7373
assert_exists html_orphan # ensure the setup is correct to prevent a false positive later
7474

75-
html_gz_orphan = 'master/doc/rdoc/orphan.html.gz'
75+
html_gz_orphan = 'main/doc/rdoc/orphan.html.gz'
7676
touch html_gz_orphan
7777
assert_exists html_gz_orphan # ensure the setup is correct to prevent a false positive later
7878

@@ -114,24 +114,24 @@ def test_generates_docs
114114
# --- Edge ---------------------------------------------------------------
115115
#
116116

117-
assert_exists 'master/doc/rdoc/index.html'
118-
assert_exists 'master/doc/rdoc/index.html.gz'
119-
assert_exists 'master/doc/rdoc/edge_badge.png'
117+
assert_exists 'main/doc/rdoc/index.html'
118+
assert_exists 'main/doc/rdoc/index.html.gz'
119+
assert_exists 'main/doc/rdoc/edge_badge.png'
120120

121-
html = File.read('master/doc/rdoc/files/railties/RDOC_MAIN_rdoc.html')
122-
assert html.include?("Ruby on Rails master@#{git_manager.short_sha1}")
121+
html = File.read('main/doc/rdoc/files/railties/RDOC_MAIN_rdoc.html')
122+
assert html.include?("Ruby on Rails main@#{git_manager.short_sha1}")
123123
assert html.include?('<img src="/edge_badge.png"')
124124

125-
assert !File.read('master/doc/rdoc/panel/index.html').include?('edge_badge.png')
125+
assert !File.read('main/doc/rdoc/panel/index.html').include?('edge_badge.png')
126126

127-
assert_exists 'master/guides/output/index.html'
128-
assert_exists 'master/guides/output/index.html.gz'
129-
refute_exists "master/guides/output/kindle/ruby_on_rails_guides_#{git_manager.short_sha1}.mobi"
127+
assert_exists 'main/guides/output/index.html'
128+
assert_exists 'main/guides/output/index.html.gz'
129+
refute_exists "main/guides/output/kindle/ruby_on_rails_guides_#{git_manager.short_sha1}.mobi"
130130

131-
assert_equal File.expand_path('master/doc/rdoc'), File.readlink('api/edge')
132-
assert_equal File.expand_path('master/guides/output'), File.readlink('guides/edge')
131+
assert_equal File.expand_path('main/doc/rdoc'), File.readlink('api/edge')
132+
assert_equal File.expand_path('main/guides/output'), File.readlink('guides/edge')
133133

134-
html = File.read('master/guides/output/index.html')
134+
html = File.read('main/guides/output/index.html')
135135
assert html.include?("Ruby on Rails Guides (#{git_manager.short_sha1})")
136136
assert html.include?('<img src="images/edge_badge.png"')
137137

test/git_manager_test.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def create_repository
1212

1313
def test_checkout
1414
in_tmpdir do
15-
mkdir_p 'basedir/master'
15+
mkdir_p 'basedir/main'
1616

17-
chdir 'basedir/master' do
17+
chdir 'basedir/main' do
1818
create_repository
1919

2020
system 'echo t1 > README'
@@ -27,7 +27,7 @@ def test_checkout
2727
end
2828

2929
gm = GitManager.new('basedir')
30-
gm.stub('remote_rails_url', "file://#{Dir.pwd}/basedir/master") do
30+
gm.stub('remote_rails_url', "file://#{Dir.pwd}/basedir/main") do
3131
gm.checkout('t1')
3232
end
3333

@@ -38,9 +38,9 @@ def test_checkout
3838

3939
def test_release_tags
4040
in_tmpdir do
41-
mkdir_p 'basedir/master'
41+
mkdir_p 'basedir/main'
4242

43-
chdir 'basedir/master' do
43+
chdir 'basedir/main' do
4444
create_repository
4545
%w(0.9.4.1 2.3.9.pre 3.0.0_RC2 3.2.8.rc1 3.2.14 v4.0.0.beta1 4.0.1).each do |version|
4646
system "git tag v#{version}"
@@ -54,10 +54,10 @@ def test_release_tags
5454

5555
def test_sha1_and_short_sha1
5656
in_tmpdir do
57-
mkdir_p 'basedir/master'
57+
mkdir_p 'basedir/main'
5858

5959
sha1 = nil
60-
chdir 'basedir/master' do
60+
chdir 'basedir/main' do
6161
create_repository
6262
sha1 = `git rev-parse HEAD`.chomp
6363
end

0 commit comments

Comments
 (0)