solidus_dev_support 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f56dae194c8b778da9182c440ef9e3114dd3fc85f95884199c4809eda2d902e3
4
- data.tar.gz: e8b766266ff7d54e13f706fb0a57682cb4578f834b79ef50d89b401ae1728304
3
+ metadata.gz: ba24e6dd743046ef4acfa3d5a9f1fe1308f4d2ff5175ca6ace8b537529e4309d
4
+ data.tar.gz: 0716f96e176e807aa910408e62b930da5719cd7bc2703b03a1a764230f90b76c
5
5
  SHA512:
6
- metadata.gz: 0db6603ab2abbda31d662be42a9195031a4e6f810e16d4735942189593ac3cae15c526e962f5162a0efb2b5f4412df6f446da6379e03c9e4753fcaf6a73ad75f
7
- data.tar.gz: ecffb2ae71fc3188152defc95d8cf0ca3a9a1a26472bc5d6195aa3593e63bdb0804e09be1fa49a9d5d042917a9302c49e968d04d2d7b11dc1679e7a823e44733
6
+ metadata.gz: 1b9bf1dc55fb744fe1f0aa39ef72a01bb6abc3429530d1b11122afdf71b8ff135e1be280465077f68590eb84c505588cb258602e8ce36ede76511a5008dc075d
7
+ data.tar.gz: f73be0985dc2937ffd5380019834b578533f31e014c6d22296c0b52b04e4bee12d2b3c8747ddb6114115e8f1c03afe3880bb6ec4befbe63d01da2aa42a337963
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
6
6
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Made Git ignore `sandbox` in generated extensions
13
+ - Added support for specifying `SOLIDUS_BRANCH` in the sandbox
14
+
15
+ ### Changed
16
+
17
+ - Split `bin/rails` into `bin/r` and `bin/sandbox_rails`
18
+
19
+ ### Fixed
20
+
21
+ - Fixed the sandbox Gemfile not including Solidus
22
+
8
23
  ## [1.0.1] - 2020-02-17
9
24
 
10
25
  ### Fixed
data/README.md CHANGED
@@ -50,16 +50,16 @@ sense to you.
50
50
  ### Sandbox app
51
51
 
52
52
  When developing an extension you will surely need to try it out within a Rails app with Solidus
53
- installed. Using solidus_dev_support your extension will have a `bin/rails` executable that will
53
+ installed. Using solidus_dev_support your extension will have a `bin/sandbox_rails` executable that will
54
54
  operate on a _sandbox_ app (creating it if necessary).
55
55
 
56
- The path for the sandbox app is `./sandbox` and `bin/rails` will forward any Rails command
56
+ The path for the sandbox app is `./sandbox` and `bin/sandbox_rails` will forward any Rails command
57
57
  to `sandbox/bin/rails`.
58
58
 
59
59
  Example:
60
60
 
61
61
  ```bash
62
- $ bin/rails server
62
+ $ bin/sandbox_rails server
63
63
  => Booting Puma
64
64
  => Rails 6.0.2.1 application starting in development
65
65
  * Listening on tcp://127.0.0.1:3000
@@ -69,6 +69,25 @@ Use Ctrl-C to stop
69
69
  #### Rebuilding the sandbox app
70
70
 
71
71
  To rebuild the sandbox app just remove the `./sandbox` folder or run `bin/sandbox`.
72
+ You can control the DB adapter and Solidus version used with the sandbox by providing
73
+ the `DB` and `SOLIDUS_BRANCH` env variables.
74
+
75
+ ```bash
76
+ DB=[postgres|mysql|sqlite] SOLIDUS_BRANCH=<BRANCH-NAME> bin/sandbox
77
+ ```
78
+
79
+ By default we use sqlite3 and the master branch.
80
+
81
+ ### Rails generators
82
+
83
+ Your extension will have a `bin/r` executable that you can use for generating models, migrations
84
+ etc. It's the same as the default `rails` command in Rails engines.
85
+
86
+ Example:
87
+
88
+ ```bash
89
+ $ bin/r generate migration AddStoreIdToProducts
90
+ ```
72
91
 
73
92
  ### RSpec helpers
74
93
 
@@ -22,13 +22,19 @@ bundle exec rails g <%= file_name %>:install
22
22
  Testing
23
23
  -------
24
24
 
25
- First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs, and [Rubocop](https://github.com/bbatsov/rubocop) static code analysis. The dummy app can be regenerated by using `rake test_app`.
25
+ First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `bin/rake extension:test_app`.
26
26
 
27
27
  ```shell
28
28
  bundle
29
29
  bin/rake
30
30
  ```
31
31
 
32
+ To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
33
+
34
+ ```shell
35
+ bundle exec rubocop
36
+ ```
37
+
32
38
  When testing your application's integration with this extension you may use its factories.
33
39
  Simply add this require statement to your spec_helper:
34
40
 
@@ -36,6 +42,23 @@ Simply add this require statement to your spec_helper:
36
42
  require '<%= file_name %>/factories'
37
43
  ```
38
44
 
45
+ Sandbox app
46
+ -----------
47
+
48
+ To run this extension in a sandboxed Solidus application you can run `bin/sandbox`
49
+ The path for the sandbox app is `./sandbox` and `bin/rails` will forward any Rails command
50
+ to `sandbox/bin/rails`.
51
+
52
+ Example:
53
+
54
+ ```shell
55
+ $ bin/rails server
56
+ => Booting Puma
57
+ => Rails 6.0.2.1 application starting in development
58
+ * Listening on tcp://127.0.0.1:3000
59
+ Use Ctrl-C to stop
60
+ ```
61
+
39
62
  Releasing
40
63
  ---------
41
64
 
@@ -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/<%=file_name%>/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'
@@ -18,6 +18,13 @@ sqlite|'')
18
18
  ;;
19
19
  esac
20
20
 
21
+ if [ ! -z $SOLIDUS_BRANCH ]
22
+ then
23
+ BRANCH=$SOLIDUS_BRANCH
24
+ else
25
+ BRANCH="master"
26
+ fi
27
+
21
28
  extension_name="<%= file_name %>"
22
29
 
23
30
  # Stay away from the bundler env of the containing extension.
@@ -42,12 +49,13 @@ fi
42
49
 
43
50
  cd ./sandbox
44
51
  cat <<RUBY >> Gemfile
45
-
46
- gem '$extension_name', path: '..'
52
+ gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
47
53
  gem 'solidus_auth_devise', '>= 2.1.0'
48
54
  gem 'rails-i18n'
49
55
  gem 'solidus_i18n'
50
56
 
57
+ gem '$extension_name', path: '..'
58
+
51
59
  group :test, :development do
52
60
  platforms :mri do
53
61
  gem 'pry-byebug'
@@ -69,4 +77,7 @@ unbundled bundle exec rails generate solidus:auth:install
69
77
 
70
78
  echo
71
79
  echo "🚀 Sandbox app successfully created for $extension_name!"
80
+ echo "🚀 Using $RAILSDB and Solidus $BRANCH"
81
+ echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
82
+ echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
72
83
  echo "🚀 This app is intended for test purposes."
@@ -14,3 +14,4 @@ pkg
14
14
  *.swp
15
15
  spec/dummy
16
16
  spec/examples.txt
17
+ /sandbox
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spree/core'
4
+ require '<%= file_name %>'
4
5
 
5
6
  module <%= class_name %>
6
7
  class Engine < Rails::Engine
@@ -6,13 +6,13 @@ module <%= class_name %>
6
6
  class_option :auto_run_migrations, type: :boolean, default: false
7
7
 
8
8
  def add_javascripts
9
- append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n"
10
- append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
9
+ append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n" # rubocop:disable Metrics/LineLength
10
+ append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n" # rubocop:disable Metrics/LineLength
11
11
  end
12
12
 
13
13
  def add_stylesheets
14
- inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true
15
- inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true
14
+ inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Metrics/LineLength
15
+ inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Metrics/LineLength
16
16
  end
17
17
 
18
18
  def add_migrations
@@ -20,7 +20,7 @@ module <%= class_name %>
20
20
  end
21
21
 
22
22
  def run_migrations
23
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
23
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Metrics/LineLength
24
24
  if run_migrations
25
25
  run 'bin/rails db:migrate'
26
26
  else
@@ -1,2 +1,7 @@
1
1
  require:
2
2
  - solidus_dev_support/rubocop
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - sandbox/**/*
7
+ - spec/dummy/**/*
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusDevSupport
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_dev_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-17 00:00:00.000000000 Z
11
+ date: 2020-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apparition
@@ -330,9 +330,10 @@ files:
330
330
  - lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/backend/%file_name%.css
331
331
  - lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/frontend/%file_name%.css
332
332
  - lib/solidus_dev_support/templates/extension/bin/console.tt
333
- - lib/solidus_dev_support/templates/extension/bin/rails
333
+ - lib/solidus_dev_support/templates/extension/bin/r.tt
334
334
  - lib/solidus_dev_support/templates/extension/bin/rake
335
335
  - lib/solidus_dev_support/templates/extension/bin/sandbox.tt
336
+ - lib/solidus_dev_support/templates/extension/bin/sandbox_rails
336
337
  - lib/solidus_dev_support/templates/extension/bin/setup
337
338
  - lib/solidus_dev_support/templates/extension/config/locales/en.yml
338
339
  - lib/solidus_dev_support/templates/extension/config/routes.rb