From 46a091c7154f85dbbd4fd1e2ec2667e356314094 Mon Sep 17 00:00:00 2001 From: Andy Duong Date: Mon, 3 Jul 2023 13:13:41 +0700 Subject: [PATCH 1/6] [#383] Upgrade Ruby version --- .github/workflows/test_generated_app.yml | 2 +- .github/workflows/test_production_build.yml | 2 +- .github/workflows/test_template.yml | 2 +- .tool-versions | 2 +- README.md | 2 +- template.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_generated_app.yml b/.github/workflows/test_generated_app.yml index bbee7add..12fd1601 100644 --- a/.github/workflows/test_generated_app.yml +++ b/.github/workflows/test_generated_app.yml @@ -9,7 +9,7 @@ env: DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }} DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }} - RUBY_VERSION: 3.0.1 + RUBY_VERSION: 3.2.2 NODE_VERSION: 16 RAILS_VERSION: 7.0.6 diff --git a/.github/workflows/test_production_build.yml b/.github/workflows/test_production_build.yml index 48790aac..01d4570b 100644 --- a/.github/workflows/test_production_build.yml +++ b/.github/workflows/test_production_build.yml @@ -6,7 +6,7 @@ env: APP_NAME: rails_templates DOCKER_IMAGE: ${{ github.repository }} DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} - RUBY_VERSION: 3.0.1 + RUBY_VERSION: 3.2.2 NODE_VERSION: 16 RAILS_VERSION: 7.0.6 diff --git a/.github/workflows/test_template.yml b/.github/workflows/test_template.yml index e54f01bc..37ceb327 100644 --- a/.github/workflows/test_template.yml +++ b/.github/workflows/test_template.yml @@ -3,7 +3,7 @@ name: Test the codebase of the template on: push env: - RUBY_VERSION: 3.0.1 + RUBY_VERSION: 3.2.2 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.tool-versions b/.tool-versions index 7fcd1b3f..97b2cd18 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ nodejs 16.13.2 -ruby 3.0.1 +ruby 3.2.2 diff --git a/README.md b/README.md index 4bb5e9fa..54a95428 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ with building complex applications over the years. ### Requirements -- Install ruby and set your local ruby version to `3.0.1` +- Install ruby and set your local ruby version to `3.2.2` - Install rails `7.0.6` - Install node `16.13.2` (For creating web application) diff --git a/template.rb b/template.rb index 73550b18..7c0a67e4 100644 --- a/template.rb +++ b/template.rb @@ -8,7 +8,7 @@ APP_NAME_HUMANIZED = app_name.split(/[-_]/).map(&:capitalize).join(' ').gsub(/ Web$/, '') DOCKER_REGISTRY_HOST = 'docker.io' DOCKER_IMAGE = "nimblehq/#{APP_NAME}".freeze -RUBY_VERSION = '3.0.1' +RUBY_VERSION = '3.2.2' POSTGRES_VERSION = '15.2' REDIS_VERSION = '6.2.7' # Variants From 3e26faa708f5612db62d5f669c88cdb55381df64 Mon Sep 17 00:00:00 2001 From: Andy Duong Date: Mon, 3 Jul 2023 13:17:56 +0700 Subject: [PATCH 2/6] [#383] Use figjam --- Gemfile.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.tt b/Gemfile.tt index 8e8ec02e..bc65a6e0 100644 --- a/Gemfile.tt +++ b/Gemfile.tt @@ -41,7 +41,7 @@ group :development, :test do # gem 'debug', platforms: %i[ mri mingw x64_mingw ] # Official debug # Utilities - gem 'figaro' # Simple Rails app configuration + gem 'figjam' # ENV configuration for ruby using yaml files gem 'listen' # Listens to file modifications gem 'letter_opener' # Preview mail in the browser instead of sending gem 'ffaker' # A library for generating fake data such as names, addresses, and phone numbers From d6a2ba39861c77a011c5f05035bef2ba1aaf1c64 Mon Sep 17 00:00:00 2001 From: Andy Duong Date: Mon, 3 Jul 2023 13:24:44 +0700 Subject: [PATCH 3/6] [#383] Update the excon and other package to fix the Docker::Container `unix://` connections --- .template/Gemfile.lock | 66 +++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/.template/Gemfile.lock b/.template/Gemfile.lock index 0b460254..6b2e96cb 100644 --- a/.template/Gemfile.lock +++ b/.template/Gemfile.lock @@ -2,64 +2,70 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) - diff-lcs (1.4.4) + diff-lcs (1.5.0) docker-api (2.2.0) excon (>= 0.47.0) multi_json - excon (0.90.0) + excon (0.100.0) + json (2.6.3) + language_server-protocol (3.17.0.3) multi_json (1.15.0) - net-scp (3.0.0) - net-ssh (>= 2.6.5, < 7.0.0) - net-ssh (6.1.0) + net-scp (4.0.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-ssh (7.1.0) net-telnet (0.1.1) - parallel (1.21.0) - parser (3.1.0.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) + racc + racc (1.7.1) rainbow (3.1.1) - regexp_parser (2.2.0) + regexp_parser (2.8.1) rexml (3.2.5) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.2) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.12.0) rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.9.1) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.3) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (1.25.0) + rubocop (1.54.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.15.1, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.15.1) - parser (>= 3.0.1.1) - ruby-progressbar (1.11.0) - serverspec (2.41.5) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + serverspec (2.42.2) multi_json rspec (~> 3.0) rspec-its specinfra (~> 2.72) sfl (2.3) - specinfra (2.82.18) + specinfra (2.86.0) net-scp net-ssh (>= 2.7) net-telnet (= 0.1.1) sfl - unicode-display_width (2.1.0) + unicode-display_width (2.4.2) PLATFORMS ruby From 3b2c3d6de51cd2d5185ff2e6b7832e2d17d85547 Mon Sep 17 00:00:00 2001 From: Andy Duong Date: Mon, 3 Jul 2023 13:28:06 +0700 Subject: [PATCH 4/6] [#383] Fix rubocop --- .template/variants/web/package.json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.template/variants/web/package.json.rb b/.template/variants/web/package.json.rb index 0b1a4a7c..34b2e414 100644 --- a/.template/variants/web/package.json.rb +++ b/.template/variants/web/package.json.rb @@ -52,7 +52,7 @@ run %(npm set-script build "node app/javascript/build.js") run %( npm set-script build:css-production \ - "sass #{source_stylesheet} #{bundled_stylesheet} #{(production_bundled_stylesheet_options).join(' ')}" + "sass #{source_stylesheet} #{bundled_stylesheet} #{production_bundled_stylesheet_options.join(' ')}" ) run %( npm set-script build:css \ From c7e95b6c6996c5996e813e377aa255ea9c7c4946 Mon Sep 17 00:00:00 2001 From: Andy Duong Date: Mon, 3 Jul 2023 13:51:20 +0700 Subject: [PATCH 5/6] [#383] Pin the deb.nodesource.com instead of deb.debian.org for the nodejs --- .template/addons/docker/Dockerfile.tt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.template/addons/docker/Dockerfile.tt b/.template/addons/docker/Dockerfile.tt index 22bb1f9e..cee943e9 100644 --- a/.template/addons/docker/Dockerfile.tt +++ b/.template/addons/docker/Dockerfile.tt @@ -38,7 +38,8 @@ RUN apt-get update -qq && \ ADD https://dl.yarnpkg.com/debian/pubkey.gpg /tmp/yarn-pubkey.gpg RUN apt-key add /tmp/yarn-pubkey.gpg && rm /tmp/yarn-pubkey.gpg && \ echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \ - curl -sL https://deb.nodesource.com/setup_"$NODE_SOURCE_VERSION".x | bash - && \ + echo 'Package: nodejs\nPin: origin deb.nodesource.com\nPin-Priority: 600' > /etc/apt/preferences.d/nodesource && \ + curl -fsSL https://deb.nodesource.com/setup_"$NODE_SOURCE_VERSION".x | bash - && \ apt-get update -qq && \ apt-get install -y --no-install-recommends nodejs yarn && \ apt-get clean && \ From ce00e6ea8c41413df546be1c2dc1c2673b5ea7c5 Mon Sep 17 00:00:00 2001 From: Andy Duong Date: Mon, 3 Jul 2023 13:59:44 +0700 Subject: [PATCH 6/6] [#383] YAML load with aliases: true --- .template/addons/phrase/spec/codebase/codebase_spec.rb | 2 +- bin/docker-assets-precompile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.template/addons/phrase/spec/codebase/codebase_spec.rb b/.template/addons/phrase/spec/codebase/codebase_spec.rb index 64378d71..251349a8 100644 --- a/.template/addons/phrase/spec/codebase/codebase_spec.rb +++ b/.template/addons/phrase/spec/codebase/codebase_spec.rb @@ -16,7 +16,7 @@ # replace en with root as `en` is not a tag locale_tags[locale_tags.index('en')] = 'root' - phrase_pull_tags = YAML.load_file(Rails.root.join('.phrase.yml')) + phrase_pull_tags = YAML.load_file(Rails.root.join('.phrase.yml'), aliases: true) .dig('phrase', 'pull', 'targets') .map { |target| target.dig('params', 'tags') } .sort diff --git a/bin/docker-assets-precompile b/bin/docker-assets-precompile index a5b95c27..30e844da 100755 --- a/bin/docker-assets-precompile +++ b/bin/docker-assets-precompile @@ -15,7 +15,7 @@ require 'yaml' rails_env = ENV.fetch('RAILS_ENV', 'production') if rails_env == 'production' - docker_build_envs = YAML.load_file('config/application.yml')['docker_build'] + docker_build_envs = YAML.load_file('config/application.yml', aliases: true)['docker_build'] docker_build_envs.each { |name, value| ENV[name] = value } ENV['DATABASE_URL'] = 'postgres://postgres:postgres@postgres:5432/postgres'