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 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 diff --git a/lib/solidus_dev_support/templates/extension/.circleci/config.yml b/lib/solidus_dev_support/templates/extension/.circleci/config.yml index 98a5c19b..28d70ebd 100644 --- a/lib/solidus_dev_support/templates/extension/.circleci/config.yml +++ b/lib/solidus_dev_support/templates/extension/.circleci/config.yml @@ -11,25 +11,30 @@ 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: - - 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: "Run specs on supported Solidus versions": jobs: + - run-specs-with-sqlite - run-specs-with-postgres - run-specs-with-mysql - lint-code @@ -43,5 +48,6 @@ workflows: only: - master jobs: + - run-specs-with-sqlite - run-specs-with-postgres - run-specs-with-mysql 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 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' 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..3cc1a4f0 100644 --- a/lib/solidus_dev_support/templates/extension/README.md +++ b/lib/solidus_dev_support/templates/extension/README.md @@ -71,21 +71,10 @@ $ 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 -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. diff --git a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt index 38a7d026..00f421d6 100755 --- a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +++ b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt @@ -1,32 +1,9 @@ #!/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) - 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 @@ -50,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 \ 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 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