solidus_dev_support 1.0.1 → 1.5.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: 2320ceaf62d68e7e76f5ebd54a77ed582fddbc0f4933caaba3f823d8f8ebb53f
4
+ data.tar.gz: 765116a27d6167455eee850837d71aee6d807a1ff1437efa916c0890db2e638a
5
5
  SHA512:
6
- metadata.gz: 0db6603ab2abbda31d662be42a9195031a4e6f810e16d4735942189593ac3cae15c526e962f5162a0efb2b5f4412df6f446da6379e03c9e4753fcaf6a73ad75f
7
- data.tar.gz: ecffb2ae71fc3188152defc95d8cf0ca3a9a1a26472bc5d6195aa3593e63bdb0804e09be1fa49a9d5d042917a9302c49e968d04d2d7b11dc1679e7a823e44733
6
+ metadata.gz: a263c2ce6e5ce6de123cb52e4e1a9457be7979b2eb811de170efbbfd5c10b774a697efa116899e08a75e5f1062b6f878d8796d543d172d1b369a760089425e70
7
+ data.tar.gz: 12a2731dadf62796e4880f7911eb14125691e9fc7886b8bcbde881705a218334e36ac1d5d4602594836fc9de4df0c1eca5b36ecce557522085bae2ce7ccb4970
@@ -8,4 +8,3 @@ Fixes #XXX.
8
8
 
9
9
  - [ ] I have structured the commits for clarity and conciseness.
10
10
  - [ ] I have added relevant automated tests for this change.
11
- - [ ] I have added an entry to the changelog for this change.
@@ -0,0 +1,4 @@
1
+ issues=false
2
+ exclude-labels=infrastructure
3
+ since-tag=v1.4.0
4
+ base=OLD_CHANGELOG.md
@@ -0,0 +1,39 @@
1
+ pull_request_rules:
2
+ - name: request changelog labels when a PR is missing them
3
+ conditions:
4
+ - base=master
5
+ - -label=bug
6
+ - -label=enhancement
7
+ - -label=documentation
8
+ - -label=security
9
+ - -label=removed
10
+ - -label=infrastructure
11
+ actions:
12
+ label:
13
+ add:
14
+ - needs changelog label
15
+ comment:
16
+ message: |
17
+ It looks like this PR is missing a label to determine the type of change it introduces. The maintainer should add one of the following labels:
18
+
19
+ - `bug` for bugfixes.
20
+ - `enhancement` for new features and improvements.
21
+ - `documentation` for documentation changes.
22
+ - `security` for security patches.
23
+ - `removed` for feature removals.
24
+ - `infrastructure` for internal changes that should not go in the changelog.
25
+
26
+ Additionally, the maintainer may also want to add one of the following:
27
+
28
+ - `breaking` for breaking changes.
29
+ - `deprecated` for feature deprecations.
30
+
31
+ Once the correct labels have been set, simply remove the `needs changelog label` label from this PR so I can merge it.
32
+ - name: merge PRs automatically
33
+ conditions:
34
+ - base=master
35
+ - -label="needs changelog label"
36
+ - -label=blocked
37
+ actions:
38
+ merge:
39
+ method: merge
@@ -1,9 +1,70 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ## [v1.5.0](https://github.com/solidusio/solidus_dev_support/tree/v1.5.0) (2020-06-13)
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
6
- adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.4.0...v1.5.0)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Fix formatting typo in readme [\#117](https://github.com/solidusio/solidus_dev_support/pull/117) ([aldesantis](https://github.com/aldesantis))
10
+
11
+ **Removed:**
12
+
13
+ - Remove deprecated bin/r and bin/sandbox\_rails binaries [\#118](https://github.com/solidusio/solidus_dev_support/pull/118) ([aldesantis](https://github.com/aldesantis))
14
+
15
+ ## [1.4.0] - 2020-06-05
16
+
17
+ ### Added
18
+
19
+ - Added a "Usage" section to the default readme
20
+
21
+ ### Changed
22
+
23
+ - Restored `bin/rails` and renamed the context specific bins to `bin/rails-engine` and `bin/rails-sandbox`
24
+ - Adjusted the readme structure with better formatting and grammar
25
+ - Moved the RuboCop `AllCops/Exclude` statement back to the internal configuration
26
+
27
+ ### Deprecated
28
+
29
+ - Deprecated `bin/r` in favor of `bin/rails-engine` and `bin/sandbox_rails` in favor of `bin/rails-sandbox`
30
+
31
+ ## [1.3.0] - 2020-05-22
32
+
33
+ ### Added
34
+
35
+ - Ignored `.rvmrc`, `.ruby-version` and `.ruby-gemset` by default in extensions
36
+ - Added deprecation warning when extensions don't support Zeitwerk
37
+
38
+ ### Changed
39
+
40
+ - Updated the extension template to use latest (0.5.X) solidus_support
41
+ - Set Ruby 2.5+ as the minimum Ruby version in generated extensions
42
+
43
+ ### Removed
44
+
45
+ - Removed Stale from the default extension configuration
46
+
47
+ ## [1.2.0] - 2020-04-24
48
+
49
+ ### Changed
50
+
51
+ - Updated the extension template with the latest modifications
52
+
53
+ ## [1.1.0] - 2020-03-06
54
+
55
+ ### Added
56
+
57
+ - Made Git ignore `sandbox` in generated extensions
58
+ - Added support for specifying `SOLIDUS_BRANCH` in the sandbox
59
+
60
+ ### Changed
61
+
62
+ - Split `bin/rails` into `bin/r` and `bin/sandbox_rails`
63
+
64
+
65
+ ### Fixed
66
+
67
+ - Fixed the sandbox Gemfile not including Solidus
7
68
 
8
69
  ## [1.0.1] - 2020-02-17
9
70
 
@@ -136,7 +197,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
136
197
 
137
198
  Initial release.
138
199
 
139
- [Unreleased]: https://github.com/solidusio/solidus_dev_support/compare/v1.0.1...HEAD
200
+ [Unreleased]: https://github.com/solidusio/solidus_dev_support/compare/v1.4.0...HEAD
201
+ [1.4.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.3.0...v1.4.0
202
+ [1.3.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.2.0...v1.3.0
203
+ [1.2.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.1.0...v1.2.0
204
+ [1.1.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.0.1...v1.1.0
140
205
  [1.0.1]: https://github.com/solidusio/solidus_dev_support/compare/v1.0.0...v1.0.1
141
206
  [1.0.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.6.0...v1.0.0
142
207
  [0.6.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.5.0...v0.6.0
@@ -147,3 +212,6 @@ Initial release.
147
212
  [0.2.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.1.1...v0.2.0
148
213
  [0.1.1]: https://github.com/solidusio/solidus_dev_support/compare/v0.1.0...v0.1.1
149
214
  [0.1.0]: https://github.com/solidusio/solidus_dev_support/releases/tag/v0.1.0
215
+
216
+
217
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
@@ -0,0 +1,200 @@
1
+ ## [1.4.0] - 2020-06-05
2
+
3
+ ### Added
4
+
5
+ - Added a "Usage" section to the default readme
6
+
7
+ ### Changed
8
+
9
+ - Restored `bin/rails` and renamed the context specific bins to `bin/rails-engine` and `bin/rails-sandbox`
10
+ - Adjusted the readme structure with better formatting and grammar
11
+ - Moved the RuboCop `AllCops/Exclude` statement back to the internal configuration
12
+
13
+ ### Deprecated
14
+
15
+ - Deprecated `bin/r` in favor of `bin/rails-engine` and `bin/sandbox_rails` in favor of `bin/rails-sandbox`
16
+
17
+ ## [1.3.0] - 2020-05-22
18
+
19
+ ### Added
20
+
21
+ - Ignored `.rvmrc`, `.ruby-version` and `.ruby-gemset` by default in extensions
22
+ - Added deprecation warning when extensions don't support Zeitwerk
23
+
24
+ ### Changed
25
+
26
+ - Updated the extension template to use latest (0.5.X) solidus_support
27
+ - Set Ruby 2.5+ as the minimum Ruby version in generated extensions
28
+
29
+ ### Removed
30
+
31
+ - Removed Stale from the default extension configuration
32
+
33
+ ## [1.2.0] - 2020-04-24
34
+
35
+ ### Changed
36
+
37
+ - Updated the extension template with the latest modifications
38
+
39
+ ## [1.1.0] - 2020-03-06
40
+
41
+ ### Added
42
+
43
+ - Made Git ignore `sandbox` in generated extensions
44
+ - Added support for specifying `SOLIDUS_BRANCH` in the sandbox
45
+
46
+ ### Changed
47
+
48
+ - Split `bin/rails` into `bin/r` and `bin/sandbox_rails`
49
+
50
+
51
+ ### Fixed
52
+
53
+ - Fixed the sandbox Gemfile not including Solidus
54
+
55
+ ## [1.0.1] - 2020-02-17
56
+
57
+ ### Fixed
58
+
59
+ - Fixed missing factory definitions when using `modify` on Solidus factories
60
+
61
+ ## [1.0.0] - 2020-02-07
62
+
63
+ ### Added
64
+
65
+ - Added a binstub for `rake` to the extension generator
66
+ - Added the ability for the generator to reuse existing data for the gemspec
67
+
68
+ ### Fixed
69
+
70
+ - Fixed Dependabot throwing an error because of `eval_gemfile` in the Gemfile
71
+
72
+ ## [0.6.0] - 2020-01-20
73
+
74
+ ### Added
75
+
76
+ - Added support for a local Gemfile for local development dependencies (e.g. 'pry-debug')
77
+ - Added a `bin/sandbox` script to all extension for local development with `bin/rails` support.
78
+
79
+ ### Changed
80
+
81
+ - The default rake task no longer re-generates the `test_app` each time it runs.
82
+ In order to get that behavior back simply call clobber before launching it:
83
+ `bin/rake clobber default`
84
+
85
+ ### Fixed
86
+
87
+ - Fixed generated extensions isolating the wrong namespace
88
+
89
+ ## [0.5.0] - 2020-01-16
90
+
91
+ ### Added
92
+
93
+ - Added `--require spec_helper` to the generated `.rspec`
94
+
95
+ ### Fixed
96
+
97
+ - Replaced "Spree" with "Solidus" in the license of generated extensions
98
+
99
+ ### Changed
100
+
101
+ - Updated gem-release to use tags instead of branches for new releases
102
+
103
+ ## [0.4.1] - 2020-01-15
104
+
105
+ ### Fixed
106
+
107
+ - Fixed the generated RuboCop config inheriting from this gem's dev-only config
108
+ - Fixed the generated extension not requiring the `version` file
109
+ - Fixed the generator not properly marking `bin/` files as executable
110
+
111
+ ## [0.4.0] - 2020-01-10
112
+
113
+ ### Added
114
+
115
+ - Enforced Rails version depending on the Solidus version in generated Gemfile
116
+ - Made Git ignore `spec/examples.txt` in generated extensions
117
+ - Added the ability to run `solidus extension .` to update an extension
118
+
119
+ ### Changed
120
+
121
+ - The `solidus` executable is now solely managed by Thor and is open to extension by other gems
122
+
123
+ ### Fixed
124
+
125
+ - Fixed generated extensions using an old Rakefile
126
+ - Fixed some RuboCop offenses in the generated files
127
+ - Fixed the `bin/setup` script calling a non-existing Rake binary
128
+
129
+ ### Removed
130
+
131
+ - Removed RuboCop from the default Rake task
132
+ - Removed the `-v` option from the `solidus` executable
133
+ - Removed the factory_bot gem from the Gemfile
134
+
135
+ ## [0.3.0] - 2020-01-10
136
+
137
+ ### Added
138
+
139
+ - Adopted Ruby 2.4+ as the minimum Ruby version in generated extensions
140
+ - Added `bin/console`, `bin/rails` and `bin/setup` to generated extensions
141
+ - Added some Bundler gemspec defaults to generated extensions
142
+ - Configured the default Rake task to run generate the test app before running RSpec
143
+
144
+ ### Changed
145
+
146
+ - Updated solidus_support to 0.4.0 for Zeitwerk and Rails 6 compatibility
147
+ - Updated the `solidus` executable to only rely on Thor and be open to extension by other gems
148
+
149
+ ### Removed
150
+
151
+ - Removed solidus_support as a dependency
152
+
153
+ ### Fixed
154
+
155
+ - Fixed `extension:test_app` not going back to the root after execution
156
+
157
+ ## [0.2.0] - 2019-12-16
158
+
159
+ ### Added
160
+
161
+ - Adopted [Apparition](https://github.com/twalpole/apparition) as the deafult JS driver for Capybara
162
+ - Fixed window size to 1920x1080px in feature specs
163
+ - Added [Stale](https://github.com/apps/stale) to automatically mark GitHub issues as stale
164
+
165
+ ### Changed
166
+
167
+ - Disabled all `Metrics` cops except for `LineLength`
168
+ - Set `Layout/AlignArguments` cop to `with_fixed_indentation`
169
+ - Disabled `Layout/MultilineOperationIndentation` cop
170
+ - Renamed the project to SolidusDevSupport (was SolidusExtensionDevTools)
171
+
172
+ ### Fixed
173
+
174
+ - Fixed Chrome not starting in headless mode
175
+
176
+ ## [0.1.1] - 2019-11-11
177
+
178
+ ### Fixed
179
+
180
+ - Fixed `rails_helper` not working due to `SolidusDevSupport` not being available
181
+
182
+ ## [0.1.0] - 2019-11-11
183
+
184
+ Initial release.
185
+
186
+ [Unreleased]: https://github.com/solidusio/solidus_dev_support/compare/v1.4.0...HEAD
187
+ [1.4.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.3.0...v1.4.0
188
+ [1.3.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.2.0...v1.3.0
189
+ [1.2.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.1.0...v1.2.0
190
+ [1.1.0]: https://github.com/solidusio/solidus_dev_support/compare/v1.0.1...v1.1.0
191
+ [1.0.1]: https://github.com/solidusio/solidus_dev_support/compare/v1.0.0...v1.0.1
192
+ [1.0.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.6.0...v1.0.0
193
+ [0.6.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.5.0...v0.6.0
194
+ [0.5.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.4.1...v0.5.0
195
+ [0.4.1]: https://github.com/solidusio/solidus_dev_support/compare/v0.4.0...v0.4.1
196
+ [0.4.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.3.0...v0.4.0
197
+ [0.3.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.2.0...v0.3.0
198
+ [0.2.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.1.1...v0.2.0
199
+ [0.1.1]: https://github.com/solidusio/solidus_dev_support/compare/v0.1.0...v0.1.1
200
+ [0.1.0]: https://github.com/solidusio/solidus_dev_support/releases/tag/v0.1.0
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/rails-sandbox` 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/rails-sandbox` 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/rails-sandbox 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,30 @@ 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/rails-engine` 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/rails-engine generate migration AddStoreIdToProducts
90
+ ```
91
+
92
+ ### The `bin/rails` shortcut
93
+
94
+ For convenience a `bin/rails` executable is also provided that will run everything but generators on the sandbox application. Generators will instead be processed in the context of the extension.
95
+
72
96
 
73
97
  ### RSpec helpers
74
98
 
@@ -59,4 +59,29 @@ RSpec.configure do |config|
59
59
  end
60
60
 
61
61
  config.include ActiveJob::TestHelper
62
+
63
+ config.after(:suite) do
64
+ if Rails.respond_to?(:autoloaders) && Rails.autoloaders.zeitwerk_enabled?
65
+ Rails.autoloaders.main.class.eager_load_all
66
+ end
67
+ rescue NameError => e
68
+ class ZeitwerkNameError < NameError; end
69
+
70
+ message = <<~WARN
71
+ Zeitwerk raised the following error when trying to eager load your extension:
72
+
73
+ #{if e.message =~ /expected file .*? to define constant [\w:]+/
74
+ e.message.sub(/expected file #{Regexp.escape(File.expand_path('../..', Rails.root))}./, "expected file ")
75
+ else
76
+ e.message
77
+ end}
78
+
79
+ This most likely means that your extension's file structure is not
80
+ compatible with the Zeitwerk autoloader.
81
+ Refer to https://github.com/solidusio/solidus_support#engine-extensions in
82
+ order to update the file structure to match Zeitwerk's expectations.
83
+ WARN
84
+
85
+ raise ZeitwerkNameError, message
86
+ end
62
87
  end
@@ -180,9 +180,10 @@ require:
180
180
  - rubocop-performance
181
181
 
182
182
  AllCops:
183
- TargetRubyVersion: 2.4
183
+ TargetRubyVersion: 2.5
184
184
  Exclude:
185
185
  - spec/dummy/**/*
186
+ - sandbox/**/*
186
187
  - vendor/**/*
187
188
 
188
189
  Metrics/BlockLength:
@@ -1,10 +1,8 @@
1
- <%= class_name %>
2
- <%= "=" * class_name.size %>
1
+ # <%= class_name %>
3
2
 
4
- Introduction goes here.
3
+ [Explain what your extension does.]
5
4
 
6
- Installation
7
- ------------
5
+ ## Installation
8
6
 
9
7
  Add <%= file_name %> to your Gemfile:
10
8
 
@@ -19,16 +17,29 @@ bundle
19
17
  bundle exec rails g <%= file_name %>:install
20
18
  ```
21
19
 
22
- Testing
23
- -------
20
+ ## Usage
24
21
 
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`.
22
+ [Explain how to use your extension once it's been installed.]
23
+
24
+ ## Development
25
+
26
+ ### Testing the extension
27
+
28
+ First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
29
+ app if it does not exist, then it will run specs. The dummy app can be regenerated by using
30
+ `bin/rake extension:test_app`.
26
31
 
27
32
  ```shell
28
33
  bundle
29
34
  bin/rake
30
35
  ```
31
36
 
37
+ To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
38
+
39
+ ```shell
40
+ bundle exec rubocop
41
+ ```
42
+
32
43
  When testing your application's integration with this extension you may use its factories.
33
44
  Simply add this require statement to your spec_helper:
34
45
 
@@ -36,8 +47,23 @@ Simply add this require statement to your spec_helper:
36
47
  require '<%= file_name %>/factories'
37
48
  ```
38
49
 
39
- Releasing
40
- ---------
50
+ ### Running the sandbox
51
+
52
+ To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
53
+ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
54
+ `sandbox/bin/rails`.
55
+
56
+ Here's an example:
57
+
58
+ ```shell
59
+ $ bin/rails server
60
+ => Booting Puma
61
+ => Rails 6.0.2.1 application starting in development
62
+ * Listening on tcp://127.0.0.1:3000
63
+ Use Ctrl-C to stop
64
+ ```
65
+
66
+ ### Releasing new versions
41
67
 
42
68
  Your new extension version can be released using `gem-release` like this:
43
69
 
@@ -45,4 +71,6 @@ Your new extension version can be released using `gem-release` like this:
45
71
  bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release
46
72
  ```
47
73
 
48
- Copyright (c) <%= Time.now.year %> [name of extension creator], released under the New BSD License
74
+ ## License
75
+
76
+ Copyright (c) <%= Time.now.year %> [name of extension author], released under the New BSD License.
@@ -1,18 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # frozen_string_literal: true
4
-
5
- app_root = 'sandbox'
6
-
7
- unless File.exist? "#{app_root}/bin/rails"
8
- warn 'Creating the sandbox app...'
9
- Dir.chdir "#{__dir__}/.." do
10
- system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
11
- warn 'Automatic creation of the sandbox app failed'
12
- exit 1
13
- end
14
- end
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
15
7
  end
16
-
17
- Dir.chdir app_root
18
- exec 'bin/rails', *ARGV
@@ -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'
@@ -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
@@ -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'
@@ -63,10 +71,14 @@ unbundled bundle exec rails generate spree:install \
63
71
  --auto-accept \
64
72
  --user_class=Spree::User \
65
73
  --enforce_available_locales=true \
74
+ --with-authentication=false \
66
75
  $@
67
76
 
68
77
  unbundled bundle exec rails generate solidus:auth:install
69
78
 
70
79
  echo
71
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"
72
84
  echo "🚀 This app is intended for test purposes."
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata['source_code_uri'] = '<%= gemspec.homepage %>'
18
18
  spec.metadata['changelog_uri'] = '<%= gemspec.metadata["changelog_uri"] %>'
19
19
 
20
- spec.required_ruby_version = Gem::Requirement.new('~> 2.4')
20
+ spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
33
- spec.add_dependency 'solidus_support', '~> 0.4.0'
33
+ spec.add_dependency 'solidus_support', '~> 0.5'
34
34
 
35
35
  spec.add_development_dependency 'solidus_dev_support'
36
36
  end
@@ -14,3 +14,7 @@ pkg
14
14
  *.swp
15
15
  spec/dummy
16
16
  spec/examples.txt
17
+ /sandbox
18
+ .rvmrc
19
+ .ruby-version
20
+ .ruby-gemset
@@ -1,10 +1,11 @@
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
7
- include SolidusSupport::EngineExtensions::Decorators
8
+ include SolidusSupport::EngineExtensions
8
9
 
9
10
  isolate_namespace ::Spree
10
11
 
@@ -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
@@ -6,7 +6,10 @@ ENV['RAILS_ENV'] = 'test'
6
6
  # Run Coverage report
7
7
  require 'solidus_dev_support/rspec/coverage'
8
8
 
9
- require File.expand_path('dummy/config/environment.rb', __dir__)
9
+ require File.expand_path('dummy/config/environment.rb', __dir__).tap { |file|
10
+ # Create the dummy app if it's still missing.
11
+ system 'bin/rake extension:test_app' unless File.exist? file
12
+ }
10
13
 
11
14
  # Requires factories and other useful helpers defined in spree_core.
12
15
  require 'solidus_dev_support/rspec/feature_helper'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusDevSupport
4
- VERSION = "1.0.1"
4
+ VERSION = "1.5.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.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-17 00:00:00.000000000 Z
11
+ date: 2020-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apparition
@@ -282,7 +282,7 @@ dependencies:
282
282
  - - ">="
283
283
  - !ruby/object:Gem::Version
284
284
  version: '0'
285
- description:
285
+ description:
286
286
  email:
287
287
  - alessandrodesantis@nebulab.it
288
288
  executables:
@@ -293,14 +293,16 @@ files:
293
293
  - ".circleci/config.yml"
294
294
  - ".gem_release.yml"
295
295
  - ".github/PULL_REQUEST_TEMPLATE.md"
296
- - ".github/stale.yml"
296
+ - ".github_changelog_generator"
297
297
  - ".gitignore"
298
+ - ".mergify.yml"
298
299
  - ".rspec"
299
300
  - ".rubocop-https---relaxed-ruby-style-rubocop-yml"
300
301
  - ".rubocop.yml"
301
302
  - CHANGELOG.md
302
303
  - Gemfile
303
304
  - LICENSE.txt
305
+ - OLD_CHANGELOG.md
304
306
  - README.md
305
307
  - Rakefile
306
308
  - bin/console
@@ -331,6 +333,8 @@ files:
331
333
  - lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/frontend/%file_name%.css
332
334
  - lib/solidus_dev_support/templates/extension/bin/console.tt
333
335
  - lib/solidus_dev_support/templates/extension/bin/rails
336
+ - lib/solidus_dev_support/templates/extension/bin/rails-engine.tt
337
+ - lib/solidus_dev_support/templates/extension/bin/rails-sandbox
334
338
  - lib/solidus_dev_support/templates/extension/bin/rake
335
339
  - lib/solidus_dev_support/templates/extension/bin/sandbox.tt
336
340
  - lib/solidus_dev_support/templates/extension/bin/setup
@@ -356,7 +360,7 @@ licenses:
356
360
  metadata:
357
361
  homepage_uri: https://github.com/solidusio/solidus_dev_support
358
362
  source_code_uri: https://github.com/solidusio/solidus_dev_support
359
- post_install_message:
363
+ post_install_message:
360
364
  rdoc_options: []
361
365
  require_paths:
362
366
  - lib
@@ -372,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
376
  version: '0'
373
377
  requirements: []
374
378
  rubygems_version: 3.0.6
375
- signing_key:
379
+ signing_key:
376
380
  specification_version: 4
377
381
  summary: Development tools for Solidus extensions.
378
382
  test_files: []
@@ -1,17 +0,0 @@
1
- # Number of days of inactivity before an issue becomes stale
2
- daysUntilStale: 60
3
- # Number of days of inactivity before a stale issue is closed
4
- daysUntilClose: 7
5
- # Issues with these labels will never be considered stale
6
- exemptLabels:
7
- - pinned
8
- - security
9
- # Label to use when marking an issue as stale
10
- staleLabel: wontfix
11
- # Comment to post when marking an issue as stale. Set to `false` to disable
12
- markComment: >
13
- This issue has been automatically marked as stale because it has not had
14
- recent activity. It will be closed if no further activity occurs. Thank you
15
- for your contributions.
16
- # Comment to post when closing a stale issue. Set to `false` to disable
17
- closeComment: false