From c91cf56e011b45b601be30ed4897e9c2854e53d6 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Fri, 9 Sep 2022 13:50:17 +0200 Subject: [PATCH 01/12] Skip solidus_auth_devise in the Gemfile if it's the current extension --- .../templates/extension/{Gemfile => Gemfile.tt} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename lib/solidus_dev_support/templates/extension/{Gemfile => Gemfile.tt} (96%) diff --git a/lib/solidus_dev_support/templates/extension/Gemfile b/lib/solidus_dev_support/templates/extension/Gemfile.tt similarity index 96% rename from lib/solidus_dev_support/templates/extension/Gemfile rename to lib/solidus_dev_support/templates/extension/Gemfile.tt index 5510b62e..5b25fe24 100644 --- a/lib/solidus_dev_support/templates/extension/Gemfile +++ b/lib/solidus_dev_support/templates/extension/Gemfile.tt @@ -15,9 +15,10 @@ gem 'solidus_frontend' if branch >= 'v3.2' # rubocop:disable Bundler/DuplicatedG # See https://github.com/bundler/bundler/issues/6677 gem 'rails', '>0.a' +<% if file_name != 'solidus_auth_devise' %> # Provides basic authentication functionality for testing parts of your engine gem 'solidus_auth_devise' - +<% end %> case ENV.fetch('DB', nil) when 'mysql' gem 'mysql2' From 8d8faa2bd59f96c464663f3ba90a95c4cb1b256c Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Fri, 9 Sep 2022 13:50:40 +0200 Subject: [PATCH 02/12] Use the gemspec author for the LICENSE and copyright --- lib/solidus_dev_support/templates/extension/LICENSE | 2 +- lib/solidus_dev_support/templates/extension/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/LICENSE b/lib/solidus_dev_support/templates/extension/LICENSE index 85c644f6..7f8cc47f 100644 --- a/lib/solidus_dev_support/templates/extension/LICENSE +++ b/lib/solidus_dev_support/templates/extension/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) <%= Time.now.year %> [name of plugin creator] +Copyright (c) <%= Time.now.year %> <%= gemspec.authors.join ', ' %> All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/lib/solidus_dev_support/templates/extension/README.md b/lib/solidus_dev_support/templates/extension/README.md index 11bf3a4f..3df59360 100644 --- a/lib/solidus_dev_support/templates/extension/README.md +++ b/lib/solidus_dev_support/templates/extension/README.md @@ -88,4 +88,4 @@ Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/H ## License -Copyright (c) <%= Time.now.year %> [name of extension author], released under the New BSD License. +Copyright (c) <%= Time.now.year %> <%= gemspec.authors.join ', ' %>, released under the New BSD License. From 4f8a081a3d813c5f4e8a6685886aee5e5904c0e3 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Fri, 9 Sep 2022 13:50:53 +0200 Subject: [PATCH 03/12] Ignore local gemfiles --- lib/solidus_dev_support/templates/extension/gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/solidus_dev_support/templates/extension/gitignore b/lib/solidus_dev_support/templates/extension/gitignore index 325c3c99..1ba20966 100644 --- a/lib/solidus_dev_support/templates/extension/gitignore +++ b/lib/solidus_dev_support/templates/extension/gitignore @@ -8,6 +8,7 @@ .sass-cache coverage Gemfile.lock +Gemfile-local tmp nbproject pkg From 1b74282885cf18f58196842c3fd1e1be30fa8ab3 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 10 Oct 2022 18:42:34 +0200 Subject: [PATCH 04/12] Make sure the install generator will fail if an error occurs Otherwise it will exit with 0 in any case. --- .../generators/%file_name%/install/install_generator.rb.tt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt b/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt index bef0b61a..48b65fe2 100644 --- a/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +++ b/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt @@ -6,6 +6,10 @@ module <%= class_name %> class_option :auto_run_migrations, type: :boolean, default: false source_root File.expand_path('templates', __dir__) + def self.exit_on_failure? + true + end + def copy_initializer template 'initializer.rb', 'config/initializers/<%= file_name %>.rb' end From 077b6292e5a5a80ef52dc521eadb277ac07d02ad Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 10 Oct 2022 18:43:06 +0200 Subject: [PATCH 05/12] Support an empty `$DEBUG` var in bin/sandbox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Marc Busqué --- lib/solidus_dev_support/templates/extension/bin/sandbox.tt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt index 38a7d026..5136ee2c 100755 --- a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +++ b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt @@ -1,10 +1,7 @@ #!/usr/bin/env bash set -e -if [ -n "$DEBUG" ] -then - set -x -fi +test -z "${DEBUG+empty_string}" || set -x case "$DB" in postgres|postgresql) From 2eede64fc8a1102f611aa92d00e7a2abbf176771 Mon Sep 17 00:00:00 2001 From: Connor Ferguson <68167430+cpfergus1@users.noreply.github.com> Date: Wed, 16 Jun 2021 12:00:15 -0600 Subject: [PATCH 06/12] Update shell command to be more explicit The command `solidus extension .` may not work directly on some machines without `bundle exec`. Updated to be more explicit and prevent possible confusion. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 34f0326b..7ade6846 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,11 @@ in solidus_dev_support. #### Updating existing extensions -If you have an existing extension and want to update it to use the latest standards from this gem, -you can run the following in the extension's directory: +If you have an existing extension generated with `solidus_dev_support` and want to update it to use +the latest standards from this gem, you can run the following in the extension's directory: ```console -$ solidus extension . +$ bundle exec solidus extension . ``` In case of conflicting files, you will be prompted for an action. You can overwrite the files with From e9275503440693e084ad11bc95b8f5482f92d6e1 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Wed, 14 Dec 2022 18:35:25 +0100 Subject: [PATCH 07/12] Simplify allowrd DB options for the sandbox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only allow those compatible with `rails new --database=…` except for `sqlite` that is transformed to `sqlite3` so it continues to work with the CircleCI ORB. --- .../templates/extension/bin/sandbox.tt | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt index 5136ee2c..00f421d6 100755 --- a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +++ b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt @@ -3,27 +3,7 @@ set -e test -z "${DEBUG+empty_string}" || set -x -case "$DB" in -postgres|postgresql) - RAILSDB="postgresql" - ;; -mysql) - RAILSDB="mysql" - ;; -sqlite3|sqlite) - RAILSDB="sqlite3" - ;; -'') - echo "~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter" - RAILSDB="sqlite3" - ;; -*) - echo "Invalid value specified for the Solidus sandbox: DB=\"$DB\"." - echo "Please use 'postgres', 'mysql', or 'sqlite' instead." - exit 1 - ;; -esac -echo "~~> Using $RAILSDB as the database engine" +test "$DB" = "sqlite" && export DB="sqlite3" if [ -z "$SOLIDUS_BRANCH" ] then @@ -47,7 +27,8 @@ function unbundled { } rm -rf ./sandbox -unbundled bundle exec rails new sandbox --database="$RAILSDB" \ +unbundled bundle exec rails new sandbox \ + --database="${DB:-sqlite3}" \ --skip-bundle \ --skip-git \ --skip-keeps \ From 8bdf88ae88cb5cc030fd89f92c7947c117dc342a Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Wed, 14 Dec 2022 18:40:04 +0100 Subject: [PATCH 08/12] Remove the section on the changelog from the README It was redundant with instructions from the wiki page on releasing. --- .../templates/extension/README.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/README.md b/lib/solidus_dev_support/templates/extension/README.md index 3df59360..3cc1a4f0 100644 --- a/lib/solidus_dev_support/templates/extension/README.md +++ b/lib/solidus_dev_support/templates/extension/README.md @@ -71,20 +71,9 @@ $ bin/rails server Use Ctrl-C to stop ``` -### Updating the changelog - -Before and after releases the changelog should be updated to reflect the up-to-date status of -the project: - -```shell -bin/rake changelog -git add CHANGELOG.md -git commit -m "Update the changelog" -``` - ### Releasing new versions -Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki. +Please refer to the [dedicated page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) in the Solidus wiki. ## License From f3be0ce70abd438247a533000c14e42872867bc1 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Wed, 14 Dec 2022 18:46:16 +0100 Subject: [PATCH 09/12] Set ruby versions for the different solidus jobs This avoids using the most recent ruby on solidus versions that barely support it. --- .circleci/config.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fbc92717..1ec2a9f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,13 +29,19 @@ commands: jobs: solidus-master: - executor: solidusio_extensions/sqlite + executor: + name: solidusio_extensions/sqlite + ruby_version: '3.1' steps: ['setup', 'solidusio_extensions/run-tests-solidus-master', 'notify'] solidus-current: - executor: solidusio_extensions/sqlite + executor: + name: solidusio_extensions/sqlite + ruby_version: '3.0' steps: ['setup', 'solidusio_extensions/run-tests-solidus-current', 'notify'] solidus-older: - executor: solidusio_extensions/sqlite + executor: + name: solidusio_extensions/sqlite + ruby_version: '2.7' steps: ['setup', 'solidusio_extensions/run-tests-solidus-older', 'notify'] lint-code: executor: solidusio_extensions/sqlite From 622cead89e6ee4ba7cf748e1bbb8d71df75e0f88 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 19 Dec 2022 13:43:18 +0100 Subject: [PATCH 10/12] Reference the organization level stale-bot configuration --- .../templates/extension/.github/stale.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/.github/stale.yml b/lib/solidus_dev_support/templates/extension/.github/stale.yml index 03407b31..0d0b1c99 100644 --- a/lib/solidus_dev_support/templates/extension/.github/stale.yml +++ b/lib/solidus_dev_support/templates/extension/.github/stale.yml @@ -1,17 +1 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: false -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It might be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false +_extends: .github From d4403a0cd27e7f767940be867e7998dbb262ba0e Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 19 Dec 2022 13:50:38 +0100 Subject: [PATCH 11/12] Only install chrome It's faster and that's the default browser for specs. --- .../templates/extension/.circleci/config.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/.circleci/config.yml b/lib/solidus_dev_support/templates/extension/.circleci/config.yml index 98a5c19b..74133b12 100644 --- a/lib/solidus_dev_support/templates/extension/.circleci/config.yml +++ b/lib/solidus_dev_support/templates/extension/.circleci/config.yml @@ -14,17 +14,16 @@ jobs: run-specs-with-postgres: executor: solidusio_extensions/postgres steps: - - browser-tools/install-browser-tools + - browser-tools/install-chrome - solidusio_extensions/run-tests run-specs-with-mysql: executor: solidusio_extensions/mysql steps: - - browser-tools/install-browser-tools + - browser-tools/install-chrome - solidusio_extensions/run-tests lint-code: executor: solidusio_extensions/sqlite-memory steps: - - browser-tools/install-browser-tools - solidusio_extensions/lint-code workflows: From b176680c33a19d5d102f5c6bf19c581936414c04 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 19 Dec 2022 13:51:44 +0100 Subject: [PATCH 12/12] Add sqlite to the CI config --- .../templates/extension/.circleci/config.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/solidus_dev_support/templates/extension/.circleci/config.yml b/lib/solidus_dev_support/templates/extension/.circleci/config.yml index 74133b12..28d70ebd 100644 --- a/lib/solidus_dev_support/templates/extension/.circleci/config.yml +++ b/lib/solidus_dev_support/templates/extension/.circleci/config.yml @@ -11,6 +11,11 @@ orbs: solidusio_extensions: solidusio/extensions@volatile jobs: + run-specs-with-sqlite: + executor: solidusio_extensions/sqlite + steps: + - browser-tools/install-chrome + - solidusio_extensions/run-tests run-specs-with-postgres: executor: solidusio_extensions/postgres steps: @@ -29,6 +34,7 @@ jobs: workflows: "Run specs on supported Solidus versions": jobs: + - run-specs-with-sqlite - run-specs-with-postgres - run-specs-with-mysql - lint-code @@ -42,5 +48,6 @@ workflows: only: - master jobs: + - run-specs-with-sqlite - run-specs-with-postgres - run-specs-with-mysql