From 1cfe0c4287a6a4ed8b9927d045b8f7463cf72e87 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Tue, 26 Mar 2024 09:32:32 +0000 Subject: [PATCH 1/7] WEB-6734: Update ruby to 3.3 --- .gitignore | 2 ++ .rubocop.yml | 2 +- .ruby-version | 2 +- Dockerfile | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d558223..26b455d 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ build-iPhoneSimulator/ .DS_Store +# VS code +.vscode diff --git a/.rubocop.yml b/.rubocop.yml index 0432ca9..453a8af 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 3.2 + TargetRubyVersion: 3.3 NewCops: enable Exclude: - tmp/**/* diff --git a/.ruby-version b/.ruby-version index 944880f..15a2799 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.0 +3.3.0 diff --git a/Dockerfile b/Dockerfile index cf86032..767df81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG RUBY_ENV -FROM ruby:3.2-alpine AS builder +FROM ruby:3.3-alpine AS builder LABEL maintainer=engineering@kodeco.com ARG APP_ROOT=/app/robles @@ -45,7 +45,7 @@ RUN rm -rf /usr/local/bundle/cache/* ############################## # PACKAGE STAGE # ############################## -FROM ruby:3.2-alpine +FROM ruby:3.3-alpine LABEL maintainer=engineering@kodeco.com LABEL com.github.actions.name="robles" LABEL com.github.actions.author="Kodeco " From feafc20c0d2b6fff0b7647fac8b947d11f31aa4d Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Tue, 26 Mar 2024 09:33:03 +0000 Subject: [PATCH 2/7] task: Update references to raywenderlich.com to Kodeco Inc. --- README.md | 2 +- action.yaml | 2 +- app/server/views/pablo/instructions.html.erb | 2 +- app/server/views/pablo/license.html.erb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d651aff..8a7f151 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ > the mechanical precursor to the electronic book. In 1949, Ruiz was awarded Spanish patent 190,698 > for the "Mechanical Encyclopedia". -__robles__ is a tool that can build raywenderlich.com books and video courses from their git repositories,\ +__robles__ is a tool that can build Kodeco books and video courses from their git repositories,\ and publish them to [`alexandria`](https://github.com/razeware/alexandria) and [`betamax`](https://github.com/razeware/betamax) respectively.. diff --git a/action.yaml b/action.yaml index d552c16..0266c7e 100644 --- a/action.yaml +++ b/action.yaml @@ -1,6 +1,6 @@ name: 'robles' author: 'engineering@razeware.com' -description: 'raywenderlich.com Book Processing' +description: 'Kodeco Book Processing' inputs: operation: description: 'What task to perform lint|publish' diff --git a/app/server/views/pablo/instructions.html.erb b/app/server/views/pablo/instructions.html.erb index 0cf54d0..d4b2e99 100644 --- a/app/server/views/pablo/instructions.html.erb +++ b/app/server/views/pablo/instructions.html.erb @@ -56,7 +56,7 @@

Usage

- Feel free to use these images elsewhere (in conference talks etc). Attribution is not required, but appreciated (to raywenderlich.com). Please don't use them in a scenario that paints raywenderlich.com in a negative light. + Feel free to use these images elsewhere (in conference talks etc). Attribution is not required, but appreciated (to Kodeco Inc.). Please don't use them in a scenario that paints Kodeco Inc. in a negative light.

diff --git a/app/server/views/pablo/license.html.erb b/app/server/views/pablo/license.html.erb index ef640b4..63ce16a 100644 --- a/app/server/views/pablo/license.html.erb +++ b/app/server/views/pablo/license.html.erb @@ -6,8 +6,8 @@
The copyright for all images on this site is owned by Razeware LLC. -
Images may be used in raywenderlich.com tutorials, including video tutorials, written tutorials, books, and advertising materials. -
raywenderlich.com team members may use, alter, and modify the images for use within raywenderlich.com tutorials. +
Images may be used in Kodeco tutorials, including video tutorials, written tutorials, books, and advertising materials. +
Kodeco team members may use, alter, and modify the images for use within Kodeco tutorials.
They may also use the images in any slides or other materials for conference talks.
No other use is permitted without permission.
From 03acea91def41dcfbdf8f127c64d9b27f782c407 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:02:53 +0000 Subject: [PATCH 3/7] Bump docker/setup-buildx-action from 3.2.0 to 3.3.0 (#256) --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index c65a368..1e5da3e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -69,7 +69,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v3.2.0 + uses: docker/setup-buildx-action@v3.3.0 with: buildkitd-flags: --debug From c9caac5692bd47ac319eae2cd4250c6be28179d4 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Fri, 19 Apr 2024 17:33:59 +0100 Subject: [PATCH 4/7] WEB-7045: Escaping the - in the regexes --- app/commands/book_cli.rb | 2 +- app/commands/content_module_cli.rb | 2 +- app/commands/pablo_cli.rb | 2 +- app/commands/robles_cli.rb | 2 +- app/commands/video_cli.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/commands/book_cli.rb b/app/commands/book_cli.rb index 36c82fc..64acba7 100644 --- a/app/commands/book_cli.rb +++ b/app/commands/book_cli.rb @@ -83,7 +83,7 @@ def runner def book_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9-_]+.yaml$}) + watch(%r{[a-zA-Z0-9\-_]+.yaml$}) watch(%r{.+.(md|markdown)$}) end GUARDFILE diff --git a/app/commands/content_module_cli.rb b/app/commands/content_module_cli.rb index 46f6fe3..4b38a5c 100644 --- a/app/commands/content_module_cli.rb +++ b/app/commands/content_module_cli.rb @@ -87,7 +87,7 @@ def runner def content_module_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9-_]+.yaml$}) + watch(%r{[a-zA-Z0-9\-_]+.yaml$}) end GUARDFILE end diff --git a/app/commands/pablo_cli.rb b/app/commands/pablo_cli.rb index 05b7946..398c557 100644 --- a/app/commands/pablo_cli.rb +++ b/app/commands/pablo_cli.rb @@ -31,7 +31,7 @@ def runner def book_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9-_]+.yaml$}) + watch(%r{[a-zA-Z0-9\-_]+.yaml$}) watch(%r{.+.(md|markdown)$}) end GUARDFILE diff --git a/app/commands/robles_cli.rb b/app/commands/robles_cli.rb index 86863ac..6d37bac 100644 --- a/app/commands/robles_cli.rb +++ b/app/commands/robles_cli.rb @@ -28,7 +28,7 @@ def runner def book_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9-_]+.yaml$}) + watch(%r{[a-zA-Z0-9\-_]+.yaml$}) watch(%r{.+.(md|markdown)$}) end GUARDFILE diff --git a/app/commands/video_cli.rb b/app/commands/video_cli.rb index ae3b991..7b62abe 100644 --- a/app/commands/video_cli.rb +++ b/app/commands/video_cli.rb @@ -94,7 +94,7 @@ def runner def video_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9-_]+.yaml$}) + watch(%r{[a-zA-Z0-9\-_]+.yaml$}) end GUARDFILE end From d3e271be718ae991c3c2ce3ea68791d179d63de4 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Fri, 19 Apr 2024 17:58:04 +0100 Subject: [PATCH 5/7] WEB-7045: Setting the viewport manually seems to be required now No idea why --- app/lib/snapshotter/content_module_slides.rb | 1 + app/lib/snapshotter/video_course_slides.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/lib/snapshotter/content_module_slides.rb b/app/lib/snapshotter/content_module_slides.rb index 3eead9d..fded556 100644 --- a/app/lib/snapshotter/content_module_slides.rb +++ b/app/lib/snapshotter/content_module_slides.rb @@ -9,6 +9,7 @@ def generate next unless segment.is_a?(Video) browser.goto("#{app_base}/slides/#{lesson.slug}/#{segment.slug}") + browser.set_viewport(width: 1920, height: 1080) browser.screenshot(path: "#{out_dir}/#{lesson.ref}-#{segment.slug}.png", selector: '#slide-to-snapshot') end end diff --git a/app/lib/snapshotter/video_course_slides.rb b/app/lib/snapshotter/video_course_slides.rb index 0227f68..4a55db5 100644 --- a/app/lib/snapshotter/video_course_slides.rb +++ b/app/lib/snapshotter/video_course_slides.rb @@ -8,6 +8,7 @@ def generate next unless episode.is_a?(Video) browser.goto("#{app_base}/slides/#{episode.slug}") + browser.set_viewport(width: 1920, height: 1080) browser.screenshot(path: "#{out_dir}/#{episode.slug}.png", selector: '#slide-to-snapshot') end end From 211566e09f960b1e41ed05f8b87d277dd3202528 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Fri, 19 Apr 2024 17:58:48 +0100 Subject: [PATCH 6/7] WEB-7045: Upgrading gems --- Gemfile.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6775ad0..df9a4aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,17 +30,17 @@ GEM public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.3.0) - aws-partitions (1.896.0) - aws-sdk-core (3.191.3) + aws-partitions (1.916.0) + aws-sdk-core (3.192.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.77.0) + aws-sdk-kms (1.79.0) aws-sdk-core (~> 3, >= 3.191.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.143.0) - aws-sdk-core (~> 3, >= 3.191.0) + aws-sdk-s3 (1.147.0) + aws-sdk-core (~> 3, >= 3.192.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.8) aws-sigv4 (1.8.0) @@ -48,7 +48,7 @@ GEM backport (1.2.0) base64 (0.2.0) benchmark (0.3.0) - bigdecimal (3.1.6) + bigdecimal (3.1.7) cli-ui (2.2.3) coderay (1.1.3) commonmarker (0.23.10) @@ -66,7 +66,7 @@ GEM faraday-net_http (>= 2.0, < 3.2) faraday-net_http (3.1.0) net-http - faraday-retry (2.2.0) + faraday-retry (2.2.1) faraday (~> 2.0) ferrum (0.15) addressable (~> 2.5) @@ -99,7 +99,7 @@ GEM concurrent-ruby (~> 1.0) jaro_winkler (1.5.6) jmespath (1.6.2) - json (2.7.1) + json (2.7.2) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -109,10 +109,10 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) lumberjack (1.2.10) - method_source (1.0.0) + method_source (1.1.0) mini_magick (4.12.0) - mini_portile2 (2.8.5) - minitest (5.22.2) + mini_portile2 (2.8.6) + minitest (5.22.3) multi_json (1.15.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) @@ -120,7 +120,7 @@ GEM nenv (0.3.0) net-http (0.4.1) uri - nokogiri (1.16.2) + nokogiri (1.16.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) notiffany (0.1.3) @@ -137,11 +137,11 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.4) + public_suffix (5.0.5) racc (1.7.3) - rack (3.0.9.1) - rack-livereload (0.5.1) - rack + rack (3.0.10) + rack-livereload (0.6.0) + rack (~> 3.0.8) rack-protection (4.0.0) base64 (>= 0.1.0) rack (>= 3.0.0, < 4) @@ -153,7 +153,7 @@ GEM rack (>= 3) webrick (~> 1.8) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) @@ -165,7 +165,7 @@ GEM reverse_markdown (2.1.1) nokogiri rexml (3.2.6) - rubocop (1.62.1) + rubocop (1.63.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) From 2fed4825556cb567c67f1d67cba452e08a7ea97c Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Fri, 19 Apr 2024 18:01:12 +0100 Subject: [PATCH 7/7] WEB-7045: Rubocop --- app/commands/book_cli.rb | 2 +- app/commands/content_module_cli.rb | 2 +- app/commands/pablo_cli.rb | 2 +- app/commands/robles_cli.rb | 2 +- app/commands/video_cli.rb | 2 +- app/lib/linting/content_module_linter.rb | 2 +- app/lib/linting/image/segment.rb | 2 -- app/models/lessons_validator.rb | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/commands/book_cli.rb b/app/commands/book_cli.rb index 64acba7..36c82fc 100644 --- a/app/commands/book_cli.rb +++ b/app/commands/book_cli.rb @@ -83,7 +83,7 @@ def runner def book_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9\-_]+.yaml$}) + watch(%r{[a-zA-Z0-9-_]+.yaml$}) watch(%r{.+.(md|markdown)$}) end GUARDFILE diff --git a/app/commands/content_module_cli.rb b/app/commands/content_module_cli.rb index 4b38a5c..46f6fe3 100644 --- a/app/commands/content_module_cli.rb +++ b/app/commands/content_module_cli.rb @@ -87,7 +87,7 @@ def runner def content_module_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9\-_]+.yaml$}) + watch(%r{[a-zA-Z0-9-_]+.yaml$}) end GUARDFILE end diff --git a/app/commands/pablo_cli.rb b/app/commands/pablo_cli.rb index 398c557..05b7946 100644 --- a/app/commands/pablo_cli.rb +++ b/app/commands/pablo_cli.rb @@ -31,7 +31,7 @@ def runner def book_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9\-_]+.yaml$}) + watch(%r{[a-zA-Z0-9-_]+.yaml$}) watch(%r{.+.(md|markdown)$}) end GUARDFILE diff --git a/app/commands/robles_cli.rb b/app/commands/robles_cli.rb index 6d37bac..86863ac 100644 --- a/app/commands/robles_cli.rb +++ b/app/commands/robles_cli.rb @@ -28,7 +28,7 @@ def runner def book_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9\-_]+.yaml$}) + watch(%r{[a-zA-Z0-9-_]+.yaml$}) watch(%r{.+.(md|markdown)$}) end GUARDFILE diff --git a/app/commands/video_cli.rb b/app/commands/video_cli.rb index 7b62abe..ae3b991 100644 --- a/app/commands/video_cli.rb +++ b/app/commands/video_cli.rb @@ -94,7 +94,7 @@ def runner def video_guardfile <<~GUARDFILE guard 'livereload' do - watch(%r{[a-zA-Z0-9\-_]+.yaml$}) + watch(%r{[a-zA-Z0-9-_]+.yaml$}) end GUARDFILE end diff --git a/app/lib/linting/content_module_linter.rb b/app/lib/linting/content_module_linter.rb index 6f14a67..af6e571 100644 --- a/app/lib/linting/content_module_linter.rb +++ b/app/lib/linting/content_module_linter.rb @@ -21,7 +21,7 @@ def lint(options: {}) output end - def lint_with_ui(options:, show_ui: true) # rubocop:disable Metrics/AbcSize + def lint_with_ui(options:, show_ui: true) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength with_spinner(title: 'Checking {{bold:module.yaml}} exists', show: show_ui) do check_module_file_exists end diff --git a/app/lib/linting/image/segment.rb b/app/lib/linting/image/segment.rb index eb21016..26409a9 100644 --- a/app/lib/linting/image/segment.rb +++ b/app/lib/linting/image/segment.rb @@ -24,8 +24,6 @@ def markdown_file object.script_file when 'text' object.markdown_file - else - nil end end diff --git a/app/models/lessons_validator.rb b/app/models/lessons_validator.rb index cbeb196..e95abaf 100644 --- a/app/models/lessons_validator.rb +++ b/app/models/lessons_validator.rb @@ -30,7 +30,7 @@ def check_unique_title(record, attribute, value) return unless value.is_a?(Array) title_counts = Hash.new(0) - value.each { |lesson| title_counts[lesson.title] += 1 } + value.each { |lesson| title_counts[lesson.title] += 1 } non_unique_titles = title_counts.select { |_, count| count > 1 }.keys non_unique_titles.each { |title| record.errors.add(attribute, "=> Title '#{title}' is not unique") }