solidus_dev_support 1.5.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +10 -17
- data/.mergify.yml +2 -0
- data/.rubocop.yml +42 -0
- data/CHANGELOG.md +72 -0
- data/Gemfile +1 -1
- data/README.md +13 -4
- data/Rakefile +13 -1
- data/lib/solidus_dev_support/extension.rb +32 -23
- data/lib/solidus_dev_support/rake_tasks.rb +14 -0
- data/lib/solidus_dev_support/rspec/capybara.rb +20 -0
- data/lib/solidus_dev_support/rspec/feature_helper.rb +17 -18
- data/lib/solidus_dev_support/rspec/rails_helper.rb +8 -5
- data/lib/solidus_dev_support/rubocop/config.yml +82 -203
- data/lib/solidus_dev_support/solidus_command.rb +8 -1
- data/lib/solidus_dev_support/templates/extension/.circleci/config.yml +6 -0
- data/lib/solidus_dev_support/templates/extension/.github/stale.yml +4 -4
- data/lib/solidus_dev_support/templates/extension/CHANGELOG.md +1 -0
- data/lib/solidus_dev_support/templates/extension/README.md +18 -10
- data/lib/solidus_dev_support/templates/extension/bin/rails-sandbox +1 -1
- data/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +2 -0
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.tt +4 -4
- data/lib/solidus_dev_support/templates/extension/github_changelog_generator +2 -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%/configuration.rb.tt +21 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/{factories.rb.tt → testing_support/factories.rb.tt} +0 -0
- data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +10 -5
- data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/templates/initializer.rb.tt +6 -0
- data/lib/solidus_dev_support/templates/extension/rubocop.yml +3 -0
- data/lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt +11 -7
- data/lib/solidus_dev_support/version.rb +5 -1
- data/solidus_dev_support.gemspec +16 -14
- data/spec/features/create_extension_spec.rb +187 -0
- data/spec/lib/extension_spec.rb +69 -0
- data/spec/spec_helper.rb +16 -0
- metadata +47 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf90c2bc57b80b7ac05afe68db8c72f7c5156ac479e8fee99d61f38d48ce3b4
|
4
|
+
data.tar.gz: '0830edb6f1562d5b58345c9b79702f1d70aab2c5051cc03570772f5dbbef789d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2afaf6d12de41f7748891da69a9b02a769af1b30bd8124e65378c1633a79a951c608a7d30a5e47267ac3c631029c781a96e6f07e61405e970c7434dd136e27dc
|
7
|
+
data.tar.gz: 4db74c432e1bc63e853c195d95d24e3ee7ed97854e0386ebea3ea4533bed82dbe23ee4eff46040d8b7603a126154a9d8fe91c7d899ca81e04a752ff49f40c48b
|
data/.circleci/config.yml
CHANGED
@@ -7,35 +7,27 @@ orbs:
|
|
7
7
|
# or goes EOL.
|
8
8
|
solidusio_extensions: solidusio/extensions@volatile
|
9
9
|
|
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
10
|
commands:
|
24
11
|
setup:
|
25
12
|
steps:
|
26
13
|
- checkout
|
27
|
-
- run:
|
14
|
+
- run:
|
15
|
+
command: "gem install bundler -v '>=2' --conservative"
|
16
|
+
no_output_timeout: 20m
|
28
17
|
|
29
18
|
jobs:
|
30
19
|
solidus-master:
|
31
|
-
executor: sqlite-memory
|
20
|
+
executor: solidusio_extensions/sqlite-memory
|
32
21
|
steps: ['setup', 'solidusio_extensions/run-tests-solidus-master']
|
33
22
|
solidus-current:
|
34
|
-
executor: sqlite-memory
|
23
|
+
executor: solidusio_extensions/sqlite-memory
|
35
24
|
steps: ['setup', 'solidusio_extensions/run-tests-solidus-current']
|
36
25
|
solidus-older:
|
37
|
-
executor: sqlite-memory
|
26
|
+
executor: solidusio_extensions/sqlite-memory
|
38
27
|
steps: ['setup', 'solidusio_extensions/run-tests-solidus-older']
|
28
|
+
lint-code:
|
29
|
+
executor: solidusio_extensions/sqlite-memory
|
30
|
+
steps: ['setup', 'solidusio_extensions/lint-code']
|
39
31
|
|
40
32
|
workflows:
|
41
33
|
"Run specs on supported Solidus versions":
|
@@ -43,6 +35,7 @@ workflows:
|
|
43
35
|
- solidus-master
|
44
36
|
- solidus-current
|
45
37
|
- solidus-older
|
38
|
+
- lint-code
|
46
39
|
|
47
40
|
"Weekly run specs against master":
|
48
41
|
triggers:
|
data/.mergify.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,11 +1,53 @@
|
|
1
1
|
inherit_from:
|
2
2
|
- https://relaxed.ruby.style/rubocop.yml
|
3
3
|
|
4
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
5
|
+
Enabled: true
|
6
|
+
Layout/SpaceAroundMethodCallOperator:
|
7
|
+
Enabled: true
|
8
|
+
Lint/DeprecatedOpenSSLConstant:
|
9
|
+
Enabled: true
|
10
|
+
Lint/MixedRegexpCaptureTypes:
|
11
|
+
Enabled: true
|
12
|
+
Lint/RaiseException:
|
13
|
+
Enabled: true
|
14
|
+
Lint/StructNewOverride:
|
15
|
+
Enabled: true
|
16
|
+
Style/AccessorGrouping:
|
17
|
+
Enabled: true
|
18
|
+
Style/BisectedAttrAccessor:
|
19
|
+
Enabled: true
|
20
|
+
Style/ExponentialNotation:
|
21
|
+
Enabled: true
|
22
|
+
Style/HashEachMethods:
|
23
|
+
Enabled: true
|
24
|
+
Style/HashTransformKeys:
|
25
|
+
Enabled: true
|
26
|
+
Style/HashTransformValues:
|
27
|
+
Enabled: true
|
28
|
+
Style/RedundantAssignment:
|
29
|
+
Enabled: true
|
30
|
+
Style/RedundantFetchBlock:
|
31
|
+
Enabled: true
|
32
|
+
Style/RedundantRegexpCharacterClass:
|
33
|
+
Enabled: true
|
34
|
+
Style/RedundantRegexpEscape:
|
35
|
+
Enabled: true
|
36
|
+
Style/SlicingWithRange:
|
37
|
+
Enabled: true
|
38
|
+
|
4
39
|
AllCops:
|
40
|
+
TargetRubyVersion: 2.5
|
5
41
|
Exclude:
|
6
42
|
- tmp/**/*
|
43
|
+
- "vendor/**/*"
|
44
|
+
# Generated binstubs
|
45
|
+
- bin/rake
|
46
|
+
NewCops: enable
|
7
47
|
|
8
48
|
Style/FrozenStringLiteralComment:
|
9
49
|
Exclude:
|
10
50
|
- "**/bin/*"
|
11
51
|
- "**/exe/*"
|
52
|
+
- "spec/**/*"
|
53
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,77 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.2.0](https://github.com/solidusio/solidus_dev_support/tree/2.2.0) (2020-11-27)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.1.0...2.2.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Improve the URL generation for the gemspec and Readme \(defaulting to the solidusio-contrib organization\), consistently use a file-based Changelog [\#159](https://github.com/solidusio/solidus_dev_support/pull/159) ([elia](https://github.com/elia))
|
10
|
+
- Configuration Cleanup [\#158](https://github.com/solidusio/solidus_dev_support/pull/158) ([elia](https://github.com/elia))
|
11
|
+
- Refer to Solidus wiki page for gem release info [\#157](https://github.com/solidusio/solidus_dev_support/pull/157) ([spaghetticode](https://github.com/spaghetticode))
|
12
|
+
- Upgrade to RuboCop 1.0 [\#156](https://github.com/solidusio/solidus_dev_support/pull/156) ([aldesantis](https://github.com/aldesantis))
|
13
|
+
- Add a command to display gem's version [\#154](https://github.com/solidusio/solidus_dev_support/pull/154) ([igorbp](https://github.com/igorbp))
|
14
|
+
|
15
|
+
**Fixed bugs:**
|
16
|
+
|
17
|
+
- Require "webdrivers" before using it as the default javascript driver [\#152](https://github.com/solidusio/solidus_dev_support/pull/152) ([ccarruitero](https://github.com/ccarruitero))
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Don't let mergify mark a PR as red because it's missing a review [\#153](https://github.com/solidusio/solidus_dev_support/pull/153) ([elia](https://github.com/elia))
|
22
|
+
|
23
|
+
## [v2.1.0](https://github.com/solidusio/solidus_dev_support/tree/v2.1.0) (2020-10-02)
|
24
|
+
|
25
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.0.1...v2.1.0)
|
26
|
+
|
27
|
+
**Implemented enhancements:**
|
28
|
+
|
29
|
+
- Add standard github\_changelog\_generator configuration [\#151](https://github.com/solidusio/solidus_dev_support/pull/151) ([aldesantis](https://github.com/aldesantis))
|
30
|
+
- Move generated factories to `testing\_support/` [\#150](https://github.com/solidusio/solidus_dev_support/pull/150) ([aldesantis](https://github.com/aldesantis))
|
31
|
+
- Add extension configuration boilerplate [\#149](https://github.com/solidusio/solidus_dev_support/pull/149) ([aldesantis](https://github.com/aldesantis))
|
32
|
+
|
33
|
+
**Fixed bugs:**
|
34
|
+
|
35
|
+
- Fix `NewCops: Enable` option for RuboCop [\#148](https://github.com/solidusio/solidus_dev_support/pull/148) ([aldesantis](https://github.com/aldesantis))
|
36
|
+
|
37
|
+
## [v2.0.1](https://github.com/solidusio/solidus_dev_support/tree/v2.0.1) (2020-09-22)
|
38
|
+
|
39
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.0.0...v2.0.1)
|
40
|
+
|
41
|
+
**Fixed bugs:**
|
42
|
+
|
43
|
+
- Fix gem\_version not being found during extension generation [\#144](https://github.com/solidusio/solidus_dev_support/pull/144) ([aldesantis](https://github.com/aldesantis))
|
44
|
+
|
45
|
+
## [v2.0.0](https://github.com/solidusio/solidus_dev_support/tree/v2.0.0) (2020-09-22)
|
46
|
+
|
47
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.5.0...v2.0.0)
|
48
|
+
|
49
|
+
**Breaking changes:**
|
50
|
+
|
51
|
+
- Switch the JS driver to WebDriver/Selenium [\#136](https://github.com/solidusio/solidus_dev_support/pull/136) ([elia](https://github.com/elia))
|
52
|
+
|
53
|
+
**Implemented enhancements:**
|
54
|
+
|
55
|
+
- Enable new RuboCop cops automatically [\#143](https://github.com/solidusio/solidus_dev_support/pull/143) ([aldesantis](https://github.com/aldesantis))
|
56
|
+
- Don't forcefully close issues via stale-bot [\#139](https://github.com/solidusio/solidus_dev_support/pull/139) ([elia](https://github.com/elia))
|
57
|
+
- Add the approximate recommendation for dev-support to the gemspec [\#137](https://github.com/solidusio/solidus_dev_support/pull/137) ([elia](https://github.com/elia))
|
58
|
+
- Let the extension name include spaces [\#133](https://github.com/solidusio/solidus_dev_support/pull/133) ([elia](https://github.com/elia))
|
59
|
+
- Add precompiled badges fro CI and coverage [\#132](https://github.com/solidusio/solidus_dev_support/pull/132) ([elia](https://github.com/elia))
|
60
|
+
- Add Changelog Rake task [\#128](https://github.com/solidusio/solidus_dev_support/pull/128) ([tvdeyen](https://github.com/tvdeyen))
|
61
|
+
- Readme fixes [\#122](https://github.com/solidusio/solidus_dev_support/pull/122) ([elia](https://github.com/elia))
|
62
|
+
|
63
|
+
**Fixed bugs:**
|
64
|
+
|
65
|
+
- fix capybara driver declaration [\#141](https://github.com/solidusio/solidus_dev_support/pull/141) ([ccarruitero](https://github.com/ccarruitero))
|
66
|
+
- Bump RuboCop to latest 0.90.0 version [\#138](https://github.com/solidusio/solidus_dev_support/pull/138) ([peterberkenbosch](https://github.com/peterberkenbosch))
|
67
|
+
- Fix missing backslash in solidus install command [\#135](https://github.com/solidusio/solidus_dev_support/pull/135) ([nirebu](https://github.com/nirebu))
|
68
|
+
- Don't install a payment-method in the sandbox [\#131](https://github.com/solidusio/solidus_dev_support/pull/131) ([elia](https://github.com/elia))
|
69
|
+
- Run extension generator in sandbox [\#127](https://github.com/solidusio/solidus_dev_support/pull/127) ([elia](https://github.com/elia))
|
70
|
+
|
71
|
+
**Merged pull requests:**
|
72
|
+
|
73
|
+
- Update readme template [\#109](https://github.com/solidusio/solidus_dev_support/pull/109) ([aldesantis](https://github.com/aldesantis))
|
74
|
+
|
3
75
|
## [v1.5.0](https://github.com/solidusio/solidus_dev_support/tree/v1.5.0) (2020-06-13)
|
4
76
|
|
5
77
|
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.4.0...v1.5.0)
|
data/Gemfile
CHANGED
@@ -15,10 +15,10 @@ gem 'rails', '>0.a'
|
|
15
15
|
|
16
16
|
# These gems will be used by the temporary extensions generated by tests
|
17
17
|
group :test do
|
18
|
-
gem 'solidus_auth_devise'
|
19
18
|
gem 'factory_bot', '> 4.10.0'
|
20
19
|
gem 'mysql2'
|
21
20
|
gem 'pg'
|
21
|
+
gem 'solidus_auth_devise'
|
22
22
|
gem 'sqlite3'
|
23
23
|
end
|
24
24
|
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# solidus_dev_support
|
2
2
|
|
3
|
-
|
3
|
+
|
4
|
+
[![CircleCI](https://circleci.com/gh/solidusio/solidus_dev_support.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_dev_support)
|
5
|
+
[![codecov](https://codecov.io/gh/solidusio/solidus_dev_support/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_dev_support)
|
4
6
|
|
5
7
|
This gem contains common development functionality for Solidus extensions.
|
6
8
|
|
@@ -230,9 +232,16 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
230
232
|
the tests. You can also run `bin/console` for an interactive prompt that will allow you to
|
231
233
|
experiment.
|
232
234
|
|
233
|
-
To install this gem onto your local machine, run `bin/rake install`.
|
234
|
-
|
235
|
-
|
235
|
+
To install this gem onto your local machine, run `bin/rake install`.
|
236
|
+
|
237
|
+
To release a new version:
|
238
|
+
|
239
|
+
1. update the version number in `version.rb`
|
240
|
+
2. update the changelog with `bin/rake changelog`
|
241
|
+
3. commit the changes using `Bump SolidusDevSupport to 1.2.3` as the message
|
242
|
+
3. run `bin/rake release`
|
243
|
+
|
244
|
+
The last command will create a git tag for the version, push git commits and tags, and push the `.gem` file to
|
236
245
|
[rubygems.org](https://rubygems.org).
|
237
246
|
|
238
247
|
## Contributing
|
data/Rakefile
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require "rspec/core/rake_task"
|
5
4
|
|
5
|
+
desc "Update the changelog, specify the version for the unreleased changes appending VERSION=1.2.3 to the command"
|
6
|
+
task :changelog do
|
7
|
+
require_relative "lib/solidus_dev_support/version"
|
8
|
+
|
9
|
+
future_release = ENV.fetch("VERSION") {
|
10
|
+
warn "Using current version (#{SolidusDevSupport::VERSION}) for unreleased changes, use VERSION=1.2.3 to select a different one."
|
11
|
+
SolidusDevSupport::VERSION
|
12
|
+
}
|
13
|
+
|
14
|
+
sh "bundle exec github_changelog_generator --project solidus_dev_support --user solidusio --future-release #{future_release}"
|
15
|
+
end
|
16
|
+
|
17
|
+
require "rspec/core/rake_task"
|
6
18
|
RSpec::Core::RakeTask.new(:spec)
|
7
19
|
|
8
20
|
task default: :spec
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'thor'
|
4
4
|
require 'pathname'
|
5
5
|
|
6
|
+
require 'solidus_dev_support/version'
|
7
|
+
|
6
8
|
module SolidusDevSupport
|
7
9
|
class Extension < Thor
|
8
10
|
include Thor::Actions
|
@@ -26,6 +28,7 @@ module SolidusDevSupport
|
|
26
28
|
make_executable bin
|
27
29
|
end
|
28
30
|
|
31
|
+
template 'CHANGELOG.md', "#{path}/CHANGELOG.md"
|
29
32
|
template 'extension.gemspec', "#{path}/#{file_name}.gemspec"
|
30
33
|
template 'Gemfile', "#{path}/Gemfile"
|
31
34
|
template 'gitignore', "#{path}/.gitignore"
|
@@ -38,6 +41,7 @@ module SolidusDevSupport
|
|
38
41
|
template 'rspec', "#{path}/.rspec"
|
39
42
|
template 'spec/spec_helper.rb.tt', "#{path}/spec/spec_helper.rb"
|
40
43
|
template 'rubocop.yml', "#{path}/.rubocop.yml"
|
44
|
+
template 'github_changelog_generator', "#{path}/.github_changelog_generator"
|
41
45
|
end
|
42
46
|
|
43
47
|
no_tasks do
|
@@ -47,27 +51,36 @@ module SolidusDevSupport
|
|
47
51
|
@file_name = Thor::Util.snake_case(File.basename(path))
|
48
52
|
@file_name = PREFIX + @file_name unless @file_name.start_with?(PREFIX)
|
49
53
|
|
50
|
-
@class_name = Thor::Util.camel_case
|
54
|
+
@class_name = Thor::Util.camel_case file_name
|
51
55
|
|
52
56
|
@root = File.dirname(path)
|
53
|
-
@path = File.join(
|
57
|
+
@path = File.join(root, file_name)
|
58
|
+
|
59
|
+
@repo = existing_repo || default_repo
|
54
60
|
|
55
61
|
@gemspec = existing_gemspec || default_gemspec
|
56
62
|
end
|
57
63
|
|
64
|
+
attr_reader :root, :path, :file_name, :class_name, :gemspec, :repo
|
65
|
+
|
66
|
+
private
|
67
|
+
|
58
68
|
def gemspec_path
|
59
69
|
@gemspec_path ||= File.join(path, "#{file_name}.gemspec")
|
60
70
|
end
|
61
71
|
|
62
72
|
def default_gemspec
|
63
|
-
@default_gemspec ||= Gem::Specification.new(
|
73
|
+
@default_gemspec ||= Gem::Specification.new(file_name, '0.0.1') do |gem|
|
64
74
|
gem.author = git('config user.name', 'TODO: Write your name')
|
65
|
-
gem.description = 'TODO: Write a longer description or delete this line.'
|
66
75
|
gem.email = git('config user.email', 'TODO: Write your email address')
|
67
|
-
|
68
|
-
gem.license = 'BSD-3-Clause'
|
69
|
-
gem.metadata['changelog_uri'] = default_homepage + '/releases'
|
76
|
+
|
70
77
|
gem.summary = 'TODO: Write a short summary, because RubyGems requires one.'
|
78
|
+
gem.description = 'TODO: Write a longer description or delete this line.'
|
79
|
+
gem.license = 'BSD-3-Clause'
|
80
|
+
|
81
|
+
gem.metadata['homepage_uri'] = gem.homepage = "https://github.com/#{repo}#readme"
|
82
|
+
gem.metadata['changelog_uri'] = "https://github.com/#{repo}/blob/master/CHANGELOG.md"
|
83
|
+
gem.metadata['source_code_uri'] = "https://github.com/#{repo}"
|
71
84
|
end
|
72
85
|
end
|
73
86
|
|
@@ -77,28 +90,26 @@ module SolidusDevSupport
|
|
77
90
|
@existing_gemspec ||= Gem::Specification.load(gemspec_path).tap do |spec|
|
78
91
|
spec.author ||= default_gemspec.author
|
79
92
|
spec.email ||= default_gemspec.email
|
80
|
-
|
81
|
-
spec.license ||= default_gemspec.license
|
82
|
-
spec.metadata['changelog_uri'] ||= default_gemspec.metadata[:changelog_uri]
|
93
|
+
|
83
94
|
spec.summary ||= default_gemspec.summary
|
95
|
+
spec.license ||= default_gemspec.license
|
96
|
+
|
97
|
+
spec.homepage ||= default_gemspec.homepage
|
98
|
+
spec.metadata['source_code_uri'] ||= default_gemspec.metadata['source_code_uri']
|
99
|
+
spec.metadata['changelog_uri'] ||= default_gemspec.metadata['changelog_uri']
|
100
|
+
spec.metadata['source_code_uri'] ||= default_gemspec.metadata['source_code_uri']
|
84
101
|
end
|
85
102
|
end
|
86
103
|
|
87
|
-
def
|
88
|
-
|
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
|
-
)
|
104
|
+
def default_repo
|
105
|
+
"solidusio-contrib/#{file_name}"
|
95
106
|
end
|
96
107
|
|
97
|
-
def
|
98
|
-
|
108
|
+
def existing_repo
|
109
|
+
git('remote get-url origin')&.sub(%r{^.*github\.com.([^/]+)/([^/.]+).*$}, '\1/\2')
|
99
110
|
end
|
100
111
|
|
101
|
-
def git(command, default)
|
112
|
+
def git(command, default = nil)
|
102
113
|
result = `git #{command} 2> /dev/null`.strip
|
103
114
|
result.empty? ? default : result
|
104
115
|
end
|
@@ -108,8 +119,6 @@ module SolidusDevSupport
|
|
108
119
|
executable = (path.stat.mode | 0o111)
|
109
120
|
path.chmod(executable)
|
110
121
|
end
|
111
|
-
|
112
|
-
attr_reader :root, :path, :file_name, :class_name, :gemspec
|
113
122
|
end
|
114
123
|
|
115
124
|
def self.source_root
|
@@ -23,6 +23,7 @@ module SolidusDevSupport
|
|
23
23
|
install_test_app_task
|
24
24
|
install_dev_app_task
|
25
25
|
install_rspec_task
|
26
|
+
install_changelog_task
|
26
27
|
end
|
27
28
|
|
28
29
|
def install_test_app_task
|
@@ -71,5 +72,18 @@ module SolidusDevSupport
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
75
|
+
|
76
|
+
def install_changelog_task
|
77
|
+
require 'github_changelog_generator/task'
|
78
|
+
|
79
|
+
GitHubChangelogGenerator::RakeTask.new(:changelog) do |config|
|
80
|
+
require 'octokit'
|
81
|
+
repo = Octokit::Repository.from_url(gemspec.metadata['source_code_uri'] || gemspec.homepage)
|
82
|
+
|
83
|
+
config.user = repo.owner
|
84
|
+
config.project = repo.name
|
85
|
+
config.future_release = "v#{ENV['UNRELEASED_VERSION'] || gemspec.version}"
|
86
|
+
end
|
87
|
+
end
|
74
88
|
end
|
75
89
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'webdrivers/chromedriver'
|
4
|
+
|
5
|
+
# Allow to override the initial windows size
|
6
|
+
CAPYBARA_WINDOW_SIZE = (ENV['CAPYBARA_WINDOW_SIZE'] || '1920x1080').split('x', 2).map(&:to_i)
|
7
|
+
|
8
|
+
Capybara.javascript_driver = (ENV['CAPYBARA_JAVASCRIPT_DRIVER'] || "solidus_chrome_headless").to_sym
|
9
|
+
Capybara.default_max_wait_time = 10
|
10
|
+
Capybara.server = :puma, { Silent: true } # A fix for rspec/rspec-rails#1897
|
11
|
+
|
12
|
+
Capybara.drivers[:selenium_chrome_headless].tap do |original_driver|
|
13
|
+
Capybara.register_driver :solidus_chrome_headless do |app|
|
14
|
+
original_driver.call(app).tap do |driver|
|
15
|
+
driver.options[:options].args << "--window-size=#{CAPYBARA_WINDOW_SIZE.join(',')}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'spree/testing_support/capybara_ext'
|
@@ -10,30 +10,29 @@
|
|
10
10
|
require 'solidus_dev_support/rspec/rails_helper'
|
11
11
|
|
12
12
|
require 'capybara-screenshot/rspec'
|
13
|
-
require 'capybara
|
13
|
+
require 'solidus_dev_support/rspec/capybara'
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def dev_support_assets_preload
|
16
|
+
if Rails.application.respond_to?(:precompiled_assets)
|
17
|
+
Rails.application.precompiled_assets
|
18
|
+
else
|
19
|
+
# For older sprockets 2.x
|
20
|
+
Rails.application.config.assets.precompile.each do |asset|
|
21
|
+
Rails.application.assets.find_asset(asset)
|
22
|
+
end
|
23
|
+
end
|
21
24
|
end
|
22
25
|
|
23
|
-
require 'spree/testing_support/capybara_ext'
|
24
|
-
|
25
26
|
RSpec.configure do |config|
|
26
27
|
config.when_first_matching_example_defined(type: :feature) do
|
27
28
|
config.before :suite do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
29
|
+
dev_support_assets_preload
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
config.when_first_matching_example_defined(type: :system) do
|
34
|
+
config.before :suite do
|
35
|
+
dev_support_assets_preload
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|