solidus_dev_support 0.3.0 → 1.0.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 +4 -4
- data/.circleci/config.yml +35 -12
- data/.gem_release.yml +5 -0
- data/.gitignore +3 -3
- data/.rubocop-https---relaxed-ruby-style-rubocop-yml +3 -24
- data/CHANGELOG.md +89 -4
- data/Gemfile +19 -0
- data/README.md +51 -8
- data/bin/rake +29 -0
- data/exe/solidus +2 -49
- data/lib/solidus_dev_support/extension.rb +90 -32
- data/lib/solidus_dev_support/rake_tasks.rb +23 -9
- data/lib/solidus_dev_support/rspec/coverage.rb +3 -1
- data/lib/solidus_dev_support/solidus_command.rb +21 -0
- data/lib/solidus_dev_support/templates/extension/Gemfile +12 -2
- data/lib/solidus_dev_support/templates/extension/LICENSE +1 -1
- data/lib/solidus_dev_support/templates/extension/README.md +1 -1
- data/lib/solidus_dev_support/templates/extension/Rakefile +3 -29
- data/lib/solidus_dev_support/templates/extension/bin/console.tt +2 -0
- data/lib/solidus_dev_support/templates/extension/bin/rails +10 -5
- data/lib/solidus_dev_support/templates/extension/bin/rake +7 -0
- data/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +72 -0
- data/lib/solidus_dev_support/templates/extension/bin/setup +0 -2
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.tt +36 -0
- data/lib/solidus_dev_support/templates/extension/gem_release.yml.tt +1 -1
- data/lib/solidus_dev_support/templates/extension/gitignore +1 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%.rb.tt +1 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/engine.rb.tt +1 -1
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/version.rb.tt +1 -1
- data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +3 -3
- data/lib/solidus_dev_support/templates/extension/rspec +2 -1
- data/lib/solidus_dev_support/templates/extension/rubocop.yml +0 -12
- data/lib/solidus_dev_support/version.rb +1 -1
- metadata +8 -3
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.erb +0 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de90c411c336bc81c47f733d981c94bd1ab190b67ac4f3d4150137939d80e334
|
|
4
|
+
data.tar.gz: 5fc688becf3ee554bd58ed6c1b93ffc1d780d99ef49965e1820a09ee735cb148
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d2309d00fc65e1883f45a8d197a9b8da364da2f9752a9cdf0dab4fe15907ed71bdde00d16c981623ebdf6e7a48accd1c6384a8abe22a6fce90ec06a3fa13e30
|
|
7
|
+
data.tar.gz: b219aa253dc28f0d899c3fd336918d5b5a55074829e3b66ad30b29b261e37621cc5c89c7fd59275b47515adfb7c2ea5f7b5ad7fe115c12939ffdadda711f6a28
|
data/.circleci/config.yml
CHANGED
|
@@ -7,21 +7,43 @@ orbs:
|
|
|
7
7
|
# or goes EOL.
|
|
8
8
|
solidusio_extensions: solidusio/extensions@volatile
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
executors:
|
|
11
|
+
# We don't rely directly on the DB, but we still want to ensure generated
|
|
12
|
+
# extensions are able to connect and spin up Solidus. Using an in-memory
|
|
13
|
+
# SQLite makes it blazingly fast.
|
|
14
|
+
sqlite-memory:
|
|
15
|
+
docker:
|
|
16
|
+
- image: circleci/ruby:2.5.6-node-browsers
|
|
17
|
+
environment:
|
|
18
|
+
RAILS_ENV: test
|
|
19
|
+
DB: sqlite
|
|
20
|
+
DATABASE_URL: sqlite3::memory:?pool=1
|
|
21
|
+
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
|
|
22
|
+
|
|
23
|
+
commands:
|
|
24
|
+
setup:
|
|
17
25
|
steps:
|
|
18
|
-
-
|
|
26
|
+
- checkout
|
|
27
|
+
- run: "gem install bundler -v '>=2' --conservative"
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
solidus-master:
|
|
31
|
+
executor: sqlite-memory
|
|
32
|
+
steps: ['setup', 'solidusio_extensions/run-tests-solidus-master']
|
|
33
|
+
solidus-current:
|
|
34
|
+
executor: sqlite-memory
|
|
35
|
+
steps: ['setup', 'solidusio_extensions/run-tests-solidus-current']
|
|
36
|
+
solidus-older:
|
|
37
|
+
executor: sqlite-memory
|
|
38
|
+
steps: ['setup', 'solidusio_extensions/run-tests-solidus-older']
|
|
19
39
|
|
|
20
40
|
workflows:
|
|
21
41
|
"Run specs on supported Solidus versions":
|
|
22
42
|
jobs:
|
|
23
|
-
-
|
|
24
|
-
-
|
|
43
|
+
- solidus-master
|
|
44
|
+
- solidus-current
|
|
45
|
+
- solidus-older
|
|
46
|
+
|
|
25
47
|
"Weekly run specs against master":
|
|
26
48
|
triggers:
|
|
27
49
|
- schedule:
|
|
@@ -31,5 +53,6 @@ workflows:
|
|
|
31
53
|
only:
|
|
32
54
|
- master
|
|
33
55
|
jobs:
|
|
34
|
-
-
|
|
35
|
-
-
|
|
56
|
+
- solidus-master
|
|
57
|
+
- solidus-current
|
|
58
|
+
- solidus-older
|
data/.gem_release.yml
ADDED
data/.gitignore
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Relaxed.Ruby.Style
|
|
2
|
-
## Version 2.
|
|
2
|
+
## Version 2.5
|
|
3
3
|
|
|
4
4
|
Style/Alias:
|
|
5
5
|
Enabled: false
|
|
@@ -145,30 +145,9 @@ Lint/AssignmentInCondition:
|
|
|
145
145
|
Enabled: false
|
|
146
146
|
StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
Layout/LineLength:
|
|
149
149
|
Enabled: false
|
|
150
150
|
|
|
151
|
-
Metrics
|
|
152
|
-
Enabled: false
|
|
153
|
-
|
|
154
|
-
Metrics/ClassLength:
|
|
155
|
-
Enabled: false
|
|
156
|
-
|
|
157
|
-
Metrics/ModuleLength:
|
|
158
|
-
Enabled: false
|
|
159
|
-
|
|
160
|
-
Metrics/CyclomaticComplexity:
|
|
161
|
-
Enabled: false
|
|
162
|
-
|
|
163
|
-
Metrics/LineLength:
|
|
164
|
-
Enabled: false
|
|
165
|
-
|
|
166
|
-
Metrics/MethodLength:
|
|
167
|
-
Enabled: false
|
|
168
|
-
|
|
169
|
-
Metrics/ParameterLists:
|
|
170
|
-
Enabled: false
|
|
171
|
-
|
|
172
|
-
Metrics/PerceivedComplexity:
|
|
151
|
+
Metrics:
|
|
173
152
|
Enabled: false
|
|
174
153
|
|
data/CHANGELOG.md
CHANGED
|
@@ -9,18 +9,98 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- Added a binstub for `rake` to the extension generator
|
|
13
|
+
- Added the ability for the generator to reuse existing data for the gemspec
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed Dependabot throwing an error because of `eval_gemfile` in the Gemfile
|
|
18
|
+
|
|
19
|
+
## [0.6.0] - 2020-01-20
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Added support for a local Gemfile for local development dependencies (e.g. 'pry-debug')
|
|
24
|
+
- Added a `bin/sandbox` script to all extension for local development with `bin/rails` support.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- The default rake task no longer re-generates the `test_app` each time it runs.
|
|
29
|
+
In order to get that behavior back simply call clobber before launching it:
|
|
30
|
+
`bin/rake clobber default`
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Fixed generated extensions isolating the wrong namespace
|
|
35
|
+
|
|
36
|
+
## [0.5.0] - 2020-01-16
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Added `--require spec_helper` to the generated `.rspec`
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- Replaced "Spree" with "Solidus" in the license of generated extensions
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Updated gem-release to use tags instead of branches for new releases
|
|
49
|
+
|
|
50
|
+
## [0.4.1] - 2020-01-15
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Fixed the generated RuboCop config inheriting from this gem's dev-only config
|
|
55
|
+
- Fixed the generated extension not requiring the `version` file
|
|
56
|
+
- Fixed the generator not properly marking `bin/` files as executable
|
|
57
|
+
|
|
58
|
+
## [0.4.0] - 2020-01-10
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
|
|
62
|
+
- Enforced Rails version depending on the Solidus version in generated Gemfile
|
|
63
|
+
- Made Git ignore `spec/examples.txt` in generated extensions
|
|
64
|
+
- Added the ability to run `solidus extension .` to update an extension
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- The `solidus` executable is now solely managed by Thor and is open to extension by other gems
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
- Fixed generated extensions using an old Rakefile
|
|
73
|
+
- Fixed some RuboCop offenses in the generated files
|
|
74
|
+
- Fixed the `bin/setup` script calling a non-existing Rake binary
|
|
75
|
+
|
|
76
|
+
### Removed
|
|
77
|
+
|
|
78
|
+
- Removed RuboCop from the default Rake task
|
|
79
|
+
- Removed the `-v` option from the `solidus` executable
|
|
80
|
+
- Removed the factory_bot gem from the Gemfile
|
|
81
|
+
|
|
82
|
+
## [0.3.0] - 2020-01-10
|
|
83
|
+
|
|
84
|
+
### Added
|
|
85
|
+
|
|
12
86
|
- Adopted Ruby 2.4+ as the minimum Ruby version in generated extensions
|
|
13
87
|
- Added `bin/console`, `bin/rails` and `bin/setup` to generated extensions
|
|
14
88
|
- Added some Bundler gemspec defaults to generated extensions
|
|
89
|
+
- Configured the default Rake task to run generate the test app before running RSpec
|
|
15
90
|
|
|
16
91
|
### Changed
|
|
17
92
|
|
|
18
93
|
- Updated solidus_support to 0.4.0 for Zeitwerk and Rails 6 compatibility
|
|
94
|
+
- Updated the `solidus` executable to only rely on Thor and be open to extension by other gems
|
|
19
95
|
|
|
20
96
|
### Removed
|
|
21
97
|
|
|
22
98
|
- Removed solidus_support as a dependency
|
|
23
99
|
|
|
100
|
+
### Fixed
|
|
101
|
+
|
|
102
|
+
- Fixed `extension:test_app` not going back to the root after execution
|
|
103
|
+
|
|
24
104
|
## [0.2.0] - 2019-12-16
|
|
25
105
|
|
|
26
106
|
### Added
|
|
@@ -50,7 +130,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
50
130
|
|
|
51
131
|
Initial release.
|
|
52
132
|
|
|
53
|
-
[Unreleased]: https://github.com/solidusio
|
|
54
|
-
[0.
|
|
55
|
-
[0.
|
|
56
|
-
[0.1
|
|
133
|
+
[Unreleased]: https://github.com/solidusio/solidus_dev_support/compare/v0.6.0...HEAD
|
|
134
|
+
[0.6.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.5.0...v0.6.0
|
|
135
|
+
[0.5.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.4.1...v0.5.0
|
|
136
|
+
[0.4.1]: https://github.com/solidusio/solidus_dev_support/compare/v0.4.0...v0.4.1
|
|
137
|
+
[0.4.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.3.0...v0.4.0
|
|
138
|
+
[0.3.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.2.0...v0.3.0
|
|
139
|
+
[0.2.0]: https://github.com/solidusio/solidus_dev_support/compare/v0.1.1...v0.2.0
|
|
140
|
+
[0.1.1]: https://github.com/solidusio/solidus_dev_support/compare/v0.1.0...v0.1.1
|
|
141
|
+
[0.1.0]: https://github.com/solidusio/solidus_dev_support/releases/tag/v0.1.0
|
data/Gemfile
CHANGED
|
@@ -6,3 +6,22 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
|
6
6
|
|
|
7
7
|
# Specify your gem's dependencies in solidus_dev_support.gemspec
|
|
8
8
|
gemspec
|
|
9
|
+
|
|
10
|
+
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
|
11
|
+
gem 'solidus', github: 'solidusio/solidus', branch: branch
|
|
12
|
+
|
|
13
|
+
# A workaround for https://github.com/bundler/bundler/issues/6677
|
|
14
|
+
gem 'rails', '>0.a'
|
|
15
|
+
|
|
16
|
+
# These gems will be used by the temporary extensions generated by tests
|
|
17
|
+
group :test do
|
|
18
|
+
gem 'solidus_auth_devise'
|
|
19
|
+
gem 'factory_bot', '> 4.10.0'
|
|
20
|
+
gem 'mysql2'
|
|
21
|
+
gem 'pg'
|
|
22
|
+
gem 'sqlite3'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Use a local Gemfile to include development dependencies that might not be
|
|
26
|
+
# relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
|
|
27
|
+
eval_gemfile 'Gemfile-local' if File.exist? 'Gemfile-local'
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# solidus_dev_support
|
|
2
2
|
|
|
3
|
-
[](https://circleci.com/gh/solidusio/solidus_dev_support)
|
|
4
4
|
|
|
5
5
|
This gem contains common development functionality for Solidus extensions.
|
|
6
6
|
|
|
@@ -34,6 +34,42 @@ $ solidus extension my_awesome_extension
|
|
|
34
34
|
This will generate the basic extension structure, already configured to use all the shiny helpers
|
|
35
35
|
in solidus_dev_support.
|
|
36
36
|
|
|
37
|
+
#### Updating existing extensions
|
|
38
|
+
|
|
39
|
+
If you have an existing extension and want to update it to use the latest standards from this gem,
|
|
40
|
+
you can run the following in the extension's directory:
|
|
41
|
+
|
|
42
|
+
```console
|
|
43
|
+
$ solidus extension .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
In case of conflicting files, you will be prompted for an action. You can overwrite the files with
|
|
47
|
+
the new version, keep the current version or view the diff and only apply the adjustments that make
|
|
48
|
+
sense to you.
|
|
49
|
+
|
|
50
|
+
### Sandbox app
|
|
51
|
+
|
|
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
|
|
54
|
+
operate on a _sandbox_ app (creating it if necessary).
|
|
55
|
+
|
|
56
|
+
The path for the sandbox app is `./sandbox` and `bin/rails` will forward any Rails command
|
|
57
|
+
to `sandbox/bin/rails`.
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
$ bin/rails server
|
|
63
|
+
=> Booting Puma
|
|
64
|
+
=> Rails 6.0.2.1 application starting in development
|
|
65
|
+
* Listening on tcp://127.0.0.1:3000
|
|
66
|
+
Use Ctrl-C to stop
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### Rebuilding the sandbox app
|
|
70
|
+
|
|
71
|
+
To rebuild the sandbox app just remove the `./sandbox` folder or run `bin/sandbox`.
|
|
72
|
+
|
|
37
73
|
### RSpec helpers
|
|
38
74
|
|
|
39
75
|
This gem provides some useful helpers for RSpec to setup an extension's test environment easily.
|
|
@@ -123,15 +159,16 @@ releases for your gem.
|
|
|
123
159
|
For instance, you can run the following to release a new minor version:
|
|
124
160
|
|
|
125
161
|
```console
|
|
126
|
-
$ gem bump
|
|
162
|
+
$ gem bump -v minor -r
|
|
127
163
|
```
|
|
128
164
|
|
|
129
165
|
The above command will:
|
|
130
166
|
|
|
131
|
-
* bump the gem version to the next minor
|
|
132
|
-
|
|
167
|
+
* bump the gem version to the next minor (you can also use `patch`, `major` or a specific version
|
|
168
|
+
number);
|
|
169
|
+
* commit the change and push it to `origin/master`;
|
|
133
170
|
* create a Git tag;
|
|
134
|
-
* push the tag to the `
|
|
171
|
+
* push the tag to the `origin` remote;
|
|
135
172
|
* release the new version on RubyGems.
|
|
136
173
|
|
|
137
174
|
You can refer to
|
|
@@ -154,8 +191,14 @@ contents with the block above.)
|
|
|
154
191
|
|
|
155
192
|
This will provide the following tasks:
|
|
156
193
|
|
|
157
|
-
- `extension:specs` (default), which runs the specs for your extension
|
|
158
194
|
- `extension:test_app`, which generates a dummy app for your extension
|
|
195
|
+
- `extension:specs` (default), which runs the specs for your extension
|
|
196
|
+
|
|
197
|
+
If your extension requires the `test_app` to be always recreated you can do so by running:
|
|
198
|
+
|
|
199
|
+
```rb
|
|
200
|
+
bin/rake extension:test_app extension:specs
|
|
201
|
+
```
|
|
159
202
|
|
|
160
203
|
## Development
|
|
161
204
|
|
|
@@ -163,8 +206,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
163
206
|
the tests. You can also run `bin/console` for an interactive prompt that will allow you to
|
|
164
207
|
experiment.
|
|
165
208
|
|
|
166
|
-
To install this gem onto your local machine, run `
|
|
167
|
-
version, update the version number in `version.rb`, and then run `
|
|
209
|
+
To install this gem onto your local machine, run `bin/rake install`. To release a new
|
|
210
|
+
version, update the version number in `version.rb`, and then run `bin/rake release`, which
|
|
168
211
|
will create a git tag for the version, push git commits and tags, and push the `.gem` file to
|
|
169
212
|
[rubygems.org](https://rubygems.org).
|
|
170
213
|
|
data/bin/rake
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/exe/solidus
CHANGED
|
@@ -1,53 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
require '
|
|
4
|
+
require 'solidus_dev_support/solidus_command'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Options = Struct.new(:name)
|
|
9
|
-
|
|
10
|
-
class Parser
|
|
11
|
-
class << self
|
|
12
|
-
def parse(args)
|
|
13
|
-
options.parse!(args)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def options
|
|
17
|
-
OptionParser.new do |opts|
|
|
18
|
-
opts.banner = 'Usage: solidus [[extension extension_name] | [-h] [-v]]'
|
|
19
|
-
|
|
20
|
-
opts.on('-h', '--help', 'Prints this help') do
|
|
21
|
-
puts opts
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
opts.on(
|
|
25
|
-
'-v',
|
|
26
|
-
'--version',
|
|
27
|
-
"Prints the current version: #{SolidusDevSupport::VERSION}"
|
|
28
|
-
) do
|
|
29
|
-
puts SolidusDevSupport::VERSION
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Print help if no options are supplied
|
|
37
|
-
ARGV << '--help' unless ARGV.first
|
|
38
|
-
|
|
39
|
-
if ARGV.first == 'extension' || ARGV.first == 'e'
|
|
40
|
-
ARGV.shift
|
|
41
|
-
|
|
42
|
-
unless ARGV.first
|
|
43
|
-
puts 'An extension must have a name!'
|
|
44
|
-
puts `solidus -h`
|
|
45
|
-
exit 1
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
require 'solidus_dev_support'
|
|
49
|
-
require 'solidus_dev_support/extension'
|
|
50
|
-
SolidusDevSupport::Extension.start
|
|
51
|
-
else
|
|
52
|
-
Parser.parse(ARGV)
|
|
53
|
-
end
|
|
6
|
+
SolidusDevSupport::SolidusCommand.start
|
|
@@ -1,54 +1,106 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'thor'
|
|
4
|
-
require 'thor/group'
|
|
5
4
|
require 'pathname'
|
|
6
5
|
|
|
7
6
|
module SolidusDevSupport
|
|
8
|
-
class Extension < Thor
|
|
7
|
+
class Extension < Thor
|
|
9
8
|
include Thor::Actions
|
|
9
|
+
PREFIX = 'solidus_'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
argument :file_name, type: :string, desc: 'rails app_path', default: '.'
|
|
11
|
+
default_command :generate
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
desc 'generate PATH', 'Generates a new Solidus extension'
|
|
14
|
+
def generate(raw_path = '.')
|
|
15
|
+
self.path = raw_path
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
use_prefix 'solidus_'
|
|
17
|
+
empty_directory path
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
directory 'app', "#{path}/app"
|
|
20
|
+
directory 'lib', "#{path}/lib"
|
|
21
|
+
directory 'bin', "#{path}/bin"
|
|
22
|
+
directory '.circleci', "#{path}/.circleci"
|
|
23
|
+
directory '.github', "#{path}/.github"
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
directory 'bin', "#{file_name}/bin"
|
|
24
|
-
directory '.circleci', "#{file_name}/.circleci"
|
|
25
|
-
directory '.github', "#{file_name}/.github"
|
|
26
|
-
|
|
27
|
-
Dir["#{file_name}/bin/*"].each do |executable|
|
|
28
|
-
make_executable executable
|
|
25
|
+
Dir["#{path}/bin/*"].each do |bin|
|
|
26
|
+
make_executable bin
|
|
29
27
|
end
|
|
30
28
|
|
|
31
|
-
template 'extension.gemspec
|
|
32
|
-
template 'Gemfile', "#{
|
|
33
|
-
template 'gitignore', "#{
|
|
34
|
-
template 'gem_release.yml.tt', "#{
|
|
35
|
-
template 'LICENSE', "#{
|
|
36
|
-
template 'Rakefile', "#{
|
|
37
|
-
template 'README.md', "#{
|
|
38
|
-
template 'config/routes.rb', "#{
|
|
39
|
-
template 'config/locales/en.yml', "#{
|
|
40
|
-
template 'rspec', "#{
|
|
41
|
-
template 'spec/spec_helper.rb.tt', "#{
|
|
42
|
-
template 'rubocop.yml', "#{
|
|
29
|
+
template 'extension.gemspec', "#{path}/#{file_name}.gemspec"
|
|
30
|
+
template 'Gemfile', "#{path}/Gemfile"
|
|
31
|
+
template 'gitignore', "#{path}/.gitignore"
|
|
32
|
+
template 'gem_release.yml.tt', "#{path}/.gem_release.yml"
|
|
33
|
+
template 'LICENSE', "#{path}/LICENSE"
|
|
34
|
+
template 'Rakefile', "#{path}/Rakefile"
|
|
35
|
+
template 'README.md', "#{path}/README.md"
|
|
36
|
+
template 'config/routes.rb', "#{path}/config/routes.rb"
|
|
37
|
+
template 'config/locales/en.yml', "#{path}/config/locales/en.yml"
|
|
38
|
+
template 'rspec', "#{path}/.rspec"
|
|
39
|
+
template 'spec/spec_helper.rb.tt', "#{path}/spec/spec_helper.rb"
|
|
40
|
+
template 'rubocop.yml', "#{path}/.rubocop.yml"
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
no_tasks do
|
|
46
|
-
def
|
|
47
|
-
|
|
44
|
+
def path=(path)
|
|
45
|
+
path = File.expand_path(path)
|
|
46
|
+
|
|
47
|
+
@file_name = Thor::Util.snake_case(File.basename(path))
|
|
48
|
+
@file_name = PREFIX + @file_name unless @file_name.start_with?(PREFIX)
|
|
49
|
+
|
|
50
|
+
@class_name = Thor::Util.camel_case @file_name
|
|
51
|
+
|
|
52
|
+
@root = File.dirname(path)
|
|
53
|
+
@path = File.join(@root, @file_name)
|
|
54
|
+
|
|
55
|
+
@gemspec = existing_gemspec || default_gemspec
|
|
48
56
|
end
|
|
49
57
|
|
|
50
|
-
def
|
|
51
|
-
@
|
|
58
|
+
def gemspec_path
|
|
59
|
+
@gemspec_path ||= File.join(path, "#{file_name}.gemspec")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def default_gemspec
|
|
63
|
+
@default_gemspec ||= Gem::Specification.new(@file_name, '0.0.1') do |gem|
|
|
64
|
+
gem.author = git('config user.name', 'TODO: Write your name')
|
|
65
|
+
gem.description = 'TODO: Write a longer description or delete this line.'
|
|
66
|
+
gem.email = git('config user.email', 'TODO: Write your email address')
|
|
67
|
+
gem.homepage = default_homepage
|
|
68
|
+
gem.license = 'BSD-3-Clause'
|
|
69
|
+
gem.metadata['changelog_uri'] = default_homepage + '/releases'
|
|
70
|
+
gem.summary = 'TODO: Write a short summary, because RubyGems requires one.'
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def existing_gemspec
|
|
75
|
+
return unless File.exist?(gemspec_path)
|
|
76
|
+
|
|
77
|
+
@existing_gemspec ||= Gem::Specification.load(gemspec_path).tap do |spec|
|
|
78
|
+
spec.author ||= default_gemspec.author
|
|
79
|
+
spec.email ||= default_gemspec.email
|
|
80
|
+
spec.homepage ||= default_gemspec.homepage
|
|
81
|
+
spec.license ||= default_gemspec.license
|
|
82
|
+
spec.metadata['changelog_uri'] ||= default_gemspec.metadata[:changelog_uri]
|
|
83
|
+
spec.summary ||= default_gemspec.summary
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def default_homepage
|
|
88
|
+
@default_homepage ||= git(
|
|
89
|
+
'remote get-url origin',
|
|
90
|
+
"git@github.com:#{github_user}/#{file_name}.git"
|
|
91
|
+
).sub(
|
|
92
|
+
%r{^.*github\.com.([^/]+)/([^/\.]+).*$},
|
|
93
|
+
'https://github.com/\1/\2'
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def github_user
|
|
98
|
+
@github_user ||= git('config github.user', '[USERNAME]')
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def git(command, default)
|
|
102
|
+
result = `git #{command} 2> /dev/null`.strip
|
|
103
|
+
result.empty? ? default : result
|
|
52
104
|
end
|
|
53
105
|
|
|
54
106
|
def make_executable(path)
|
|
@@ -56,6 +108,12 @@ module SolidusDevSupport
|
|
|
56
108
|
executable = (path.stat.mode | 0o111)
|
|
57
109
|
path.chmod(executable)
|
|
58
110
|
end
|
|
111
|
+
|
|
112
|
+
attr_reader :root, :path, :file_name, :class_name, :gemspec
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def self.source_root
|
|
116
|
+
"#{__dir__}/templates/extension"
|
|
59
117
|
end
|
|
60
118
|
end
|
|
61
119
|
end
|
|
@@ -21,38 +21,52 @@ module SolidusDevSupport
|
|
|
21
21
|
|
|
22
22
|
def install
|
|
23
23
|
install_test_app_task
|
|
24
|
+
install_dev_app_task
|
|
24
25
|
install_rspec_task
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def install_test_app_task
|
|
28
29
|
require 'rake/clean'
|
|
29
|
-
|
|
30
|
+
require 'spree/testing_support/extension_rake'
|
|
30
31
|
|
|
31
32
|
ENV['DUMMY_PATH'] = test_app_path.to_s
|
|
32
33
|
ENV['LIB_NAME'] = gemspec.name
|
|
33
|
-
require 'spree/testing_support/extension_rake'
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
directory ENV['DUMMY_PATH'] do
|
|
37
|
-
Rake::Task['extension:test_app']
|
|
35
|
+
::CLOBBER.include test_app_path
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
namespace :extension do
|
|
38
|
+
# We need to go back to the gem root since the upstream
|
|
39
|
+
# extension:test_app changes the working directory to be the dummy app.
|
|
40
|
+
task :test_app do
|
|
41
|
+
Rake::Task['extension:test_app'].invoke
|
|
41
42
|
cd root
|
|
42
43
|
end
|
|
44
|
+
|
|
45
|
+
directory ENV['DUMMY_PATH'] do
|
|
46
|
+
Rake::Task['extension:test_app'].invoke
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def install_dev_app_task
|
|
52
|
+
desc "Creates a sandbox application for simulating the Extension code in a deployed Rails app"
|
|
53
|
+
task :sandbox do
|
|
54
|
+
warn "DEPRECATED TASK: This task is here just for parity with solidus, please use bin/sandbox directly."
|
|
55
|
+
exec("bin/sandbox", gemspec.name)
|
|
43
56
|
end
|
|
44
57
|
end
|
|
45
58
|
|
|
46
59
|
def install_rspec_task
|
|
60
|
+
require 'rspec/core/rake_task'
|
|
61
|
+
|
|
47
62
|
namespace :extension do
|
|
48
|
-
require 'rspec/core/rake_task'
|
|
49
63
|
::RSpec::Core::RakeTask.new(:specs, [] => FileList[ENV['DUMMY_PATH']]) do |t|
|
|
50
64
|
# Ref: https://circleci.com/docs/2.0/configuration-reference#store_test_results
|
|
51
65
|
# Ref: https://github.com/solidusio/circleci-orbs-extensions#test-results-rspec
|
|
52
66
|
if ENV['TEST_RESULTS_PATH']
|
|
53
67
|
t.rspec_opts =
|
|
54
68
|
"--format progress " \
|
|
55
|
-
"--format RspecJunitFormatter
|
|
69
|
+
"--format RspecJunitFormatter --out #{ENV['TEST_RESULTS_PATH']}"
|
|
56
70
|
end
|
|
57
71
|
end
|
|
58
72
|
end
|
|
@@ -16,7 +16,9 @@ SimpleCov.start('rails') do
|
|
|
16
16
|
add_filter %r{^/lib/.*/version.rb}
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
if ENV['
|
|
19
|
+
if ENV['CODECOV_TOKEN']
|
|
20
20
|
require 'codecov'
|
|
21
21
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
|
22
|
+
else
|
|
23
|
+
warn "Provide a CODECOV_TOKEN environment variable to enable Codecov uploads"
|
|
22
24
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'thor'
|
|
4
|
+
require 'solidus_dev_support/extension'
|
|
5
|
+
|
|
6
|
+
module SolidusDevSupport
|
|
7
|
+
class SolidusCommand < Thor
|
|
8
|
+
namespace ''
|
|
9
|
+
|
|
10
|
+
desc 'extension', 'Manage solidus extensions'
|
|
11
|
+
subcommand 'extension', Extension
|
|
12
|
+
|
|
13
|
+
desc 'e', 'Manage solidus extensions (shortcut for "extension")'
|
|
14
|
+
subcommand 'e', Extension
|
|
15
|
+
|
|
16
|
+
def self.exit_on_failure?
|
|
17
|
+
true
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
@@ -6,11 +6,14 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
|
6
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
|
7
7
|
gem 'solidus', github: 'solidusio/solidus', branch: branch
|
|
8
8
|
|
|
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', '>0.a'
|
|
13
|
+
|
|
9
14
|
# Provides basic authentication functionality for testing parts of your engine
|
|
10
15
|
gem 'solidus_auth_devise'
|
|
11
16
|
|
|
12
|
-
gem 'factory_bot', '> 4.10.0'
|
|
13
|
-
|
|
14
17
|
case ENV['DB']
|
|
15
18
|
when 'mysql'
|
|
16
19
|
gem 'mysql2'
|
|
@@ -21,3 +24,10 @@ else
|
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
gemspec
|
|
27
|
+
|
|
28
|
+
# Use a local Gemfile to include development dependencies that might not be
|
|
29
|
+
# relevant for the project or for other contributors, e.g. pry-byebug.
|
|
30
|
+
#
|
|
31
|
+
# We use `send` instead of calling `eval_gemfile` to work around an issue with
|
|
32
|
+
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
|
|
33
|
+
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
|
|
@@ -9,7 +9,7 @@ are permitted provided that the following conditions are met:
|
|
|
9
9
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
10
10
|
this list of conditions and the following disclaimer in the documentation
|
|
11
11
|
and/or other materials provided with the distribution.
|
|
12
|
-
* Neither the name
|
|
12
|
+
* Neither the name Solidus nor the names of its contributors may be used to
|
|
13
13
|
endorse or promote products derived from this software without specific
|
|
14
14
|
prior written permission.
|
|
15
15
|
|
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'solidus_dev_support/rake_tasks'
|
|
4
|
+
SolidusDevSupport::RakeTasks.install
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
begin
|
|
8
|
-
require 'spree/testing_support/extension_rake'
|
|
9
|
-
require 'rubocop/rake_task'
|
|
10
|
-
require 'rspec/core/rake_task'
|
|
11
|
-
|
|
12
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
13
|
-
|
|
14
|
-
RuboCop::RakeTask.new
|
|
15
|
-
|
|
16
|
-
task default: %i(first_run rubocop spec)
|
|
17
|
-
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
|
18
|
-
# no rspec available
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
task :first_run do
|
|
22
|
-
if Dir['spec/dummy'].empty?
|
|
23
|
-
Rake::Task[:test_app].invoke
|
|
24
|
-
Dir.chdir('../../')
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
desc 'Generates a dummy app for testing'
|
|
29
|
-
task :test_app do
|
|
30
|
-
ENV['LIB_NAME'] = '<%=file_name%>'
|
|
31
|
-
Rake::Task['extension:test_app'].invoke
|
|
32
|
-
end
|
|
6
|
+
task default: 'extension:specs'
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
app_root = 'sandbox'
|
|
4
6
|
|
|
5
7
|
unless File.exist? "#{app_root}/bin/rails"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
9
14
|
end
|
|
10
15
|
end
|
|
11
16
|
|
|
12
|
-
Dir.chdir
|
|
17
|
+
Dir.chdir app_root
|
|
13
18
|
exec 'bin/rails', *ARGV
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
extension_name="<%= file_name %>"
|
|
22
|
+
|
|
23
|
+
# Stay away from the bundler env of the containing extension.
|
|
24
|
+
function unbundled {
|
|
25
|
+
ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
rm -rf ./sandbox
|
|
29
|
+
unbundled bundle exec rails new sandbox --database="$RAILSDB" \
|
|
30
|
+
--skip-bundle \
|
|
31
|
+
--skip-git \
|
|
32
|
+
--skip-keeps \
|
|
33
|
+
--skip-rc \
|
|
34
|
+
--skip-spring \
|
|
35
|
+
--skip-test \
|
|
36
|
+
--skip-javascript
|
|
37
|
+
|
|
38
|
+
if [ ! -d "sandbox" ]; then
|
|
39
|
+
echo 'sandbox rails application failed'
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
cd ./sandbox
|
|
44
|
+
cat <<RUBY >> Gemfile
|
|
45
|
+
|
|
46
|
+
gem '$extension_name', path: '..'
|
|
47
|
+
gem 'solidus_auth_devise', '>= 2.1.0'
|
|
48
|
+
gem 'rails-i18n'
|
|
49
|
+
gem 'solidus_i18n'
|
|
50
|
+
|
|
51
|
+
group :test, :development do
|
|
52
|
+
platforms :mri do
|
|
53
|
+
gem 'pry-byebug'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
RUBY
|
|
57
|
+
|
|
58
|
+
unbundled bundle install --gemfile Gemfile
|
|
59
|
+
|
|
60
|
+
unbundled bundle exec rake db:drop db:create
|
|
61
|
+
|
|
62
|
+
unbundled bundle exec rails generate spree:install \
|
|
63
|
+
--auto-accept \
|
|
64
|
+
--user_class=Spree::User \
|
|
65
|
+
--enforce_available_locales=true \
|
|
66
|
+
$@
|
|
67
|
+
|
|
68
|
+
unbundled bundle exec rails generate solidus:auth:install
|
|
69
|
+
|
|
70
|
+
echo
|
|
71
|
+
echo "🚀 Sandbox app successfully created for $extension_name!"
|
|
72
|
+
echo "🚀 This app is intended for test purposes."
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/<%= file_name %>/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = '<%= file_name %>'
|
|
7
|
+
spec.version = <%= class_name %>::VERSION
|
|
8
|
+
spec.authors = <%= gemspec.authors.inspect.gsub('"', "'") %>
|
|
9
|
+
spec.email = '<%= gemspec.email %>'
|
|
10
|
+
|
|
11
|
+
spec.summary = '<%= gemspec.summary %>'
|
|
12
|
+
spec.description = '<%= gemspec.description %>'
|
|
13
|
+
spec.homepage = '<%= gemspec.homepage %>'
|
|
14
|
+
spec.license = '<%= gemspec.license %>'
|
|
15
|
+
|
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
17
|
+
spec.metadata['source_code_uri'] = '<%= gemspec.homepage %>'
|
|
18
|
+
spec.metadata['changelog_uri'] = '<%= gemspec.metadata["changelog_uri"] %>'
|
|
19
|
+
|
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new('~> 2.4')
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
|
25
|
+
|
|
26
|
+
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
|
27
|
+
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
|
28
|
+
spec.bindir = "exe"
|
|
29
|
+
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
|
|
33
|
+
spec.add_dependency 'solidus_support', '~> 0.4.0'
|
|
34
|
+
|
|
35
|
+
spec.add_development_dependency 'solidus_dev_support'
|
|
36
|
+
end
|
|
@@ -16,15 +16,15 @@ module <%= class_name %>
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def add_migrations
|
|
19
|
-
run '
|
|
19
|
+
run 'bin/rails railties:install:migrations FROM=<%= file_name %>'
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def run_migrations
|
|
23
23
|
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
|
|
24
24
|
if run_migrations
|
|
25
|
-
run '
|
|
25
|
+
run 'bin/rails db:migrate'
|
|
26
26
|
else
|
|
27
|
-
puts 'Skipping
|
|
27
|
+
puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
--color
|
|
1
|
+
--color
|
|
2
|
+
--require spec_helper
|
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: 0.
|
|
4
|
+
version: 1.0.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-
|
|
11
|
+
date: 2020-02-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: apparition
|
|
@@ -291,6 +291,7 @@ extensions: []
|
|
|
291
291
|
extra_rdoc_files: []
|
|
292
292
|
files:
|
|
293
293
|
- ".circleci/config.yml"
|
|
294
|
+
- ".gem_release.yml"
|
|
294
295
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
295
296
|
- ".github/stale.yml"
|
|
296
297
|
- ".gitignore"
|
|
@@ -303,6 +304,7 @@ files:
|
|
|
303
304
|
- README.md
|
|
304
305
|
- Rakefile
|
|
305
306
|
- bin/console
|
|
307
|
+
- bin/rake
|
|
306
308
|
- bin/setup
|
|
307
309
|
- bin/solidus
|
|
308
310
|
- exe/solidus
|
|
@@ -315,6 +317,7 @@ files:
|
|
|
315
317
|
- lib/solidus_dev_support/rspec/spec_helper.rb
|
|
316
318
|
- lib/solidus_dev_support/rubocop.rb
|
|
317
319
|
- lib/solidus_dev_support/rubocop/config.yml
|
|
320
|
+
- lib/solidus_dev_support/solidus_command.rb
|
|
318
321
|
- lib/solidus_dev_support/templates/extension/.circleci/config.yml
|
|
319
322
|
- lib/solidus_dev_support/templates/extension/.github/stale.yml
|
|
320
323
|
- lib/solidus_dev_support/templates/extension/CONTRIBUTING.md
|
|
@@ -328,10 +331,12 @@ files:
|
|
|
328
331
|
- lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/frontend/%file_name%.css
|
|
329
332
|
- lib/solidus_dev_support/templates/extension/bin/console.tt
|
|
330
333
|
- lib/solidus_dev_support/templates/extension/bin/rails
|
|
334
|
+
- lib/solidus_dev_support/templates/extension/bin/rake
|
|
335
|
+
- lib/solidus_dev_support/templates/extension/bin/sandbox.tt
|
|
331
336
|
- lib/solidus_dev_support/templates/extension/bin/setup
|
|
332
337
|
- lib/solidus_dev_support/templates/extension/config/locales/en.yml
|
|
333
338
|
- lib/solidus_dev_support/templates/extension/config/routes.rb
|
|
334
|
-
- lib/solidus_dev_support/templates/extension/extension.gemspec.
|
|
339
|
+
- lib/solidus_dev_support/templates/extension/extension.gemspec.tt
|
|
335
340
|
- lib/solidus_dev_support/templates/extension/gem_release.yml.tt
|
|
336
341
|
- lib/solidus_dev_support/templates/extension/gitignore
|
|
337
342
|
- lib/solidus_dev_support/templates/extension/lib/%file_name%.rb.tt
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
$:.push File.expand_path('lib', __dir__)
|
|
4
|
-
require '<%= file_name %>/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = '<%= file_name %>'
|
|
8
|
-
s.version = <%= class_name %>::VERSION
|
|
9
|
-
s.summary = 'TODO'
|
|
10
|
-
s.description = 'TODO'
|
|
11
|
-
s.license = 'BSD-3-Clause'
|
|
12
|
-
|
|
13
|
-
# s.author = 'You'
|
|
14
|
-
# s.email = 'you@example.com'
|
|
15
|
-
# s.homepage = 'http://www.example.com'
|
|
16
|
-
|
|
17
|
-
if s.respond_to?(:metadata)
|
|
18
|
-
s.metadata["homepage_uri"] = s.homepage if s.homepage
|
|
19
|
-
s.metadata["source_code_uri"] = s.homepage if s.homepage
|
|
20
|
-
s.metadata["changelog_uri"] = 'TODO'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
s.required_ruby_version = '~> 2.4'
|
|
24
|
-
|
|
25
|
-
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
26
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
27
|
-
end
|
|
28
|
-
s.test_files = Dir['spec/**/*']
|
|
29
|
-
s.bindir = "exe"
|
|
30
|
-
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
-
s.require_paths = ["lib"]
|
|
32
|
-
|
|
33
|
-
s.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
|
|
34
|
-
s.add_dependency 'solidus_support', '~> 0.4.0'
|
|
35
|
-
|
|
36
|
-
s.add_development_dependency 'solidus_dev_support'
|
|
37
|
-
end
|