Skip to content

Commit e660651

Browse files
Merge branch 'master' into to-ruby-from-javascript-2767
2 parents 848b1fd + 3e0393e commit e660651

1,638 files changed

Lines changed: 125561 additions & 7061 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,23 @@ jobs:
2121
- name: Dump environment
2222
run: env | sort
2323
- name: Checkout ruby/www.ruby-lang.org
24-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2525
with:
2626
fetch-depth: 1
2727
- name: Setup Ruby
28-
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
28+
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
2929
with:
3030
ruby-version: ${{ matrix.ruby }}
3131
bundler-cache: true
32+
- name: Setup Node.js
33+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
34+
with:
35+
node-version: '22'
36+
cache: 'npm'
37+
- name: Install npm dependencies
38+
run: npm ci
39+
- name: Build CSS
40+
run: npm run build-css
3241
- name: Dump Ruby version
3342
run: ruby -v
3443
- name: Run tests

.github/workflows/draft-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
runs-on: ubuntu-latest
1717
if: github.repository == 'ruby/www.ruby-lang.org'
1818
steps:
19-
- uses: actions/checkout@v5
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2020

21-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222
with:
2323
repository: ruby/ruby
2424
path: ruby
2525

26-
- uses: ruby/setup-ruby@v1
26+
- uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
2727
with:
2828
ruby-version: 3.3.4
2929

@@ -33,7 +33,7 @@ jobs:
3333
3434
- name: Update data files
3535
run: |
36-
tool/format-release .. ${{ github.event.client_payload.version || github.event.inputs.version }} .
36+
tool/format-release .. ${{ github.event.client_payload.version || github.event.inputs.version }} . | (cd .. && git apply)
3737
working-directory: ruby
3838

3939
- name: Cleanup ruby directory
@@ -50,7 +50,7 @@ jobs:
5050
GITHUB_TOKEN: ${{ secrets.MATZBOT_AUTO_UPDATE_TOKEN }}
5151

5252
- name: Create Pull Request
53-
uses: peter-evans/create-pull-request@v7
53+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
5454
with:
5555
token: ${{ secrets.MATZBOT_AUTO_UPDATE_TOKEN }}
5656
branch: releases/${{ github.event.client_payload.version || github.event.inputs.version }}

.github/workflows/jekyll.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,30 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2525
- name: Setup Ruby
26-
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
26+
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
2727
with:
2828
ruby-version: '3.2'
2929
bundler-cache: true
30+
- name: Setup Node.js
31+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
32+
with:
33+
node-version: '22'
34+
cache: 'npm'
35+
- name: Install npm dependencies
36+
run: npm ci
37+
- name: Build CSS
38+
run: npm run build-css
3039
- name: Setup Pages
3140
id: pages
32-
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
41+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
3342
- name: Build with Jekyll
3443
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
3544
env:
3645
JEKYLL_ENV: production
3746
- name: Upload artifact
38-
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
47+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
3948

4049
deploy:
4150
if: github.repository_owner == 'ruby'
@@ -47,4 +56,4 @@ jobs:
4756
steps:
4857
- name: Deploy to GitHub Pages
4958
id: deployment
50-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
59+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ vendor
88
.env
99
bin
1010
.jekyll*
11+
node_modules/
12+
stylesheets/compiled.css
13+
_figma/
14+
_svg-backup/

404.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,23 @@
22
layout: page
33
title: "404: Not Found"
44
lang: en
5-
permalink: 404.html
5+
permalink: /404.html
66
---
77

8+
<script>
9+
(function() {
10+
// Detect language from URL path
11+
var path = window.location.pathname;
12+
var match = path.match(/^\/(bg|de|en|es|fr|id|it|ja|ko|pl|pt|ru|tr|ua|vi|zh_cn|zh_tw)\//);
13+
14+
if (match && match[1] !== 'en') {
15+
var lang = match[1];
16+
// Redirect to language-specific 404 page
17+
window.location.href = '/' + lang + '/404.html';
18+
}
19+
})();
20+
</script>
21+
822
The requested page does not exist.
923

1024
You might try and start from the [home page](/).

CLAUDE.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the Jekyll-based source for the official Ruby programming language website (www.ruby-lang.org), featuring multi-language support for 16+ languages and a Tailwind CSS-based design system.
8+
9+
## Build & Development Commands
10+
11+
### Jekyll Site Operations
12+
13+
```bash
14+
# Build the site (takes several minutes)
15+
bundle exec rake build
16+
17+
# Serve locally at http://localhost:4000/
18+
bundle exec rake serve
19+
20+
# Alternative: Jekyll direct serve with incremental builds
21+
bundle exec jekyll serve --watch --future --incremental
22+
```
23+
24+
### CSS (Tailwind)
25+
26+
```bash
27+
# Build CSS (production)
28+
npm run build-css
29+
30+
# Watch CSS for development
31+
npm run watch-css
32+
```
33+
34+
### Testing & Quality Assurance
35+
36+
```bash
37+
# Run all tests (includes linter, lint, build)
38+
bundle exec rake test
39+
40+
# Run individual test suites
41+
bundle exec rake test-news-plugin # News archive plugin tests
42+
bundle exec rake test-linter # Linter library tests
43+
44+
# Linting
45+
bundle exec rake lint # Markdown linter
46+
47+
# Post-build validation (requires built site)
48+
bundle exec rake check:markup # Validate HTML markup
49+
bundle exec rake check:links # Check for broken links (needs local server running)
50+
```
51+
52+
### Creating News Posts
53+
54+
```bash
55+
# Create news post template for specific language
56+
bundle exec rake new_post:en # English
57+
bundle exec rake new_post:ja # Japanese
58+
bundle exec rake new_post:fr # French
59+
# ... etc for: bg, de, es, id, it, ko, pl, pt, ru, tr, vi, zh_cn, zh_tw
60+
```
61+
62+
## Architecture & Structure
63+
64+
### Multi-Language System
65+
66+
- **16 supported languages**: bg, de, en, es, fr, id, it, ja, ko, pl, pt, ru, tr, vi, zh_cn, zh_tw
67+
- Language-specific content organized in top-level directories (e.g., `/en/`, `/ja/`)
68+
- Locale data stored in `_data/locales/*.yml`
69+
- Language switching handled by `_includes/language_selector.html`
70+
71+
### Jekyll Configuration
72+
73+
- **Markdown**: Kramdown with Rouge syntax highlighting
74+
- **Timezone**: UTC (critical for news posts)
75+
- **Permalinks**: Pretty URLs
76+
- **Build output**: `_site/` directory
77+
78+
### Key Directories
79+
80+
- `_layouts/`: Page templates (default, homepage, news_post, news_archive_month, etc.)
81+
- `_includes/`: Reusable components (header, footer, navigation, toc, sidebar)
82+
- `_plugins/`: Custom Jekyll plugins (news archive generator, posted_by, translation_status)
83+
- `_data/`: YAML data files (releases.yml, downloads.yml, branches.yml, locales/)
84+
- `lib/`: Ruby utilities (linter, markup checker, draft release)
85+
- `test/`: Test files for plugins and linter
86+
- `stylesheets/`: CSS source and compiled output
87+
- `_javascripts_src/`: TypeScript source files
88+
- `javascripts/`: Compiled JavaScript output
89+
90+
### Design System (Tailwind CSS)
91+
92+
The site uses a custom Tailwind configuration with:
93+
94+
- **Semantic color tokens** via CSS variables (defined in `tailesheets/semantic-colors.css`)
95+
- Accessible via `bg-semantic-*`, `text-semantic-*`, `border-semantic-*` classes
96+
- Automatically handles light/dark mode via `prefers-color-scheme`
97+
- **Brand colors**: Ruby (red) and Gold palettes
98+
- **Typography plugin** for prose styling
99+
- **Custom breakpoints**: Container max-widths configured for content layouts
100+
- **Dark mode**: Enabled via OS preference (`darkMode: 'media'`)
101+
102+
Input: `stylesheets/tailwind.css` → Output: `stylesheets/compiled.css`
103+
104+
### News System
105+
106+
The news system is powered by a custom Jekyll plugin (`_plugins/news.rb`):
107+
108+
- **Archive generation**: Automatically creates yearly/monthly archive pages
109+
- **Post structure**: Posts stored in `{lang}/news/_posts/YYYY-MM-DD-title.md`
110+
- **Archive pages**: Index, yearly archives, monthly archives
111+
- **RSS feeds**: Generated per language via `news_feed.rss` layout
112+
113+
### Linter (`lib/linter.rb`)
114+
115+
Enforces strict content quality rules:
116+
117+
- YAML front matter validation (lang, author, translator, date)
118+
- File naming conventions (date must match filename)
119+
- UTC timezone enforcement for news posts
120+
- Line ending consistency (LF only, no CRLF)
121+
- Trailing whitespace checks
122+
- Release post SHA hash validation (SHA1/SHA256/SHA512)
123+
- Release data validation against `_data/releases.yml`
124+
125+
### Layout Hierarchy
126+
127+
```
128+
default.html (base)
129+
├── homepage.html
130+
├── page.html
131+
├── news.html
132+
├── news_post.html
133+
├── news_archive_year.html
134+
├── news_archive_month.html
135+
└── news_feed.rss
136+
```
137+
138+
### Front Matter Requirements
139+
140+
**Standard pages:**
141+
```yaml
142+
---
143+
layout: page
144+
title: "Page Title"
145+
lang: en
146+
---
147+
```
148+
149+
**News posts:**
150+
```yaml
151+
---
152+
layout: news_post
153+
title: "Post Title"
154+
author: "Author Name"
155+
translator: "Translator Name" # Required for non-original language
156+
date: YYYY-MM-DD HH:MM:SS +0000 # Must be UTC
157+
lang: en
158+
---
159+
```
160+
161+
## TypeScript/JavaScript
162+
163+
- Source files in `_javascripts_src/` (TypeScript)
164+
- Compiled to `javascripts/` (JavaScript)
165+
- Files: `examples.ts`, `page.ts`
166+
- No build command specified - likely manual compilation or external process
167+
168+
## Dependencies
169+
170+
**Ruby (Gemfile):**
171+
- `jekyll` - Static site generator
172+
- `rouge` - Syntax highlighting
173+
- `rake` - Task automation
174+
- `html-proofer` - Markup validation
175+
- `validate-website` - Link checking
176+
- `minitest` - Testing framework
177+
- `csv`, `base64` - Ruby 3.4+ compatibility
178+
179+
**Node (package.json):**
180+
- `tailwindcss` - CSS framework
181+
- `@tailwindcss/typography` - Prose styling plugin
182+
183+
## Important Conventions
184+
185+
1. **All news posts must use UTC timezone** (`+0000`) in the date field
186+
2. **File naming**: News posts must be `YYYY-MM-DD-title.md` matching the date in front matter
187+
3. **Language codes**: Must match directory structure (e.g., `lang: en` for files in `/en/`)
188+
4. **Translator field**: Required for translated news posts, not for original posts
189+
5. **Line endings**: LF only, no CRLF
190+
6. **Release posts**: Must include valid SHA checksums if referencing downloads
191+
192+
## CI/CD
193+
194+
GitHub Actions workflow (`.github/workflows/ci.yml`):
195+
- Runs on: Ruby 3.2, Ubuntu latest
196+
- Executes: `bundle exec rake test` (includes linter, lint, build)
197+
- Triggers: Push and pull requests

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ gem "validate-website", "~> 1.6"
1414
# Jekyll need them for Ruby 3.4+
1515
gem "csv"
1616
gem "base64"
17+
18+
# Jekyll need this for Ruby 4.0.0+
19+
gem "logger"

0 commit comments

Comments
 (0)