From 4cefcc9ff0809ae371ec501362b03425be01d40e Mon Sep 17 00:00:00 2001 From: James 'zofrex' Sanderson Date: Thu, 26 Sep 2024 23:10:13 +0100 Subject: [PATCH] Switch from Ruby+Middleman to Hugo (#28) --- .github/workflows/update-deps.yml | 34 ----- .gitignore | 8 +- .ruby-version | 1 - Gemfile | 11 -- Gemfile.lock | 126 --------------- README.md | 11 +- .../styles.css.scss => assets/styles.scss | 0 config.rb | 51 ------- hugo.toml | 1 + .../_default/baseof.html | 15 +- layouts/_default/home.html | 13 ++ layouts/partials/latest.html | 3 + layouts/partials/since.html | 8 + lib/content_for.rb | 144 ------------------ lib/liquid_layout_support.rb | 14 -- lib/since_filter.rb | 17 --- lib/stylesheet_link_tag.rb | 31 ---- netlify.toml | 2 + source/index.html.liquid | 7 - 19 files changed, 39 insertions(+), 458 deletions(-) delete mode 100644 .github/workflows/update-deps.yml delete mode 100644 .ruby-version delete mode 100644 Gemfile delete mode 100644 Gemfile.lock rename source/stylesheets/styles.css.scss => assets/styles.scss (100%) delete mode 100644 config.rb create mode 100644 hugo.toml rename source/layouts/layout.liquid => layouts/_default/baseof.html (61%) create mode 100644 layouts/_default/home.html create mode 100644 layouts/partials/latest.html create mode 100644 layouts/partials/since.html delete mode 100644 lib/content_for.rb delete mode 100644 lib/liquid_layout_support.rb delete mode 100644 lib/since_filter.rb delete mode 100644 lib/stylesheet_link_tag.rb create mode 100644 netlify.toml delete mode 100644 source/index.html.liquid diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml deleted file mode 100644 index 0e4eae7..0000000 --- a/.github/workflows/update-deps.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Update Dependencies -on: - schedule: - - cron: "30 6 * * *" - workflow_dispatch: - -jobs: - update: - name: Update - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Install Ruby but not gems - uses: ruby/setup-ruby@v1 - - name: Update dependencies - run: | - echo 'BUNDLER_OUTPUT<> $GITHUB_ENV - bundle update | tee -a $GITHUB_ENV - echo >> $GITHUB_ENV - echo 'UPDATE_EOF' >> $GITHUB_ENV - - name: Create pull request - uses: peter-evans/create-pull-request@v6 - with: - add-paths: "Gemfile*" - commit-message: "Update dependencies" - branch: create-pull-request/update-dependencies - title: Update dependencies - body: | - Automated dependency update. Bundler output: - - ``` - ${{ env.BUNDLER_OUTPUT }} - ``` diff --git a/.gitignore b/.gitignore index 0dcc3ec..8808c50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -.bundle -.cache -.DS_Store -.sass-cache -build/ +/public/ +/resources/_gen/ +/.hugo_build.lock diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 0aec50e..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.1.4 diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 5a8803e..0000000 --- a/Gemfile +++ /dev/null @@ -1,11 +0,0 @@ -source "https://rubygems.org" - -ruby '3.1.4' - -gem 'middleman', '~> 4.2' -gem 'middleman-autoprefixer' - -gem 'liquid' - -# Temporary fix for https://github.com/middleman/middleman/issues/2569 -gem 'haml' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 3d16924..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,126 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (7.0.8.4) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) - autoprefixer-rails (10.4.16.0) - execjs (~> 2) - backports (3.25.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - concurrent-ruby (1.3.3) - contracts (0.17) - dotenv (3.1.2) - erubis (2.7.0) - execjs (2.9.1) - fast_blank (1.0.1) - fastimage (2.3.1) - ffi (1.17.0) - haml (6.3.0) - temple (>= 0.8.2) - thor - tilt - hamster (3.0.0) - concurrent-ruby (~> 1.0) - hashie (3.6.0) - i18n (1.6.0) - concurrent-ruby (~> 1.0) - kramdown (2.4.0) - rexml - liquid (5.5.0) - listen (3.9.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) - memoist (0.16.2) - middleman (4.5.0) - coffee-script (~> 2.2) - haml (>= 4.0.5) - kramdown (>= 2.3.0) - middleman-cli (= 4.5.0) - middleman-core (= 4.5.0) - middleman-autoprefixer (3.0.0) - autoprefixer-rails (~> 10.0) - middleman-core (>= 4.0.0) - middleman-cli (4.5.0) - thor (>= 0.17.0, < 2.0) - middleman-core (4.5.0) - activesupport (>= 6.1, < 7.1) - addressable (~> 2.4) - backports (~> 3.6) - bundler (~> 2.0) - contracts (~> 0.13) - dotenv - erubis - execjs (~> 2.0) - fast_blank - fastimage (~> 2.0) - hamster (~> 3.0) - hashie (~> 3.4) - i18n (~> 1.6.0) - listen (~> 3.0) - memoist (~> 0.14) - padrino-helpers (~> 0.15.0) - parallel - rack (>= 1.4.5, < 3) - sassc (~> 2.0) - servolux - tilt (~> 2.0.9) - toml - uglifier (~> 3.0) - webrick - minitest (5.24.1) - padrino-helpers (0.15.3) - i18n (>= 0.6.7, < 2) - padrino-support (= 0.15.3) - tilt (>= 1.4.1, < 3) - padrino-support (0.15.3) - parallel (1.25.1) - parslet (2.0.0) - public_suffix (6.0.0) - rack (2.2.9) - rb-fsevent (0.11.2) - rb-inotify (0.11.1) - ffi (~> 1.0) - rexml (3.3.1) - strscan - sassc (2.4.0) - ffi (~> 1.9) - sassc (2.4.0-x64-mingw32) - ffi (~> 1.9) - servolux (0.13.0) - strscan (3.1.0) - temple (0.10.3) - thor (1.3.1) - tilt (2.0.11) - toml (0.3.0) - parslet (>= 1.8.0, < 3.0.0) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - uglifier (3.2.0) - execjs (>= 0.3.0, < 3) - webrick (1.8.1) - -PLATFORMS - ruby - x64-mingw32 - x86-mingw32 - x86-mswin32 - -DEPENDENCIES - haml - liquid - middleman (~> 4.2) - middleman-autoprefixer - -RUBY VERSION - ruby 3.1.4p223 - -BUNDLED WITH - 2.3.4 diff --git a/README.md b/README.md index c57addd..149d835 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,10 @@ Please note it is not a pre-requisite for contributing incidents to this repo to ### Requirements -* Ruby -* Bundler - -Install the dependencies with: - -``` -bundle install -``` +* [Hugo](https://gohugo.io) ### Running ``` -bundle exec middleman serve +hugo serve ``` diff --git a/source/stylesheets/styles.css.scss b/assets/styles.scss similarity index 100% rename from source/stylesheets/styles.css.scss rename to assets/styles.scss diff --git a/config.rb b/config.rb deleted file mode 100644 index 7bcd7b7..0000000 --- a/config.rb +++ /dev/null @@ -1,51 +0,0 @@ -# Activate and configure extensions -# https://middlemanapp.com/advanced/configuration/#configuring-extensions - -activate :autoprefixer do |prefix| - prefix.browsers = "last 2 versions" -end - -# Layouts -# https://middlemanapp.com/basics/layouts/ - -# Per-page layout changes -page '/*.xml', layout: false -page '/*.json', layout: false -page '/*.txt', layout: false - -# With alternative layout -# page '/path/to/file.html', layout: 'other_layout' - -# Proxy pages -# https://middlemanapp.com/advanced/dynamic-pages/ - -# proxy( -# '/this-page-has-no-template.html', -# '/template-file.html', -# locals: { -# which_fake_page: 'Rendering a fake page with a local variable' -# }, -# ) - -# Helpers -# Methods defined in the helpers block are available in templates -# https://middlemanapp.com/basics/helper-methods/ - -# helpers do -# def some_helper -# 'Helping' -# end -# end - -# Build-specific configuration -# https://middlemanapp.com/advanced/configuration/#environment-specific-settings - -# configure :build do -# activate :minify_css -# activate :minify_javascript -# end - -require 'lib/liquid_layout_support' -require 'lib/content_for' -require 'lib/stylesheet_link_tag' -require 'lib/since_filter' diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..b790022 --- /dev/null +++ b/hugo.toml @@ -0,0 +1 @@ +disableKinds = ["taxonomy", "rss", "sitemap"] diff --git a/source/layouts/layout.liquid b/layouts/_default/baseof.html similarity index 61% rename from source/layouts/layout.liquid rename to layouts/_default/baseof.html index 0d289ff..f1770f5 100644 --- a/source/layouts/layout.liquid +++ b/layouts/_default/baseof.html @@ -11,22 +11,21 @@ gtag('config', 'UA-12922701-4'); - {% if current_page.data.title %}{{ current_page.data.title | escape }} || {% endif %}How Many Days Has It Been Since a JWT alg:none Vulnerability? - {% stylesheet_link_tag styles %} + How Many Days Has It Been Since a JWT alg:none Vulnerability? + {{- $style := resources.Get "styles.scss" | css.Sass }} + - - {% if_content_for description %} - - {% end_if_content_for %} + +
-
The more important statistic is that it has been {{ data.misc.russian_invasion_of_ukraine | since }} since Russia invaded Ukraine.
+
The more important statistic is that it has been {{ partial "since.html" .Site.Data.misc.russian_invasion_of_ukraine }} since Russia invaded Ukraine.
Ukraine needs our help and support. If you can, please donate.
- {{ yield }} + {{ block "main" . }}{{ end }}