solidus_dev_support 0.2.0 → 0.3.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/.gitignore +2 -0
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +18 -1
- data/README.md +27 -3
- data/bin/setup +18 -6
- data/bin/solidus +4 -0
- data/exe/solidus +3 -2
- data/lib/solidus_dev_support.rb +1 -2
- data/lib/solidus_dev_support/extension.rb +11 -0
- data/lib/solidus_dev_support/rubocop/config.yml +1 -0
- data/lib/solidus_dev_support/templates/extension/Gemfile +0 -2
- data/lib/solidus_dev_support/templates/extension/Rakefile +2 -2
- data/lib/solidus_dev_support/templates/extension/bin/console.tt +15 -0
- data/lib/solidus_dev_support/templates/extension/bin/rails +13 -0
- data/lib/solidus_dev_support/templates/extension/bin/setup +10 -0
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.erb +23 -9
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%.rb.tt +2 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/engine.rb.tt +5 -9
- data/lib/solidus_dev_support/templates/extension/rubocop.yml +0 -1
- data/lib/solidus_dev_support/version.rb +1 -1
- data/solidus_dev_support.gemspec +0 -1
- metadata +6 -17
- data/lib/solidus_dev_support/templates/extension/bin/rails.tt +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3823487a717fb97e853499a6e68ad405e443ae3f0b16bdfc4c11ab97dd31670
|
4
|
+
data.tar.gz: fa21213f5c4726ecaed62f37cff358774c1b09d1f9ad850e16f94e6d2b937722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80b12e5e9a84e3b0ff6476c3f887277b3acc53ce9c79910679b22d791639ce7d74a1f6ca8a7c2d6550ee64ac1866420c08c1c892ac965a2a89fee053d62c504
|
7
|
+
data.tar.gz: 493cfb3d42a71d111c90ccdad26095010d660f78f5748e25f86518918689b2e0524425caa710e3d9e144b881e022650ae4a3ff13781e6923d994bf499ab9f895
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,22 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
9
9
|
|
10
10
|
### Added
|
11
11
|
|
12
|
+
- Adopted Ruby 2.4+ as the minimum Ruby version in generated extensions
|
13
|
+
- Added `bin/console`, `bin/rails` and `bin/setup` to generated extensions
|
14
|
+
- Added some Bundler gemspec defaults to generated extensions
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- Updated solidus_support to 0.4.0 for Zeitwerk and Rails 6 compatibility
|
19
|
+
|
20
|
+
### Removed
|
21
|
+
|
22
|
+
- Removed solidus_support as a dependency
|
23
|
+
|
24
|
+
## [0.2.0] - 2019-12-16
|
25
|
+
|
26
|
+
### Added
|
27
|
+
|
12
28
|
- Adopted [Apparition](https://github.com/twalpole/apparition) as the deafult JS driver for Capybara
|
13
29
|
- Fixed window size to 1920x1080px in feature specs
|
14
30
|
- Added [Stale](https://github.com/apps/stale) to automatically mark GitHub issues as stale
|
@@ -34,6 +50,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
34
50
|
|
35
51
|
Initial release.
|
36
52
|
|
37
|
-
[Unreleased]: https://github.com/solidusio-contrib/solidus_dev_support/compare/v0.
|
53
|
+
[Unreleased]: https://github.com/solidusio-contrib/solidus_dev_support/compare/v0.2.0...HEAD
|
54
|
+
[0.2.0]: https://github.com/solidusio-contrib/solidus_dev_support/compare/v0.1.1...v0.2.0
|
38
55
|
[0.1.1]: https://github.com/solidusio-contrib/solidus_dev_support/compare/v0.1.0...v0.1.1
|
39
56
|
[0.1.0]: https://github.com/solidusio-contrib/solidus_dev_support/releases/tag/v0.1.0
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# solidus_dev_support
|
2
2
|
|
3
|
-
|
3
|
+
[](https://circleci.com/gh/solidusio-contrib/solidus_dev_support)
|
4
|
+
|
5
|
+
This gem contains common development functionality for Solidus extensions.
|
6
|
+
|
7
|
+
If you're looking for runtime tools instead, look at
|
8
|
+
[solidus_support](https://github.com/solidusio/solidus_support).
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -18,6 +23,17 @@ $ bundle
|
|
18
23
|
|
19
24
|
## Usage
|
20
25
|
|
26
|
+
### Extension generator
|
27
|
+
|
28
|
+
This gem provides a generator for Solidus extensions. To use it, simply run:
|
29
|
+
|
30
|
+
```console
|
31
|
+
$ solidus extension my_awesome_extension
|
32
|
+
```
|
33
|
+
|
34
|
+
This will generate the basic extension structure, already configured to use all the shiny helpers
|
35
|
+
in solidus_dev_support.
|
36
|
+
|
21
37
|
### RSpec helpers
|
22
38
|
|
23
39
|
This gem provides some useful helpers for RSpec to setup an extension's test environment easily.
|
@@ -107,7 +123,7 @@ releases for your gem.
|
|
107
123
|
For instance, you can run the following to release a new minor version:
|
108
124
|
|
109
125
|
```console
|
110
|
-
gem bump --version minor --tag --release
|
126
|
+
$ gem bump --version minor --tag --release
|
111
127
|
```
|
112
128
|
|
113
129
|
The above command will:
|
@@ -124,7 +140,7 @@ further configuration and usage instructions.
|
|
124
140
|
|
125
141
|
### Rake tasks
|
126
142
|
|
127
|
-
|
143
|
+
To install extension-related Rake tasks, add this to your `Rakefile`:
|
128
144
|
|
129
145
|
```rb
|
130
146
|
require 'solidus_dev_support/rake_tasks'
|
@@ -133,6 +149,14 @@ SolidusDevSupport::RakeTasks.install
|
|
133
149
|
task default: 'extension:specs'
|
134
150
|
```
|
135
151
|
|
152
|
+
(If your extension used the legacy extension Rakefile, then you should completely replace its
|
153
|
+
contents with the block above.)
|
154
|
+
|
155
|
+
This will provide the following tasks:
|
156
|
+
|
157
|
+
- `extension:specs` (default), which runs the specs for your extension
|
158
|
+
- `extension:test_app`, which generates a dummy app for your extension
|
159
|
+
|
136
160
|
## Development
|
137
161
|
|
138
162
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run
|
data/bin/setup
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
|
4
|
-
set -vx
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils # rubocop:disable Style/MixinUsage
|
5
4
|
|
6
|
-
|
5
|
+
GEM_ROOT = File.expand_path('..', __dir__)
|
7
6
|
|
8
|
-
|
7
|
+
def system(*args)
|
8
|
+
puts "$ #{args.size == 1 ? args.first : args.shelljoin}"
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def system!(*args)
|
13
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
14
|
+
end
|
15
|
+
|
16
|
+
cd GEM_ROOT
|
17
|
+
|
18
|
+
puts "\n== Installing Ruby dependencies =="
|
19
|
+
system! %{gem install bundler --conservative}
|
20
|
+
system! %{bundle check || bundle install}
|
data/bin/solidus
ADDED
data/exe/solidus
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'optparse'
|
5
5
|
|
6
|
-
require 'solidus_dev_support'
|
7
|
-
require 'solidus_dev_support/extension'
|
6
|
+
require 'solidus_dev_support/version'
|
8
7
|
|
9
8
|
Options = Struct.new(:name)
|
10
9
|
|
@@ -46,6 +45,8 @@ if ARGV.first == 'extension' || ARGV.first == 'e'
|
|
46
45
|
exit 1
|
47
46
|
end
|
48
47
|
|
48
|
+
require 'solidus_dev_support'
|
49
|
+
require 'solidus_dev_support/extension'
|
49
50
|
SolidusDevSupport::Extension.start
|
50
51
|
else
|
51
52
|
Parser.parse(ARGV)
|
data/lib/solidus_dev_support.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "solidus_support"
|
4
3
|
require "solidus_dev_support/version"
|
5
4
|
|
6
5
|
module SolidusDevSupport
|
@@ -9,7 +8,7 @@ module SolidusDevSupport
|
|
9
8
|
class << self
|
10
9
|
def reset_spree_preferences_deprecated?
|
11
10
|
first_version_without_reset = Gem::Requirement.new('>= 2.9')
|
12
|
-
first_version_without_reset.satisfied_by?(
|
11
|
+
first_version_without_reset.satisfied_by?(Spree.solidus_gem_version)
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'thor'
|
4
4
|
require 'thor/group'
|
5
|
+
require 'pathname'
|
5
6
|
|
6
7
|
module SolidusDevSupport
|
7
8
|
class Extension < Thor::Group
|
@@ -23,6 +24,10 @@ module SolidusDevSupport
|
|
23
24
|
directory '.circleci', "#{file_name}/.circleci"
|
24
25
|
directory '.github', "#{file_name}/.github"
|
25
26
|
|
27
|
+
Dir["#{file_name}/bin/*"].each do |executable|
|
28
|
+
make_executable executable
|
29
|
+
end
|
30
|
+
|
26
31
|
template 'extension.gemspec.erb', "#{file_name}/#{file_name}.gemspec"
|
27
32
|
template 'Gemfile', "#{file_name}/Gemfile"
|
28
33
|
template 'gitignore', "#{file_name}/.gitignore"
|
@@ -45,6 +50,12 @@ module SolidusDevSupport
|
|
45
50
|
def use_prefix(prefix)
|
46
51
|
@file_name = prefix + Thor::Util.snake_case(file_name) unless file_name =~ /^#{prefix}/
|
47
52
|
end
|
53
|
+
|
54
|
+
def make_executable(path)
|
55
|
+
path = Pathname(path)
|
56
|
+
executable = (path.stat.mode | 0o111)
|
57
|
+
path.chmod(executable)
|
58
|
+
end
|
48
59
|
end
|
49
60
|
end
|
50
61
|
end
|
@@ -18,7 +18,7 @@ rescue LoadError # rubocop:disable Lint/HandleExceptions
|
|
18
18
|
# no rspec available
|
19
19
|
end
|
20
20
|
|
21
|
-
task :first_run do
|
21
|
+
task :first_run do
|
22
22
|
if Dir['spec/dummy'].empty?
|
23
23
|
Rake::Task[:test_app].invoke
|
24
24
|
Dir.chdir('../../')
|
@@ -26,7 +26,7 @@ task :first_run do # rubocop:disable Rails/RakeEnvironment
|
|
26
26
|
end
|
27
27
|
|
28
28
|
desc 'Generates a dummy app for testing'
|
29
|
-
task :test_app do
|
29
|
+
task :test_app do
|
30
30
|
ENV['LIB_NAME'] = '<%=file_name%>'
|
31
31
|
Rake::Task['extension:test_app'].invoke
|
32
32
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "<%= file_name %>"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
$LOAD_PATH.unshift(*Dir["#{__dir__}/../app/*"])
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
app_root = 'spec/dummy'
|
4
|
+
|
5
|
+
unless File.exist? "#{app_root}/bin/rails"
|
6
|
+
system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
|
7
|
+
warn "Automatic creation of the dummy app failed"
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Dir.chdir 'spec/dummy'
|
13
|
+
exec 'bin/rails', *ARGV
|
@@ -4,20 +4,34 @@ $:.push File.expand_path('lib', __dir__)
|
|
4
4
|
require '<%= file_name %>/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
s.summary
|
7
|
+
s.name = '<%= file_name %>'
|
8
|
+
s.version = <%= class_name %>::VERSION
|
9
|
+
s.summary = 'TODO'
|
10
10
|
s.description = 'TODO'
|
11
|
-
s.license
|
11
|
+
s.license = 'BSD-3-Clause'
|
12
12
|
|
13
|
-
# s.author
|
14
|
-
# s.email
|
15
|
-
# s.homepage
|
13
|
+
# s.author = 'You'
|
14
|
+
# s.email = 'you@example.com'
|
15
|
+
# s.homepage = 'http://www.example.com'
|
16
16
|
|
17
|
-
s.
|
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
|
18
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"]
|
19
32
|
|
20
|
-
s.add_dependency 'solidus_core'
|
33
|
+
s.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
|
34
|
+
s.add_dependency 'solidus_support', '~> 0.4.0'
|
21
35
|
|
22
36
|
s.add_development_dependency 'solidus_dev_support'
|
23
37
|
end
|
@@ -1,22 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/core'
|
4
|
+
|
3
5
|
module <%= class_name %>
|
4
6
|
class Engine < Rails::Engine
|
5
|
-
|
7
|
+
include SolidusSupport::EngineExtensions::Decorators
|
8
|
+
|
6
9
|
isolate_namespace Spree
|
10
|
+
|
7
11
|
engine_name '<%= file_name %>'
|
8
12
|
|
9
13
|
# use rspec for tests
|
10
14
|
config.generators do |g|
|
11
15
|
g.test_framework :rspec
|
12
16
|
end
|
13
|
-
|
14
|
-
def self.activate
|
15
|
-
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
16
|
-
Rails.configuration.cache_classes ? require(c) : load(c)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
config.to_prepare(&method(:activate).to_proc)
|
21
17
|
end
|
22
18
|
end
|
data/solidus_dev_support.gemspec
CHANGED
@@ -43,7 +43,6 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_dependency 'rubocop-rails', '~> 2.3'
|
44
44
|
spec.add_dependency 'rubocop-rspec', '~> 1.36'
|
45
45
|
spec.add_dependency 'solidus_core', ['>= 2.0', '< 3']
|
46
|
-
spec.add_dependency 'solidus_support', '~> 0.3.3'
|
47
46
|
|
48
47
|
spec.add_development_dependency 'bundler'
|
49
48
|
spec.add_development_dependency 'rake'
|
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: 0.3.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:
|
11
|
+
date: 2020-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apparition
|
@@ -254,20 +254,6 @@ dependencies:
|
|
254
254
|
- - "<"
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: '3'
|
257
|
-
- !ruby/object:Gem::Dependency
|
258
|
-
name: solidus_support
|
259
|
-
requirement: !ruby/object:Gem::Requirement
|
260
|
-
requirements:
|
261
|
-
- - "~>"
|
262
|
-
- !ruby/object:Gem::Version
|
263
|
-
version: 0.3.3
|
264
|
-
type: :runtime
|
265
|
-
prerelease: false
|
266
|
-
version_requirements: !ruby/object:Gem::Requirement
|
267
|
-
requirements:
|
268
|
-
- - "~>"
|
269
|
-
- !ruby/object:Gem::Version
|
270
|
-
version: 0.3.3
|
271
257
|
- !ruby/object:Gem::Dependency
|
272
258
|
name: bundler
|
273
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,6 +304,7 @@ files:
|
|
318
304
|
- Rakefile
|
319
305
|
- bin/console
|
320
306
|
- bin/setup
|
307
|
+
- bin/solidus
|
321
308
|
- exe/solidus
|
322
309
|
- lib/solidus_dev_support.rb
|
323
310
|
- lib/solidus_dev_support/extension.rb
|
@@ -339,7 +326,9 @@ files:
|
|
339
326
|
- lib/solidus_dev_support/templates/extension/app/assets/javascripts/spree/frontend/%file_name%.js
|
340
327
|
- lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/backend/%file_name%.css
|
341
328
|
- lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/frontend/%file_name%.css
|
342
|
-
- lib/solidus_dev_support/templates/extension/bin/
|
329
|
+
- lib/solidus_dev_support/templates/extension/bin/console.tt
|
330
|
+
- lib/solidus_dev_support/templates/extension/bin/rails
|
331
|
+
- lib/solidus_dev_support/templates/extension/bin/setup
|
343
332
|
- lib/solidus_dev_support/templates/extension/config/locales/en.yml
|
344
333
|
- lib/solidus_dev_support/templates/extension/config/routes.rb
|
345
334
|
- lib/solidus_dev_support/templates/extension/extension.gemspec.erb
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
2
|
-
|
3
|
-
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
4
|
-
ENGINE_PATH = File.expand_path('../../lib/<%= file_name -%>/engine', __FILE__)
|
5
|
-
|
6
|
-
require 'rails/all'
|
7
|
-
require 'rails/engine/commands'
|