From 77cd36c158624808e657e5dbb5ec8bc026fafa55 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 19 Feb 2018 17:02:50 +0100 Subject: Sorted out how to properly deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- .gitignore | 1 + .rubocop.yml | 55 +++++++++++++++++++++++++ Gemfile | 28 +++++++++++-- Gemfile.lock | 46 +++++++++++++++++++++ Rakefile | 38 +++++++++++++++++ _i18n/ca.yml | 2 + _i18n/ca/_posts/2018-02-17-llegint-capital.html | 1 + _i18n/en.yml | 2 + _includes/header.html | 12 +++++- org/ca/_posts/2018-02-17-llegint-capital.org | 1 + script/build.sh | 35 ++++++++++++++++ script/post-receive | 43 +++++++++++++++++++ 12 files changed, 258 insertions(+), 6 deletions(-) create mode 100644 .rubocop.yml create mode 100644 Rakefile create mode 100755 script/build.sh create mode 100644 script/post-receive diff --git a/.gitignore b/.gitignore index 45c1505..0d96cc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _site .sass-cache .jekyll-metadata +tmp diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..edc5960 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,55 @@ +AllCops: + TargetRubyVersion: 2.5 + + DisplayCopNames: true + DisplayStyleGuide: false + + Exclude: + - './_site/**/*' + +# +# Layout +# + +# This is a remnant of old SUSE-style alignment for hashes, The table format +# looks more human readable. +Layout/AlignHash: + EnforcedHashRocketStyle: table + EnforcedColonStyle: table + +# +# Metrics +# + +# The default is just too small. +Metrics/AbcSize: + Max: 30 + +# The default is just too small. A limit of 100 looks reasonable and many other +# projects (including inside of SUSE) are also using this value. +Metrics/LineLength: + Max: 100 + +Metrics/MethodLength: + Max: 20 + +# +# Style +# + +# This forces us to create a new object for no real reason. +Style/MultipleComparison: + Enabled: false + +# This is a common SUSE configuration value: the performance difference between +# single and double quotes is no longer there, and so it's better to be +# consistent and force only double quotes. +Style/StringLiterals: + EnforcedStyle: double_quotes + +# Same as Style/StringLiterals. +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +Style/AsciiComments: + Enabled: false diff --git a/Gemfile b/Gemfile index 8ff0e7d..603235a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,28 @@ -source 'https://rubygems.org' +# frozen_string_literal: true -gem 'jekyll', '~> 3.7.2' -gem 'sass' +# Copyright (C) 2018 Miquel Sabaté Solà +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +source "https://rubygems.org" + +gem "html-proofer" +gem "jekyll", "~> 3.7.2" +gem "rake" +gem "rubocop" +gem "sass" group :jekyll_plugins do - gem 'jekyll-multiple-languages-plugin' + gem "jekyll-multiple-languages-plugin" end diff --git a/Gemfile.lock b/Gemfile.lock index 628c73a..9b1f40e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,34 @@ GEM remote: https://rubygems.org/ specs: + activesupport (5.1.5) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) + ast (2.4.0) colorator (1.1.0) + colorize (0.8.1) concurrent-ruby (1.0.5) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) + ethon (0.11.0) + ffi (>= 1.3.0) eventmachine (1.2.5) ffi (1.9.21) forwardable-extended (2.6.0) + html-proofer (3.8.0) + activesupport (>= 4.2, < 6.0) + addressable (~> 2.3) + colorize (~> 0.8) + mercenary (~> 0.3.2) + nokogiri (~> 1.8.1) + parallel (~> 1.3) + typhoeus (~> 1.3) + yell (~> 2.0) http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -40,13 +58,31 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) + mini_portile2 (2.3.0) + minitest (5.11.3) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + parallel (1.12.1) + parser (2.4.0.2) + ast (~> 2.3) pathutil (0.16.1) forwardable-extended (~> 2.6) + powerpack (0.1.1) public_suffix (3.0.2) + rainbow (3.0.0) + rake (12.3.0) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) rouge (3.1.1) + rubocop (0.52.1) + parallel (~> 1.10) + parser (>= 2.4.0.2, < 3.0) + powerpack (~> 0.1) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.9.0) ruby_dep (1.5.0) safe_yaml (1.0.4) sass (3.5.5) @@ -54,13 +90,23 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) + thread_safe (0.3.6) + typhoeus (1.3.0) + ethon (>= 0.9.0) + tzinfo (1.2.5) + thread_safe (~> 0.1) + unicode-display_width (1.3.0) + yell (2.0.7) PLATFORMS ruby DEPENDENCIES + html-proofer jekyll (~> 3.7.2) jekyll-multiple-languages-plugin + rake + rubocop sass BUNDLED WITH diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1fb29c0 --- /dev/null +++ b/Rakefile @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Copyright (C) 2018 Miquel Sabaté Solà +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +abort("Please run this using `bundle exec rake`") unless ENV["BUNDLE_BIN_PATH"] +require "html-proofer" + +desc "Test the website" +task :test do + options = { + check_sri: true, + check_html: true, + check_img_http: true, + check_opengraph: true, + typhoeus: { + timeout: 120 + }, + cache: { + timeframe: "6w" + } + } + HTMLProofer.check_directory("./_site", options).run +end + +task default: [:test] diff --git a/_i18n/ca.yml b/_i18n/ca.yml index 559812f..6298312 100644 --- a/_i18n/ca.yml +++ b/_i18n/ca.yml @@ -21,6 +21,8 @@ blog: posted_on: "Escrit" read: "Llegir" more: "més" + no_english_post: "Aquesta entrada no està disponible en anglès" + no_catalan_post: "Aquesta entrada no està disponible en català" intro: >- Aquesta és la pàgina que mostra les entrades en català del meu blog. Totes les opinions exposades aquí són únicament meves a no ser que indiqui el diff --git a/_i18n/ca/_posts/2018-02-17-llegint-capital.html b/_i18n/ca/_posts/2018-02-17-llegint-capital.html index d68071b..d65c38e 100644 --- a/_i18n/ca/_posts/2018-02-17-llegint-capital.html +++ b/_i18n/ca/_posts/2018-02-17-llegint-capital.html @@ -3,6 +3,7 @@ layout: post title: posts.first subtitle: Una mirada o quelcom similar lang: ca +english_available: false ---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean imperdiet diff --git a/_i18n/en.yml b/_i18n/en.yml index cb0df2f..04259ea 100644 --- a/_i18n/en.yml +++ b/_i18n/en.yml @@ -21,6 +21,8 @@ blog: posted_on: "Posted on" read: "Read" more: "more" + no_english_post: "This entry is not available in english" + no_catalan_post: "This entry is not available in catalan" intro: >- This is the page that aggregates the english blog posts. All of the opinions stated here are solely my own (unless stated otherwise). Last but not least, diff --git a/_includes/header.html b/_includes/header.html index 980d8cc..b7296b6 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -5,9 +5,17 @@