super_good-solidus_taxjar 0.15.1 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +19 -13
  3. data/.travis.yml +12 -5
  4. data/CHANGELOG.md +64 -0
  5. data/Gemfile +21 -5
  6. data/LICENSE +26 -0
  7. data/PULL_REQUEST_TEMPLATE.md +19 -0
  8. data/README.md +41 -11
  9. data/Rakefile +4 -17
  10. data/bin/rails +7 -0
  11. data/bin/rails-engine +13 -0
  12. data/bin/rails-sandbox +16 -0
  13. data/bin/rake +7 -0
  14. data/bin/sandbox +84 -0
  15. data/lib/super_good-solidus_taxjar.rb +4 -0
  16. data/lib/super_good/engine.rb +8 -0
  17. data/lib/super_good/solidus_taxjar.rb +18 -6
  18. data/lib/super_good/solidus_taxjar/addresses.rb +63 -0
  19. data/lib/super_good/solidus_taxjar/api.rb +23 -10
  20. data/lib/super_good/solidus_taxjar/api_params.rb +27 -9
  21. data/lib/super_good/solidus_taxjar/calculator_helper.rb +38 -0
  22. data/lib/super_good/solidus_taxjar/discount_calculator.rb +1 -1
  23. data/lib/super_good/solidus_taxjar/tax_calculator.rb +13 -46
  24. data/lib/super_good/solidus_taxjar/tax_rate_calculator.rb +35 -0
  25. data/lib/super_good/solidus_taxjar/version.rb +2 -2
  26. data/spec/spec_helper.rb +20 -0
  27. data/spec/super_good/solidus_taxjar/addresses_spec.rb +288 -0
  28. data/spec/super_good/solidus_taxjar/api_params_spec.rb +402 -0
  29. data/spec/super_good/solidus_taxjar/api_spec.rb +205 -0
  30. data/spec/super_good/solidus_taxjar/discount_calculator_spec.rb +13 -0
  31. data/spec/super_good/solidus_taxjar/tax_calculator_spec.rb +332 -0
  32. data/spec/super_good/solidus_taxjar/tax_rate_calculator_spec.rb +116 -0
  33. data/spec/super_good/solidus_taxjar_spec.rb +77 -0
  34. data/super_good-solidus_taxjar.gemspec +17 -14
  35. metadata +37 -10
  36. data/LICENSE.txt +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e46125a6ce81b8d88a0e82106a383bd5125db6b76772d9159eb72e43aa18983
4
- data.tar.gz: 877c5c25c76dca340fb1b984e4c3ddef21b9e1fe79031955ae65e43bfc439e25
3
+ metadata.gz: 977d3ededff1e9bd56c37b6dda9228545160525fed6f7667e194e0ab45486ce8
4
+ data.tar.gz: 10466dec877f8de3eadb843929ec93173bc30fd7ab58be34c5ff08d5de4214b2
5
5
  SHA512:
6
- metadata.gz: d455c4608e74d4345fd0d059abe50dc8592bc8130b3776f093160b4735ae9ba6d512a527cf995b4861eb701bbef092aa5d409c030e5183c6a4cc61ffe4dac729
7
- data.tar.gz: 9a041b4b1a1ed5d6df82b52bac9ecaeb1f55949287a31e3f632e9f706ce45140f6c633c28ca50d7939759fda33ff043fe9afff0945d4ee4985b143b0be19dc68
6
+ metadata.gz: 46ffc2f0a1c52205acdf91a12ec2a3b1806bca174450a1a763e03ba1c54add5a7c82ac538b04bca72c31fa7d295fc2cd9a040e719cd58ddaf7233a1af7655b35
7
+ data.tar.gz: 3186b598fb5d11dd0cab75e145d8e088e6563562767acab012e4127544428fa6e4ac927adb2cc1c9ccbd7dfc831e7bdde1e402462596230736045bb970d54c6e
data/.gitignore CHANGED
@@ -1,14 +1,20 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
1
+ *.gem
2
+ \#*
3
+ *~
4
+ .#*
5
+ .DS_Store
6
+ .idea
7
+ .project
8
+ .sass-cache
9
+ coverage
13
10
  Gemfile.lock
14
- /spec/dummy
11
+ tmp
12
+ nbproject
13
+ pkg
14
+ *.swp
15
+ spec/dummy
16
+ spec/examples.txt
17
+ /sandbox
18
+ .rvmrc
19
+ .ruby-version
20
+ .ruby-gemset
data/.travis.yml CHANGED
@@ -1,12 +1,19 @@
1
1
  ---
2
+ dist: trusty
2
3
  sudo: false
3
4
  language: ruby
4
5
  cache: bundler
5
- rvm:
6
- - 2.3.7
7
- env:
8
- matrix:
9
- - SOLIDUS_BRANCH=v2.4 DB=postgres RAILS_VERSION="~> 5.1.0"
6
+ addons:
7
+ postgresql: "9.3"
8
+ jobs:
9
+ include:
10
+ - rvm: 2.5.8
11
+ env: SOLIDUS_BRANCH=v2.9 DB=postgresql RAILS_VERSION="~> 5.1.0"
12
+ - rvm: 2.6.6
13
+ env: SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 5.2.0"
14
+ - rvm: 2.6.6
15
+ env: SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 6.0.0"
16
+
10
17
  before_install:
11
18
  - gem update --system
12
19
  - gem install bundler
data/CHANGELOG.md CHANGED
@@ -2,6 +2,70 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## v0.18.1
6
+
7
+ [#52](https://github.com/supergoodsoft/solidus_taxjar/pull/52) fixes a critical bug in the API class that was released in `v0.18.0`. Please upgrade.
8
+
9
+ - [#47](https://github.com/SuperGoodSoft/solidus_taxjar/pull/47) Fixed bug in `validate_address_params` for addresses without a state
10
+ - [#52](https://github.com/supergoodsoft/solidus_taxjar/pull/52) Fixed critical bug in API class
11
+
12
+ ## ~~v0.18.0~~
13
+ `v0.18.0` was removed due to a regression in the API class that was fixed in [#52](https://github.com/SuperGoodSoft/solidus_taxjar/pull/52) and `v0.18.1`
14
+
15
+ - [#21](https://github.com/SuperGoodSoft/solidus_taxjar/pull/21) Migrated project to `solidus_dev_support`
16
+ - [#22](https://github.com/SuperGoodSoft/solidus_taxjar/pull/22) Added support for TaxJar address validation API through `SuperGood::SolidusTaxJar::Addresses` class
17
+ - [#34](https://github.com/SuperGoodSoft/solidus_taxjar/pull/34) Include API version in request headers
18
+ - [#38](https://github.com/SuperGoodSoft/solidus_taxjar/pull/38) Added a rails engine to support future solidus backend UI
19
+ - [#43](https://github.com/SuperGoodSoft/solidus_taxjar/pull/43) Support zeitwerk loading
20
+
21
+ **Breaking Changes**:
22
+
23
+ - Module name `SolidusTaxJar` renamed to `SolidusTaxjar`
24
+ - Class name `API` renamed to `Api`
25
+ - Class name `APIParams` renamed to `ApiParams`
26
+
27
+ ### Upgrading from 0.17.X to 0.18.X
28
+
29
+ If you're currently using version 0.17.X and want to upgrade to 0.18.X, follow these steps:
30
+
31
+ - Rename any instances of the module `SolidusTaxJar` to `SolidusTaxjar`
32
+ - Rename any instances of the class `API` to `Api`
33
+ - Rename any instances of the class `APIParams` to `ApiParams`
34
+
35
+ ## v0.17.1
36
+
37
+ - Fixed bug where shipping calculator was not used for order shipping param. (Thanks @spaghetticode!)
38
+
39
+ ## v0.17.0
40
+
41
+ - Added `SuperGood::SolidusTaxJar.custom_order_params` to allow for custom overrides to the parameters sent to TaxJar when calculating order taxes. For example, if you needed to send a custom nexus address you could do:
42
+ ```ruby
43
+ SuperGood::SolidusTaxJar.custom_order_params = ->(order) {
44
+ {
45
+ nexus_addresses: [
46
+ {
47
+ id: 'Main Location',
48
+ country: 'AU',
49
+ zip: 'NSW 2000',
50
+ city: 'Sydney',
51
+ street: '483 George St',
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ ```
57
+ The callback receives the `Spree::Order` that the params are for and the return value can override existing values like the order's ID.
58
+
59
+ ## v0.16.0
60
+
61
+ - Fix `#incomplete_address?` method to be friendly also to completely blank addresses.
62
+
63
+ - Added `SuperGood::SolidusTaxJar::TaxRateCalculator` for retrieving the tax rate for a given `Spree::Address`. The calculator follows `TaxCalculator` conventions by relying on address validators and custom exception handling.
64
+
65
+ ## v0.15.2
66
+
67
+ - Add order number to param logging.
68
+
5
69
  ## v0.15.1
6
70
 
7
71
  - Add support for request/response logging.
data/Gemfile CHANGED
@@ -6,12 +6,21 @@ branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
6
6
 
7
7
  gem "solidus", github: "solidusio/solidus", branch: branch
8
8
 
9
- if ENV['RAILS_VERSION']
10
- gem "rails", ENV['RAILS_VERSON']
11
- end
9
+ # Needed to help Bundler figure out how to resolve dependencies,
10
+ # otherwise it takes forever to resolve them.
11
+ # See https://github.com/bundler/bundler/issues/6677
12
+ gem "rails", ENV.fetch("RAILS_VERSION") { ">0.a" }
13
+
14
+ # Provides basic authentication functionality for testing parts of your engine
15
+ gem "solidus_auth_devise"
12
16
 
13
- if ENV.fetch('DB') == 'postgres'
14
- gem 'pg'
17
+ case ENV["DB"]
18
+ when "mysql"
19
+ gem "mysql2"
20
+ when "postgresql"
21
+ gem "pg"
22
+ else
23
+ gem "sqlite3"
15
24
  end
16
25
 
17
26
  group :development, :test do
@@ -19,3 +28,10 @@ group :development, :test do
19
28
  end
20
29
 
21
30
  gemspec
31
+
32
+ # Use a local Gemfile to include development dependencies that might not be
33
+ # relevant for the project or for other contributors, e.g. pry-byebug.
34
+ #
35
+ # We use `send` instead of calling `eval_gemfile` to work around an issue with
36
+ # how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
37
+ send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2020 Super Good Software, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Solidus nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,19 @@
1
+ What is the goal of this PR?
2
+ ---
3
+
4
+
5
+
6
+ How do you manually test these changes? (if applicable)
7
+ ---
8
+
9
+ 1. Do a thing
10
+ * [ ] Assert a result
11
+
12
+ Merge Checklist
13
+ ---
14
+
15
+ - [ ] Run the manual tests
16
+ - [ ] Update the changelog
17
+
18
+ Screenshots
19
+ ---
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
- ## *Warning:* This extension is under active development and not yet at a v1.0 release.
1
+ # `SuperGood::SolidusTaxjar` [![Build Status](https://travis-ci.com/SuperGoodSoft/solidus_taxjar.svg?token=rc5QTgHvLLF7cpqkmyfd&branch=master)](https://travis-ci.com/SuperGoodSoft/solidus_taxjar)
2
2
 
3
- # `SuperGood::SolidusTaxJar` [![Build Status](https://travis-ci.com/SuperGoodSoft/solidus_taxjar.svg?token=rc5QTgHvLLF7cpqkmyfd&branch=master)](https://travis-ci.com/SuperGoodSoft/solidus_taxjar)
3
+ `SuperGood::SolidusTaxjar` is a [Solidus](https://github.com/solidusio/solidus) extension that allows Solidus stores to use [TaxJar](https://www.taxjar.com/) for tax calculations.
4
4
 
5
- `SuperGood::SolidusTaxJar` is a [Solidus](https://github.com/solidusio/solidus) extension that allows Solidus stores to use [TaxJar](https://www.taxjar.com/) for tax calculations.
6
-
7
- This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spree_taxjar), like [solidus_taxjar](https://github.com/boomerdigital/solidus_taxjar). Instead, `SuperGood::SolidusTaxJar` uses the new configurable tax system [introduced by @adammathys](https://github.com/solidusio/solidus/pull/1892) in Solidus 2.4.
5
+ This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spree_taxjar), like [solidus_taxjar](https://github.com/boomerdigital/solidus_taxjar). Instead of using a custom calculator, `SuperGood::SolidusTaxjar` uses the new configurable tax system [by @adammathys](https://github.com/solidusio/solidus/pull/1892) introduced in Solidus v2.4. This maps better to how the TaxJar API itself works.
8
6
 
9
7
  ## Installation
10
8
 
@@ -18,33 +16,65 @@ This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spr
18
16
 
19
17
  $ bundle
20
18
 
21
- 2. Next, configure Solidus to use this gem:
19
+ 2. Install and run the necessary migrations:
20
+
21
+ ```shell
22
+ bundle exec rails g super_good:solidus_taxjar:install
23
+ bundle exec rake db:migrate
24
+ ```
25
+
26
+ 3. Next, configure Solidus to use this gem:
22
27
 
23
28
  ```ruby
24
29
  # Put this in config/initializers/solidus.rb
25
30
 
26
31
  Spree.config do |config|
27
- config.tax_calculator_class = SuperGood::SolidusTaxJar::TaxCalculator
32
+ config.tax_calculator_class = SuperGood::SolidusTaxjar::TaxCalculator
28
33
  end
29
34
  ```
30
35
 
31
- 3. Also, configure your error handling:
36
+ 4. Also, configure your error handling:
32
37
 
33
38
  ```ruby
34
39
  # Put this in config/initializers/taxjar.rb
35
40
 
36
- SuperGood::SolidusTaxJar::TaxCalculator.exception_handler = ->(e) {
41
+ SuperGood::SolidusTaxjar.exception_handler = ->(e) {
37
42
  # Report exceptions in here. For example, if you were using the Sentry's
38
43
  # raven-ruby gem to report errors, you might do this:
39
44
  Raven.capture_exception(e)
40
45
  }
41
46
  ```
42
47
 
43
- 4. Finally, make sure that the `TAXJAR_API_KEY` environment variable is set to a your TaxJar API key and make sure that you have a `Spree::TaxRate` with the name "Sales Tax". This will be used as the source for the tax adjustments that Solidus creates.
48
+ 5. Finally, make sure that the `TAXJAR_API_KEY` environment variable is set to a your TaxJar API key and make sure that you have a `Spree::TaxRate` with the name "Sales Tax". This will be used as the source for the tax adjustments that Solidus creates.
49
+
50
+ ## Project Status
51
+
52
+ This extension is under active development and not yet at a v1.0 release, but it's currently being used in production by multiple Solidus stores.
53
+
54
+ Requirements for TaxJar integrations vary as some stores also need reporting, which isn't provided out of the box by this extension. This is because individual stores will be using different background job frameworks or runners (Sidekiq, delayed_job, ActiveJob, etc.) and a reliable integration will rely on one of these. Because this part of the integration is small, we've chosen to provide the transaction reporting functionality, but have skipped directly integrating it.
55
+
56
+ If you're having trouble integrating this extension with your store and would like some assistance, please reach out to Jared via e-mail at [jared@super.gd](mailto:jared@super.gd) or on the official Solidus as `@jared`.
57
+
58
+ ## Features
59
+
60
+ The extension provides currently two high level `calculator` classes that wrap the low-level Ruby taxjar gem API calls:
61
+
62
+ * tax calculator
63
+ * tax rate calculator
64
+
65
+ ### TaxCalculator
66
+
67
+ `SuperGood::SolidusTaxjar::TaxCalculator` allows calculating the full tax breakdown for a given `Spree::Order`. The breakdown includes separate line items taxes and shipment taxes.
68
+
69
+ ### TaxRateCalculator
70
+
71
+ `SuperGood::SolidusTaxjar::TaxRateCalculator` allows calculating the tax rate for a given `Spree::Address`. It relies on the same low-level Ruby TaxJar API endpoint of the tax calculator in order to provide the most coherent and reliable results. TaxJar support recommends using this endpoint for live calculations.
44
72
 
45
73
  ## Development
46
74
 
47
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
75
+ Before installing dependencies, make sure your environment variables are setup. Our CI uses something like this: `SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 5.2.0`. These environment variables need to be set when installing dependencies and running specs, so set them before the command like this: `SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 5.2.0 bin/setup`
76
+
77
+ Run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
78
 
49
79
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
80
 
data/Rakefile CHANGED
@@ -1,19 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
- require 'spree/testing_support/extension_rake'
1
+ # frozen_string_literal: true
4
2
 
5
- RSpec::Core::RakeTask.new(:spec)
3
+ require 'solidus_dev_support/rake_tasks'
4
+ SolidusDevSupport::RakeTasks.install
6
5
 
7
- task :default do
8
- if Dir["spec/dummy"].empty?
9
- Rake::Task[:test_app].invoke
10
- Dir.chdir("../../")
11
- end
12
- Rake::Task[:spec].invoke
13
- end
14
-
15
- desc 'Generates a dummy app for testing'
16
- task :test_app do
17
- ENV['LIB_NAME'] = 'super_good/solidus_taxjar'
18
- Rake::Task['extension:test_app'].invoke
19
- end
6
+ task default: 'extension:specs'
data/bin/rails ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
7
+ end
data/bin/rails-engine ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path("..", __dir__)
6
+ ENGINE_PATH = File.expand_path("../lib/solidus_taxjar/engine", __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
10
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+
12
+ require "rails/all"
13
+ require "rails/engine/commands"
data/bin/rails-sandbox ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ app_root = "sandbox"
4
+
5
+ unless File.exist? "#{app_root}/bin/rails"
6
+ warn "Creating the sandbox app..."
7
+ Dir.chdir "#{__dir__}/.." do
8
+ system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
9
+ warn "Automatic creation of the sandbox app failed"
10
+ exit 1
11
+ end
12
+ end
13
+ end
14
+
15
+ Dir.chdir app_root
16
+ exec "bin/rails", *ARGV
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/sandbox ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ case "$DB" in
6
+ postgres|postgresql)
7
+ RAILSDB="postgresql"
8
+ ;;
9
+ mysql)
10
+ RAILSDB="mysql"
11
+ ;;
12
+ sqlite|'')
13
+ RAILSDB="sqlite3"
14
+ ;;
15
+ *)
16
+ echo "Invalid DB specified: $DB"
17
+ exit 1
18
+ ;;
19
+ esac
20
+
21
+ if [ ! -z $SOLIDUS_BRANCH ]
22
+ then
23
+ BRANCH=$SOLIDUS_BRANCH
24
+ else
25
+ BRANCH="master"
26
+ fi
27
+
28
+ extension_name="super_good-solidus_taxjar"
29
+
30
+ # Stay away from the bundler env of the containing extension.
31
+ function unbundled {
32
+ ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
33
+ }
34
+
35
+ rm -rf ./sandbox
36
+ unbundled bundle exec rails new sandbox --database="$RAILSDB" \
37
+ --skip-bundle \
38
+ --skip-git \
39
+ --skip-keeps \
40
+ --skip-rc \
41
+ --skip-spring \
42
+ --skip-test \
43
+ --skip-javascript
44
+
45
+ if [ ! -d "sandbox" ]; then
46
+ echo 'sandbox rails application failed'
47
+ exit 1
48
+ fi
49
+
50
+ cd ./sandbox
51
+ cat <<RUBY >> Gemfile
52
+ gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
53
+ gem 'solidus_auth_devise', '>= 2.1.0'
54
+ gem 'rails-i18n'
55
+ gem 'solidus_i18n'
56
+
57
+ gem '$extension_name', path: '..'
58
+
59
+ group :test, :development do
60
+ platforms :mri do
61
+ gem 'pry-byebug'
62
+ end
63
+ end
64
+ RUBY
65
+
66
+ unbundled bundle install --gemfile Gemfile
67
+
68
+ unbundled bundle exec rake db:drop db:create
69
+
70
+ unbundled bundle exec rails generate spree:install \
71
+ --auto-accept \
72
+ --user_class=Spree::User \
73
+ --enforce_available_locales=true \
74
+ --with-authentication=false \
75
+ $@
76
+
77
+ unbundled bundle exec rails generate solidus:auth:install
78
+
79
+ echo
80
+ echo "🚀 Sandbox app successfully created for $extension_name!"
81
+ echo "🚀 Using $RAILSDB and Solidus $BRANCH"
82
+ echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
83
+ echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
84
+ echo "🚀 This app is intended for test purposes."