From a98b48341fbb25bd5d9c10e21877084e68f7874d Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sun, 12 May 2024 19:02:32 +0900 Subject: [PATCH 1/4] Add language detection for links Implemented a script that changes the link paths based on the user's browser language. Specifically, if the user's language is set to Japanese, all links with the class 'intl' will have their href paths changed from '/en/' to '/ja/'. This will provide users with content in their native language, enhancing user experience. --- _includes/manuals/1.0/header.html | 2 +- index.html | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/_includes/manuals/1.0/header.html b/_includes/manuals/1.0/header.html index aad599be..7ee49e20 100644 --- a/_includes/manuals/1.0/header.html +++ b/_includes/manuals/1.0/header.html @@ -26,7 +26,7 @@ Home diff --git a/index.html b/index.html index 111b6b92..289f44f2 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,18 @@

Ray.Di

Objects are injected from the interface, just as sun ray is injected when a window is opened. Ray.Di is a dependency injection framework for PHP inspired Google Guice.

- + Overview » + From db82afe982d472838dc2284567c610b89ab528cf Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sun, 12 May 2024 20:02:50 +0900 Subject: [PATCH 2/4] Remove serve.sh and serve_arm.sh while adding new serving scripts and updating Docker configuration for local development Deleted two shell scripts that were used for serving the Jekyll site: serve.sh and serve_arm.sh. To replace these, two new scripts serve_docker.sh and serve_local.sh were created to provide a better local development experience. Docker configuration has been updated along with Dockerfile. A bundle `Gemfile.lock` has been added. Further, `Gemfile`, `.ruby-version` files were created to specify the versions of gems and ruby used. --- .ruby-version | 1 + Dockerfile | 16 +++++- Gemfile | 37 ++++++++++++ Gemfile.lock | 134 ++++++++++++++++++++++++++++++++++++++++++++ bin/serve.sh | 3 - bin/serve_arm.sh | 3 - bin/serve_docker.sh | 3 + bin/serve_local.sh | 6 ++ docker-compose.yml | 5 +- 9 files changed, 197 insertions(+), 11 deletions(-) create mode 100644 .ruby-version create mode 100644 Gemfile create mode 100644 Gemfile.lock delete mode 100755 bin/serve.sh delete mode 100755 bin/serve_arm.sh create mode 100755 bin/serve_docker.sh create mode 100755 bin/serve_local.sh diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..be94e6f5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.2 diff --git a/Dockerfile b/Dockerfile index 77e051c9..3911ffc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,14 @@ -FROM jekyll/jekyll:pages -RUN gem install webrick +FROM ruby:3.2 + +RUN apt-get update && apt-get install -y \ + build-essential \ + libffi-dev + +RUN gem install bundler webrick + +WORKDIR /app +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +EXPOSE 4000 +CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0"] diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..99f7224b --- /dev/null +++ b/Gemfile @@ -0,0 +1,37 @@ +source "https://rubygems.org" +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +#gem "jekyll", "~> 4.3.2" +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "minima", "~> 2.5" +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +# gem "github-pages", group: :jekyll_plugins +# gem "github-pages", ">= 231", group: :jekyll_plugins +gem "webrick" + +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jekyll-feed", "~> 0.12" +end + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] +gem 'rouge', '~> 4.2.1' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..fa70aac8 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,134 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + colorator (1.1.0) + concurrent-ruby (1.2.3) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + eventmachine (1.2.7) + ffi (1.15.0) + forwardable-extended (2.6.0) + google-protobuf (4.26.1) + rake (>= 13) + google-protobuf (4.26.1-aarch64-linux) + rake (>= 13) + google-protobuf (4.26.1-arm64-darwin) + rake (>= 13) + google-protobuf (4.26.1-x86-linux) + rake (>= 13) + google-protobuf (4.26.1-x86_64-darwin) + rake (>= 13) + google-protobuf (4.26.1-x86_64-linux) + rake (>= 13) + http_parser.rb (0.8.0) + i18n (1.14.5) + concurrent-ruby (~> 1.0) + jekyll (4.3.3) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (~> 1.0) + jekyll-sass-converter (>= 2.0, < 4.0) + jekyll-watch (~> 2.0) + kramdown (~> 2.3, >= 2.3.1) + kramdown-parser-gfm (~> 1.0) + liquid (~> 4.0) + mercenary (>= 0.3.6, < 0.5) + pathutil (~> 0.9) + rouge (>= 3.0, < 5.0) + safe_yaml (~> 1.0) + terminal-table (>= 1.8, < 4.0) + webrick (~> 1.7) + jekyll-feed (0.17.0) + jekyll (>= 3.7, < 5.0) + jekyll-sass-converter (3.0.0) + sass-embedded (~> 1.54) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + mercenary (0.4.0) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (5.0.5) + rake (13.2.1) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + rexml (3.2.6) + rouge (4.2.1) + safe_yaml (1.0.5) + sass-embedded (1.77.1) + google-protobuf (>= 3.25, < 5.0) + rake (>= 13.0.0) + sass-embedded (1.77.1-aarch64-mingw-ucrt) + google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.77.1-arm64-darwin) + google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.77.1-x86-cygwin) + google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.77.1-x86-mingw-ucrt) + google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.77.1-x86_64-cygwin) + google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.77.1-x86_64-darwin) + google-protobuf (>= 3.25, < 5.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + unicode-display_width (2.5.0) + webrick (1.8.1) + +PLATFORMS + aarch64-linux + aarch64-linux-android + aarch64-linux-gnu + aarch64-linux-musl + aarch64-mingw-ucrt + arm-linux-androideabi + arm-linux-gnueabihf + arm-linux-musleabihf + arm64-darwin + riscv64-linux-android + riscv64-linux-gnu + riscv64-linux-musl + ruby + x86-cygwin + x86-linux + x86-linux-android + x86-linux-gnu + x86-linux-musl + x86-mingw-ucrt + x86_64-cygwin + x86_64-darwin + x86_64-linux + x86_64-linux-android + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + http_parser.rb (~> 0.6.0) + jekyll-feed (~> 0.12) + minima (~> 2.5) + rouge (~> 4.2.1) + tzinfo (>= 1, < 3) + tzinfo-data + wdm (~> 0.1.1) + webrick + +BUNDLED WITH + 2.5.10 diff --git a/bin/serve.sh b/bin/serve.sh deleted file mode 100755 index fc06998f..00000000 --- a/bin/serve.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -docker run --rm --volume="$PWD:/srv/jekyll" -it -p 4000:4000 jekyll/jekyll:pages jekyll serve diff --git a/bin/serve_arm.sh b/bin/serve_arm.sh deleted file mode 100755 index 96096fc0..00000000 --- a/bin/serve_arm.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -docker run --rm --platform linux/amd64 --volume="$PWD:/srv/jekyll" -it -p 4000:4000 jekyll/jekyll:pages jekyll serve diff --git a/bin/serve_docker.sh b/bin/serve_docker.sh new file mode 100755 index 00000000..8278080f --- /dev/null +++ b/bin/serve_docker.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# This script is used to serve the Jekyll site locally with automatic rebuilding. +docker compose up diff --git a/bin/serve_local.sh b/bin/serve_local.sh new file mode 100755 index 00000000..ce78f63c --- /dev/null +++ b/bin/serve_local.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# This script is used to serve the Jekyll site locally with automatic rebuilding. +# 'bundle exec' ensures we're using the correct versions of each gem according to our Gemfile.lock. +# 'jekyll serve' starts a Jekyll development server. +# '--watch' option automatically rebuilds the site when files are modified. +bundle exec jekyll serve --watch diff --git a/docker-compose.yml b/docker-compose.yml index ccc0c145..6c528158 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,11 @@ version: "3" services: app: - container_name: jekyll + container_name: jekyll-ray build: context: . dockerfile: Dockerfile - command: jekyll serve volumes: - - ./:/srv/jekyll + - .:/app ports: - 4000:4000 From 97cb515f8f209c7b2ab95db6ad33b3d4acac7537 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sun, 12 May 2024 20:10:25 +0900 Subject: [PATCH 3/4] Add "1 Page" navigation item and merge manual pages A new navigation item "1 Page" was added to the manual's sidebar for both English and Japanese language versions. Implemented a ruby script that dynamically generates a single markdown file ("1 Page") by merging content from all existing markdown files in each language. This provides users with an option to view all manual pages at once. --- _includes/manuals/1.0/en/contents.html | 1 + _includes/manuals/1.0/ja/contents.html | 1 + bin/merge_md_files.rb | 45 ++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 bin/merge_md_files.rb diff --git a/_includes/manuals/1.0/en/contents.html b/_includes/manuals/1.0/en/contents.html index 2ce996cf..07793081 100644 --- a/_includes/manuals/1.0/en/contents.html +++ b/_includes/manuals/1.0/en/contents.html @@ -42,6 +42,7 @@ + diff --git a/_includes/manuals/1.0/ja/contents.html b/_includes/manuals/1.0/ja/contents.html index 57f736a3..fe802df6 100644 --- a/_includes/manuals/1.0/ja/contents.html +++ b/_includes/manuals/1.0/ja/contents.html @@ -43,6 +43,7 @@ + diff --git a/bin/merge_md_files.rb b/bin/merge_md_files.rb new file mode 100644 index 00000000..abaf78b9 --- /dev/null +++ b/bin/merge_md_files.rb @@ -0,0 +1,45 @@ +require 'fileutils' + +def generate_combined_file(language, intro_message) + # マークダウンファイルが存在するフォルダ + source_folder = File.expand_path("../manuals/1.0/#{language}/", __dir__) + # 結合されたファイルの出力先 + output_file = "manuals/1.0/#{language}/1page.md" + + puts "Does the source folder exist? #{Dir.exist?(source_folder)}" + raise "Source folder does not exist!" unless File.directory?(source_folder) + + # ファイルを開く + File.open(output_file, "w") do |combined_file| + + # 全体のヘッダーを書き込む + combined_file.write("---\nlayout: docs-#{language}\ntitle: 1 Page Manual\ncategory: Manual\npermalink: /manuals/1.0/#{language}/1page.html\n---\n") + + # 追加のメッセージを書き込む + combined_file.write(intro_message + "\n\n") + + # 指定フォルダ内のすべての.mdファイルを取得し、ソートする + files = Dir.glob(File.join(source_folder, "*.md")).sort + + # 各ファイルを処理する - ヘッダーを削除 + files.each do |filepath| + File.open(filepath, "r") do |file| + # ファイル内容を読む + content = file.read + + # ヘッダー部分を削除 ("---"で囲まれた部分を削除) + content.gsub!(/---.*?---/m, '') + + # 出力ファイルに書き込み + combined_file.write(content + "\n") + end + end + + end + + puts "Markdown files have been combined into #{output_file}" +end + +# 以下の行を使用して関数を2言語で呼び出す +generate_combined_file("ja", "これは全てのマニュアルページを一つにまとめたページです。") +generate_combined_file("en", "This page collects all manual pages in one place.") From 63d2e356779ad3717993d39d743fd36d4f3e1ee4 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sun, 12 May 2024 20:10:44 +0900 Subject: [PATCH 4/4] Add workflow for deploying Jekyll site to GitHub Pages This commit introduces a new GitHub Actions workflow `.github/workflows/jekyll.yml` for building and deploying Jekyll sites to GitHub Pages. It includes build and deployment jobs, as well as setup for Ruby, Pages, and execution of custom scripts. Deployment is managed to allow only one concurrent operation, to prevent conflicts. --- .github/workflows/jekyll.yml | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/jekyll.yml diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml new file mode 100644 index 00000000..d87734bd --- /dev/null +++ b/.github/workflows/jekyll.yml @@ -0,0 +1,68 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Jekyll site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + cache-version: 0 # Increment this number if you need to re-download cached gems + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + + - name: Run custom scripts + run: | + ruby bin/merge_md_files.rb + + - name: Build with Jekyll + # Outputs to the './_site' directory by default + run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" + env: + JEKYLL_ENV: production + - name: Upload artifact + # Automatically uploads an artifact from the './_site' directory by default + uses: actions/upload-pages-artifact@v3 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4