diff --git a/.circleci/config.yml b/.circleci/config.yml index e7e2f71..98a5c19 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,9 @@ version: 2.1 orbs: + # Required for feature specs. + browser-tools: circleci/browser-tools@1.1 + # Always take the latest version of the orb, this allows us to # run specs against Solidus supported versions only without the need # to change this configuration every time a Solidus version is released @@ -11,14 +14,17 @@ jobs: run-specs-with-postgres: executor: solidusio_extensions/postgres steps: + - browser-tools/install-browser-tools - solidusio_extensions/run-tests run-specs-with-mysql: executor: solidusio_extensions/mysql steps: + - browser-tools/install-browser-tools - solidusio_extensions/run-tests lint-code: executor: solidusio_extensions/sqlite-memory steps: + - browser-tools/install-browser-tools - solidusio_extensions/lint-code workflows: diff --git a/.rubocop.yml b/.rubocop.yml index 498ebdc..b075a8f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,60 +2,4 @@ require: - solidus_dev_support/rubocop AllCops: - Exclude: - - sandbox/**/* - - spec/dummy/**/* - - vendor/bundle/**/* - -RSpec/DescribeClass: - Enabled: false - -Style/ClassAndModuleChildren: - Enabled: false - -Rails/ApplicationRecord: - Enabled: false - -RSpec/MessageSpies: - Enabled: false - -RSpec/MultipleExpectations: - Enabled: false - -RSpec/MultipleMemoizedHelpers: - Max: 8 - -RSpec/NamedSubject: - Enabled: false - -Style/FrozenStringLiteralComment: - Exclude: - - spec/**/* - - db/migrate/**/* - - bin/**/* - -RSpec/NestedGroups: - Enabled: false - -RSpec/VerifiedDoubles: - IgnoreSymbolicNames: true - - -# Enabled on 2020-09-08 - -Rails/ActiveRecordCallbacksOrder: {Enabled: true} -Rails/AfterCommitOverride: {Enabled: true} -Rails/FindById: {Enabled: true} -Rails/Inquiry: {Enabled: true} -Rails/MailerName: {Enabled: true} -Rails/MatchRoute: {Enabled: true} -Rails/NegateInclude: {Enabled: true} -Rails/Pluck: {Enabled: true} -Rails/PluckInWhere: {Enabled: true} -Rails/RenderInline: {Enabled: true} -Rails/RenderPlainText: {Enabled: true} -Rails/ShortI18n: {Enabled: true} -Rails/SquishedSQLHeredocs: {Enabled: true} -Rails/WhereExists: {Enabled: true} -Rails/WhereNot: {Enabled: true} -Performance/Sum: {Enabled: true} + NewCops: disable diff --git a/Gemfile b/Gemfile index bae04dc..a2e25bf 100644 --- a/Gemfile +++ b/Gemfile @@ -4,13 +4,11 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } branch = ENV.fetch('SOLIDUS_BRANCH', 'master') -solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2') - %w[solidusio/solidus solidusio/solidus_frontend] - else - %w[solidusio/solidus] * 2 - end -gem 'solidus', github: solidus_git, branch: branch -gem 'solidus_frontend', github: solidus_frontend_git, branch: branch +gem 'solidus', github: 'solidusio/solidus', branch: branch + +# The solidus_frontend gem has been pulled out since v3.2 +gem 'solidus_frontend', github: 'solidusio/solidus_frontend' if branch == 'master' +gem 'solidus_frontend' if branch >= 'v3.2' # rubocop:disable Bundler/DuplicatedGem # Needed to help Bundler figure out how to resolve dependencies, # otherwise it takes forever to resolve them. @@ -20,7 +18,7 @@ gem 'rails', '>0.a' # Provides basic authentication functionality for testing parts of your engine gem 'solidus_auth_devise' -case ENV['DB'] +case ENV.fetch('DB', nil) when 'mysql' gem 'mysql2' when 'postgresql' @@ -35,6 +33,11 @@ gem 'dato', require: 'dato' gem 'prismic.io', require: 'prismic' gem 'solidus_static_content', github: 'solidusio-contrib/solidus_static_content' +# While we still support Ruby < 3 we need to workaround a limitation in +# the 'async' gem that relies on the latest ruby, since RubyGems doesn't +# resolve gems based on the required ruby version. +gem 'async', '< 3' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3') + gemspec # Use a local Gemfile to include development dependencies that might not be diff --git a/bin/sandbox b/bin/sandbox index 253d5e3..a204a0d 100755 --- a/bin/sandbox +++ b/bin/sandbox @@ -1,6 +1,10 @@ #!/usr/bin/env bash set -e +if [ ! -z $DEBUG ] +then + set -x +fi case "$DB" in postgres|postgresql) @@ -9,21 +13,36 @@ postgres|postgresql) mysql) RAILSDB="mysql" ;; -sqlite|'') +sqlite3|sqlite) + RAILSDB="sqlite3" + ;; +'') + echo "~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter" RAILSDB="sqlite3" ;; *) - echo "Invalid DB specified: $DB" + 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" -if [ ! -z $SOLIDUS_BRANCH ] +if [ -n $SOLIDUS_BRANCH ] then BRANCH=$SOLIDUS_BRANCH else + echo "~~> Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus branch" BRANCH="master" fi +echo "~~> Using branch $BRANCH of solidus" + +if [ -z $SOLIDUS_FRONTEND ] +then + echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend" + SOLIDUS_FRONTEND="solidus_frontend" +fi +echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend" extension_name="solidus_content" @@ -50,7 +69,6 @@ fi cd ./sandbox cat <> Gemfile gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH' -gem 'solidus_auth_devise', '>= 2.1.0' gem 'rails-i18n' gem 'solidus_i18n' @@ -67,20 +85,18 @@ unbundled bundle install --gemfile Gemfile unbundled bundle exec rake db:drop db:create -unbundled bundle exec rails generate spree:install \ +unbundled bundle exec rails generate solidus:install \ --auto-accept \ --user_class=Spree::User \ --enforce_available_locales=true \ - --with-authentication=false \ - --payment-method=none + --with-authentication=true \ + --payment-method=none \ + --frontend=${SOLIDUS_FRONTEND} \ $@ -unbundled bundle exec rails generate solidus:auth:install -unbundled bundle exec rails generate ${extension_name}:install +unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations +unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations echo echo "๐Ÿš€ Sandbox app successfully created for $extension_name!" -echo "๐Ÿš€ Using $RAILSDB and Solidus $BRANCH" -echo "๐Ÿš€ Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter" -echo "๐Ÿš€ Use 'export SOLIDUS_BRANCH=' to control the Solidus version" -echo "๐Ÿš€ This app is intended for test purposes." +echo "๐Ÿงช This app is intended for test purposes."