solidus_dev_support 1.5.0 → 1.6.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 +7 -16
- data/.rubocop.yml +42 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +1 -1
- data/README.md +3 -1
- data/Rakefile +11 -1
- data/lib/solidus_dev_support/extension.rb +1 -1
- data/lib/solidus_dev_support/rake_tasks.rb +12 -0
- data/lib/solidus_dev_support/rspec/feature_helper.rb +18 -9
- 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 +0 -1
- data/lib/solidus_dev_support/templates/extension/.circleci/config.yml +6 -0
- data/lib/solidus_dev_support/templates/extension/README.md +23 -7
- 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/lib/generators/%file_name%/install/install_generator.rb.tt +5 -5
- data/lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt +9 -5
- data/lib/solidus_dev_support/version.rb +1 -1
- data/solidus_dev_support.gemspec +14 -12
- data/spec/features/create_extension_spec.rb +166 -0
- data/spec/lib/extension_spec.rb +33 -0
- data/spec/spec_helper.rb +16 -0
- metadata +27 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57ffc454eba9fcbba02fb86c44287829fff79b729667b7337e3acf2c7fa09528
|
4
|
+
data.tar.gz: 1e408fd52a16aa8bafb5a87d8180661bf2e43126a61203916c0bee70b3dbe13d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 754b6f714db2c8436875c69c9af9aabe018f321c5ea12b683657d56e5a1e6595fb7f16f965cf5ea6701bcd5ea6e0f3c10a27fabd4d07f9abc815f9b1499046d2
|
7
|
+
data.tar.gz: c2f11a1b7bd1983dca96baf5a9f62f61b237ff6402657ba4bba72e91133e3a835887e4f9d15a1a423d8236d035516eddc64dab4ff1ba194c39c3c1ca4216f08f
|
data/.circleci/config.yml
CHANGED
@@ -7,19 +7,6 @@ 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:
|
@@ -28,14 +15,17 @@ commands:
|
|
28
15
|
|
29
16
|
jobs:
|
30
17
|
solidus-master:
|
31
|
-
executor: sqlite-memory
|
18
|
+
executor: solidusio_extensions/sqlite-memory
|
32
19
|
steps: ['setup', 'solidusio_extensions/run-tests-solidus-master']
|
33
20
|
solidus-current:
|
34
|
-
executor: sqlite-memory
|
21
|
+
executor: solidusio_extensions/sqlite-memory
|
35
22
|
steps: ['setup', 'solidusio_extensions/run-tests-solidus-current']
|
36
23
|
solidus-older:
|
37
|
-
executor: sqlite-memory
|
24
|
+
executor: solidusio_extensions/sqlite-memory
|
38
25
|
steps: ['setup', 'solidusio_extensions/run-tests-solidus-older']
|
26
|
+
lint-code:
|
27
|
+
executor: solidusio_extensions/sqlite-memory
|
28
|
+
steps: ['setup', 'solidusio_extensions/lint-code']
|
39
29
|
|
40
30
|
workflows:
|
41
31
|
"Run specs on supported Solidus versions":
|
@@ -43,6 +33,7 @@ workflows:
|
|
43
33
|
- solidus-master
|
44
34
|
- solidus-current
|
45
35
|
- solidus-older
|
36
|
+
- lint-code
|
46
37
|
|
47
38
|
"Weekly run specs against master":
|
48
39
|
triggers:
|
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
|
+
|
39
|
+
|
4
40
|
AllCops:
|
41
|
+
TargetRubyVersion: 2.5
|
5
42
|
Exclude:
|
6
43
|
- tmp/**/*
|
44
|
+
- "vendor/**/*"
|
45
|
+
# Generated binstubs
|
46
|
+
- bin/rake
|
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,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/solidusio/solidus_dev_support/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.5.0...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Let the extension name include spaces [\#133](https://github.com/solidusio/solidus_dev_support/pull/133) ([elia](https://github.com/elia))
|
10
|
+
- Add precompiled badges fro CI and coverage [\#132](https://github.com/solidusio/solidus_dev_support/pull/132) ([elia](https://github.com/elia))
|
11
|
+
- Add Changelog Rake task [\#128](https://github.com/solidusio/solidus_dev_support/pull/128) ([tvdeyen](https://github.com/tvdeyen))
|
12
|
+
- Readme fixes [\#122](https://github.com/solidusio/solidus_dev_support/pull/122) ([elia](https://github.com/elia))
|
13
|
+
|
14
|
+
**Fixed bugs:**
|
15
|
+
|
16
|
+
- Don't install a payment-method in the sandbox [\#131](https://github.com/solidusio/solidus_dev_support/pull/131) ([elia](https://github.com/elia))
|
17
|
+
- Run extension generator in sandbox [\#127](https://github.com/solidusio/solidus_dev_support/pull/127) ([elia](https://github.com/elia))
|
18
|
+
|
3
19
|
## [v1.5.0](https://github.com/solidusio/solidus_dev_support/tree/v1.5.0) (2020-06-13)
|
4
20
|
|
5
21
|
[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
|
+
[](https://circleci.com/gh/solidusio/solidus_dev_support)
|
5
|
+
[](https://codecov.io/gh/solidusio/solidus_dev_support)
|
4
6
|
|
5
7
|
This gem contains common development functionality for Solidus extensions.
|
6
8
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require "rspec/core/rake_task"
|
5
4
|
|
5
|
+
require 'github_changelog_generator/task'
|
6
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
7
|
+
config.user = 'solidusio'
|
8
|
+
config.project = 'solidus_dev_support'
|
9
|
+
config.exclude_labels = %w[infrastructure]
|
10
|
+
config.issues = false
|
11
|
+
config.base = "#{__dir__}/OLD_CHANGELOG.md"
|
12
|
+
config.since_tag = 'v1.4.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
require "rspec/core/rake_task"
|
6
16
|
RSpec::Core::RakeTask.new(:spec)
|
7
17
|
|
8
18
|
task default: :spec
|
@@ -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,16 @@ 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
|
+
user, project = gemspec.homepage.split("/")[3..5]
|
80
|
+
GitHubChangelogGenerator::RakeTask.new(:changelog) do |config|
|
81
|
+
config.user = user || 'solidus-contrib'
|
82
|
+
config.project = project || gemspec.name
|
83
|
+
config.future_release = "v#{gemspec.version}"
|
84
|
+
end
|
85
|
+
end
|
74
86
|
end
|
75
87
|
end
|
@@ -22,18 +22,27 @@ end
|
|
22
22
|
|
23
23
|
require 'spree/testing_support/capybara_ext'
|
24
24
|
|
25
|
+
def dev_support_assets_preload
|
26
|
+
if Rails.application.respond_to?(:precompiled_assets)
|
27
|
+
Rails.application.precompiled_assets
|
28
|
+
else
|
29
|
+
# For older sprockets 2.x
|
30
|
+
Rails.application.config.assets.precompile.each do |asset|
|
31
|
+
Rails.application.assets.find_asset(asset)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
25
36
|
RSpec.configure do |config|
|
26
37
|
config.when_first_matching_example_defined(type: :feature) do
|
27
38
|
config.before :suite do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
39
|
+
dev_support_assets_preload
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
config.when_first_matching_example_defined(type: :system) do
|
44
|
+
config.before :suite do
|
45
|
+
dev_support_assets_preload
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
@@ -67,14 +67,17 @@ RSpec.configure do |config|
|
|
67
67
|
rescue NameError => e
|
68
68
|
class ZeitwerkNameError < NameError; end
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
#{if e.message =~ /expected file .*? to define constant [\w:]+/
|
70
|
+
error_message =
|
71
|
+
if e.message =~ /expected file .*? to define constant [\w:]+/
|
74
72
|
e.message.sub(/expected file #{Regexp.escape(File.expand_path('../..', Rails.root))}./, "expected file ")
|
75
73
|
else
|
76
74
|
e.message
|
77
|
-
end
|
75
|
+
end
|
76
|
+
|
77
|
+
message = <<~WARN
|
78
|
+
Zeitwerk raised the following error when trying to eager load your extension:
|
79
|
+
|
80
|
+
#{error_message}
|
78
81
|
|
79
82
|
This most likely means that your extension's file structure is not
|
80
83
|
compatible with the Zeitwerk autoloader.
|
@@ -1,203 +1,82 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Style/
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Style/
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Style/
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Style/
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Style/
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
Style/NegatedIf:
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
Style/
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
Style/
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
Style/
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
Style/
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
Style/
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
Style/Semicolon:
|
85
|
-
Enabled: false
|
86
|
-
StyleGuide: https://relaxed.ruby.style/#stylesemicolon
|
87
|
-
|
88
|
-
Style/SignalException:
|
89
|
-
Enabled: false
|
90
|
-
StyleGuide: https://relaxed.ruby.style/#stylesignalexception
|
91
|
-
|
92
|
-
Style/SingleLineBlockParams:
|
93
|
-
Enabled: false
|
94
|
-
StyleGuide: https://relaxed.ruby.style/#stylesinglelineblockparams
|
95
|
-
|
96
|
-
Style/SingleLineMethods:
|
97
|
-
Enabled: false
|
98
|
-
StyleGuide: https://relaxed.ruby.style/#stylesinglelinemethods
|
99
|
-
|
100
|
-
Layout/SpaceBeforeBlockBraces:
|
101
|
-
Enabled: false
|
102
|
-
StyleGuide: https://relaxed.ruby.style/#layoutspacebeforeblockbraces
|
103
|
-
|
104
|
-
Layout/SpaceInsideParens:
|
105
|
-
Enabled: false
|
106
|
-
StyleGuide: https://relaxed.ruby.style/#layoutspaceinsideparens
|
107
|
-
|
108
|
-
Style/SpecialGlobalVars:
|
109
|
-
Enabled: false
|
110
|
-
StyleGuide: https://relaxed.ruby.style/#stylespecialglobalvars
|
111
|
-
|
112
|
-
Style/StringLiterals:
|
113
|
-
Enabled: false
|
114
|
-
StyleGuide: https://relaxed.ruby.style/#stylestringliterals
|
115
|
-
|
116
|
-
Style/TrailingCommaInArguments:
|
117
|
-
Enabled: false
|
118
|
-
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarguments
|
119
|
-
|
120
|
-
Style/TrailingCommaInArrayLiteral:
|
121
|
-
Enabled: false
|
122
|
-
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarrayliteral
|
123
|
-
|
124
|
-
Style/TrailingCommaInHashLiteral:
|
125
|
-
Enabled: false
|
126
|
-
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainhashliteral
|
127
|
-
|
128
|
-
Style/SymbolArray:
|
129
|
-
Enabled: false
|
130
|
-
StyleGuide: http://relaxed.ruby.style/#stylesymbolarray
|
131
|
-
|
132
|
-
Style/WhileUntilModifier:
|
133
|
-
Enabled: false
|
134
|
-
StyleGuide: https://relaxed.ruby.style/#stylewhileuntilmodifier
|
135
|
-
|
136
|
-
Style/WordArray:
|
137
|
-
Enabled: false
|
138
|
-
StyleGuide: https://relaxed.ruby.style/#stylewordarray
|
139
|
-
|
140
|
-
Lint/AmbiguousRegexpLiteral:
|
141
|
-
Enabled: false
|
142
|
-
StyleGuide: https://relaxed.ruby.style/#lintambiguousregexpliteral
|
143
|
-
|
144
|
-
Lint/AssignmentInCondition:
|
145
|
-
Enabled: false
|
146
|
-
StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
|
147
|
-
|
148
|
-
Metrics/AbcSize:
|
149
|
-
Enabled: false
|
150
|
-
|
151
|
-
Metrics/BlockNesting:
|
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:
|
173
|
-
Enabled: false
|
174
|
-
|
175
|
-
# Our overrides after this point:
|
176
|
-
|
177
|
-
require:
|
178
|
-
- rubocop-rspec
|
179
|
-
- rubocop-rails
|
180
|
-
- rubocop-performance
|
181
|
-
|
182
|
-
AllCops:
|
183
|
-
TargetRubyVersion: 2.5
|
184
|
-
Exclude:
|
185
|
-
- spec/dummy/**/*
|
186
|
-
- sandbox/**/*
|
187
|
-
- vendor/**/*
|
188
|
-
|
189
|
-
Metrics/BlockLength:
|
190
|
-
Enabled: false
|
191
|
-
|
192
|
-
Metrics/LineLength:
|
193
|
-
Enabled: true
|
194
|
-
Max: 100
|
195
|
-
|
196
|
-
RSpec/ExampleLength:
|
197
|
-
Enabled: false
|
198
|
-
|
199
|
-
Layout/AlignArguments:
|
200
|
-
EnforcedStyle: with_fixed_indentation
|
201
|
-
|
202
|
-
Layout/MultilineOperationIndentation:
|
203
|
-
Enabled: false
|
1
|
+
require: ["rubocop-rspec", "rubocop-rails", "rubocop-performance"]
|
2
|
+
|
3
|
+
AllCops: {TargetRubyVersion: 2.5, Exclude: ["spec/dummy/**/*", "sandbox/**/*", "vendor/**/*"]}
|
4
|
+
|
5
|
+
Layout/ArgumentAlignment: {EnforcedStyle: with_fixed_indentation}
|
6
|
+
Layout/DotPosition: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#layoutdotposition"}
|
7
|
+
Layout/EmptyLinesAroundAttributeAccessor: {Enabled: true}
|
8
|
+
Layout/FirstArgumentIndentation: {EnforcedStyle: "consistent"}
|
9
|
+
Layout/FirstArrayElementIndentation: {EnforcedStyle: "consistent"}
|
10
|
+
Layout/LineLength: {Enabled: true, Max: 120}
|
11
|
+
Layout/MultilineOperationIndentation: {Enabled: false}
|
12
|
+
Layout/SpaceAroundMethodCallOperator: {Enabled: true}
|
13
|
+
Layout/SpaceBeforeBlockBraces: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#layoutspacebeforeblockbraces"}
|
14
|
+
Layout/SpaceInsideParens: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#layoutspaceinsideparens"}
|
15
|
+
Lint/AmbiguousRegexpLiteral: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#lintambiguousregexpliteral"}
|
16
|
+
Lint/AssignmentInCondition: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#lintassignmentincondition"}
|
17
|
+
Lint/DeprecatedOpenSSLConstant: {Enabled: true}
|
18
|
+
Lint/MixedRegexpCaptureTypes: {Enabled: true}
|
19
|
+
Lint/RaiseException: {Enabled: true}
|
20
|
+
Lint/StructNewOverride: {Enabled: true}
|
21
|
+
Metrics/AbcSize: {Enabled: false}
|
22
|
+
Metrics/BlockLength: {Enabled: false}
|
23
|
+
Metrics/BlockNesting: {Enabled: false}
|
24
|
+
Metrics/ClassLength: {Enabled: false}
|
25
|
+
Metrics/CyclomaticComplexity: {Enabled: false}
|
26
|
+
Metrics/MethodLength: {Enabled: false}
|
27
|
+
Metrics/ModuleLength: {Enabled: false}
|
28
|
+
Metrics/ParameterLists: {Enabled: false}
|
29
|
+
Metrics/PerceivedComplexity: {Enabled: false}
|
30
|
+
Performance/AncestorsInclude: {Enabled: true}
|
31
|
+
Performance/BigDecimalWithNumericArgument: {Enabled: true}
|
32
|
+
Performance/RedundantSortBlock: {Enabled: true}
|
33
|
+
Performance/RedundantStringChars: {Enabled: true}
|
34
|
+
Performance/ReverseFirst: {Enabled: true}
|
35
|
+
Performance/SortReverse: {Enabled: true}
|
36
|
+
Performance/Squeeze: {Enabled: true}
|
37
|
+
Performance/StringInclude: {Enabled: true}
|
38
|
+
RSpec/DescribeClass: {Exclude: ["spec/features/**/*"]} # Feature specs are not describing any class or module.
|
39
|
+
RSpec/ExampleLength: {Enabled: false}
|
40
|
+
Style/AccessorGrouping: {Enabled: true}
|
41
|
+
Style/Alias: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylealias"}
|
42
|
+
Style/AsciiComments: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleasciicomments"}
|
43
|
+
Style/BeginBlock: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylebeginblock"}
|
44
|
+
Style/BisectedAttrAccessor: {Enabled: true}
|
45
|
+
Style/BlockDelimiters: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleblockdelimiters"}
|
46
|
+
Style/CommentAnnotation: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylecommentannotation"}
|
47
|
+
Style/Documentation: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styledocumentation"}
|
48
|
+
Style/DoubleNegation: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styledoublenegation"}
|
49
|
+
Style/EndBlock: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleendblock"}
|
50
|
+
Style/ExponentialNotation: {Enabled: true}
|
51
|
+
Style/FormatString: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleformatstring"}
|
52
|
+
Style/FrozenStringLiteralComment: {Exclude: ["spec/**/*", "db/migrate/**/*", "bin/**/*"]}
|
53
|
+
Style/HashEachMethods: {Enabled: true}
|
54
|
+
Style/HashTransformKeys: {Enabled: true}
|
55
|
+
Style/HashTransformValues: {Enabled: true}
|
56
|
+
Style/IfUnlessModifier: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleifunlessmodifier"}
|
57
|
+
Style/Lambda: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylelambda"}
|
58
|
+
Style/ModuleFunction: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylemodulefunction"}
|
59
|
+
Style/MultilineBlockChain: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylemultilineblockchain"}
|
60
|
+
Style/NegatedIf: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylenegatedif"}
|
61
|
+
Style/NegatedWhile: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylenegatedwhile"}
|
62
|
+
Style/NumericPredicate: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylenumericpredicate"}
|
63
|
+
Style/ParallelAssignment: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleparallelassignment"}
|
64
|
+
Style/PercentLiteralDelimiters: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylepercentliteraldelimiters"}
|
65
|
+
Style/PerlBackrefs: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styleperlbackrefs"}
|
66
|
+
Style/RedundantAssignment: {Enabled: true}
|
67
|
+
Style/RedundantFetchBlock: {Enabled: true}
|
68
|
+
Style/RedundantRegexpCharacterClass: {Enabled: true}
|
69
|
+
Style/RedundantRegexpEscape: {Enabled: true}
|
70
|
+
Style/Semicolon: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylesemicolon"}
|
71
|
+
Style/SignalException: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylesignalexception"}
|
72
|
+
Style/SingleLineBlockParams: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylesinglelineblockparams"}
|
73
|
+
Style/SingleLineMethods: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylesinglelinemethods"}
|
74
|
+
Style/SlicingWithRange: {Enabled: true}
|
75
|
+
Style/SpecialGlobalVars: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylespecialglobalvars"}
|
76
|
+
Style/StringLiterals: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylestringliterals"}
|
77
|
+
Style/SymbolArray: {Enabled: false, StyleGuide: "http://relaxed.ruby.style/#stylesymbolarray"}
|
78
|
+
Style/TrailingCommaInArguments: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styletrailingcommainarguments"}
|
79
|
+
Style/TrailingCommaInArrayLiteral: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styletrailingcommainarrayliteral"}
|
80
|
+
Style/TrailingCommaInHashLiteral: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#styletrailingcommainhashliteral"}
|
81
|
+
Style/WhileUntilModifier: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylewhileuntilmodifier"}
|
82
|
+
Style/WordArray: {Enabled: false, StyleGuide: "https://relaxed.ruby.style/#stylewordarray"}
|
@@ -16,12 +16,18 @@ jobs:
|
|
16
16
|
executor: solidusio_extensions/mysql
|
17
17
|
steps:
|
18
18
|
- solidusio_extensions/run-tests
|
19
|
+
lint-code:
|
20
|
+
executor: solidusio_extensions/sqlite-memory
|
21
|
+
steps:
|
22
|
+
- solidusio_extensions/lint-code
|
19
23
|
|
20
24
|
workflows:
|
21
25
|
"Run specs on supported Solidus versions":
|
22
26
|
jobs:
|
23
27
|
- run-specs-with-postgres
|
24
28
|
- run-specs-with-mysql
|
29
|
+
- lint-code
|
30
|
+
|
25
31
|
"Weekly run specs against master":
|
26
32
|
triggers:
|
27
33
|
- schedule:
|
@@ -1,6 +1,13 @@
|
|
1
|
-
# <%= class_name %>
|
1
|
+
# <%= class_name.gsub(/(?<=[^A-Z])([A-Z])/, ' \1') %>
|
2
2
|
|
3
|
-
|
3
|
+
<!-- Replace REPO_ORG and uncomment the following to show badges for CI and coverage. -->
|
4
|
+
|
5
|
+
<!--
|
6
|
+
[](https://circleci.com/gh/REPO_ORG/<%= file_name %>)
|
7
|
+
[](https://codecov.io/gh/REPO_ORG/<%= file_name %>)
|
8
|
+
-->
|
9
|
+
|
10
|
+
[Explain what your extension does.]
|
4
11
|
|
5
12
|
## Installation
|
6
13
|
|
@@ -13,8 +20,7 @@ gem '<%= file_name %>'
|
|
13
20
|
Bundle your dependencies and run the installation generator:
|
14
21
|
|
15
22
|
```shell
|
16
|
-
|
17
|
-
bundle exec rails g <%= file_name %>:install
|
23
|
+
bin/rails generate <%= file_name %>:install
|
18
24
|
```
|
19
25
|
|
20
26
|
## Usage
|
@@ -30,7 +36,6 @@ app if it does not exist, then it will run specs. The dummy app can be regenerat
|
|
30
36
|
`bin/rake extension:test_app`.
|
31
37
|
|
32
38
|
```shell
|
33
|
-
bundle
|
34
39
|
bin/rake
|
35
40
|
```
|
36
41
|
|
@@ -55,7 +60,7 @@ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands t
|
|
55
60
|
|
56
61
|
Here's an example:
|
57
62
|
|
58
|
-
```
|
63
|
+
```
|
59
64
|
$ bin/rails server
|
60
65
|
=> Booting Puma
|
61
66
|
=> Rails 6.0.2.1 application starting in development
|
@@ -63,12 +68,23 @@ $ bin/rails server
|
|
63
68
|
Use Ctrl-C to stop
|
64
69
|
```
|
65
70
|
|
71
|
+
### Updating the changelog
|
72
|
+
|
73
|
+
Before and after releases the changelog should be updated to reflect the up-to-date status of
|
74
|
+
the project:
|
75
|
+
|
76
|
+
```shell
|
77
|
+
bin/rake changelog
|
78
|
+
git add CHANGELOG.md
|
79
|
+
git commit -m "Update the changelog"
|
80
|
+
```
|
81
|
+
|
66
82
|
### Releasing new versions
|
67
83
|
|
68
84
|
Your new extension version can be released using `gem-release` like this:
|
69
85
|
|
70
86
|
```shell
|
71
|
-
bundle exec gem bump -v VERSION --tag --push --remote
|
87
|
+
bundle exec gem bump -v VERSION --tag --push --remote origin && gem release
|
72
88
|
```
|
73
89
|
|
74
90
|
## License
|
@@ -5,7 +5,7 @@ app_root = 'sandbox'
|
|
5
5
|
unless File.exist? "#{app_root}/bin/rails"
|
6
6
|
warn 'Creating the sandbox app...'
|
7
7
|
Dir.chdir "#{__dir__}/.." do
|
8
|
-
system "#{__dir__}/sandbox" or begin
|
8
|
+
system "#{__dir__}/sandbox" or begin
|
9
9
|
warn 'Automatic creation of the sandbox app failed'
|
10
10
|
exit 1
|
11
11
|
end
|
@@ -72,9 +72,11 @@ unbundled bundle exec rails generate spree:install \
|
|
72
72
|
--user_class=Spree::User \
|
73
73
|
--enforce_available_locales=true \
|
74
74
|
--with-authentication=false \
|
75
|
+
--payment-method=none
|
75
76
|
$@
|
76
77
|
|
77
78
|
unbundled bundle exec rails generate solidus:auth:install
|
79
|
+
unbundled bundle exec rails generate ${extension_name}:install
|
78
80
|
|
79
81
|
echo
|
80
82
|
echo "🚀 Sandbox app successfully created for $extension_name!"
|
@@ -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"
|
10
|
+
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
|
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 # rubocop:disable
|
15
|
-
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable
|
14
|
+
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
15
|
+
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/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]')) # rubocop:disable
|
23
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
|
24
24
|
if run_migrations
|
25
25
|
run 'bin/rails db:migrate'
|
26
26
|
else
|
@@ -6,17 +6,17 @@ ENV['RAILS_ENV'] = 'test'
|
|
6
6
|
# Run Coverage report
|
7
7
|
require 'solidus_dev_support/rspec/coverage'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# Create the dummy app if it's still missing.
|
10
|
+
dummy_env = "#{__dir__}/dummy/config/environment.rb"
|
11
|
+
system 'bin/rake extension:test_app' unless File.exist? dummy_env
|
12
|
+
require dummy_env
|
13
13
|
|
14
14
|
# Requires factories and other useful helpers defined in spree_core.
|
15
15
|
require 'solidus_dev_support/rspec/feature_helper'
|
16
16
|
|
17
17
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
18
18
|
# in spec/support/ and its subdirectories.
|
19
|
-
Dir[
|
19
|
+
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
20
20
|
|
21
21
|
# Requires factories defined in lib/<%= file_name %>/factories.rb
|
22
22
|
require '<%= file_name %>/factories'
|
@@ -24,4 +24,8 @@ require '<%= file_name %>/factories'
|
|
24
24
|
RSpec.configure do |config|
|
25
25
|
config.infer_spec_type_from_file_location!
|
26
26
|
config.use_transactional_fixtures = false
|
27
|
+
|
28
|
+
if Spree.solidus_gem_version < Gem::Version.new('2.11')
|
29
|
+
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
|
30
|
+
end
|
27
31
|
end
|
data/solidus_dev_support.gemspec
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'solidus_dev_support/version'
|
3
|
+
require_relative 'lib/solidus_dev_support/version'
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = 'solidus_dev_support'
|
@@ -16,29 +14,33 @@ Gem::Specification.new do |spec|
|
|
16
14
|
|
17
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
16
|
spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_dev_support'
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_dev_support/blob/master/CHANGELOG.md'
|
18
|
+
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
|
19
20
|
|
20
21
|
# Specify which files should be added to the gem when it is released.
|
21
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.
|
23
|
+
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
24
|
+
|
25
|
+
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
26
|
+
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
28
30
|
|
29
31
|
spec.add_dependency 'apparition', '~> 0.4'
|
30
32
|
spec.add_dependency 'capybara', '~> 3.29'
|
31
33
|
spec.add_dependency 'capybara-screenshot', '~> 1.0'
|
32
|
-
spec.add_dependency 'codecov', '~> 0.
|
34
|
+
spec.add_dependency 'codecov', '~> 0.2'
|
33
35
|
spec.add_dependency 'database_cleaner', '~> 1.7'
|
34
36
|
spec.add_dependency 'factory_bot_rails', '~> 5.1'
|
35
37
|
spec.add_dependency 'ffaker', '~> 2.13'
|
36
38
|
spec.add_dependency 'gem-release', '~> 2.1'
|
37
39
|
spec.add_dependency 'github_changelog_generator', '~> 1.15'
|
38
40
|
spec.add_dependency 'puma', '~> 4.3'
|
39
|
-
spec.add_dependency 'rspec-rails', '~> 4.0.0.beta3'
|
40
41
|
spec.add_dependency 'rspec_junit_formatter'
|
41
|
-
spec.add_dependency '
|
42
|
+
spec.add_dependency 'rspec-rails', '~> 4.0.0.beta3'
|
43
|
+
spec.add_dependency 'rubocop', '~> 0.87.1'
|
42
44
|
spec.add_dependency 'rubocop-performance', '~> 1.5'
|
43
45
|
spec.add_dependency 'rubocop-rails', '~> 2.3'
|
44
46
|
spec.add_dependency 'rubocop-rspec', '~> 1.36'
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'open3'
|
5
|
+
require 'spec_helper'
|
6
|
+
|
7
|
+
RSpec.describe 'Create extension' do
|
8
|
+
include FileUtils
|
9
|
+
|
10
|
+
let(:gem_root) { File.expand_path('../..', __dir__) }
|
11
|
+
let(:solidus_cmd) { "#{gem_root}/exe/solidus" }
|
12
|
+
let(:extension_name) { 'test_extension' }
|
13
|
+
let(:gemspec_name) { "solidus_#{extension_name}.gemspec" }
|
14
|
+
let(:tmp_path) { Pathname.new(gem_root).join('tmp') }
|
15
|
+
let(:install_path) { tmp_path.join("solidus_#{extension_name}") }
|
16
|
+
|
17
|
+
class CommandFailed < StandardError; end
|
18
|
+
|
19
|
+
before do
|
20
|
+
rm_rf(install_path)
|
21
|
+
mkdir_p(tmp_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'checks the create extension process' do
|
25
|
+
check_solidus_cmd
|
26
|
+
check_create_extension
|
27
|
+
check_bundle_install
|
28
|
+
check_default_task
|
29
|
+
check_run_specs
|
30
|
+
check_sandbox
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def check_solidus_cmd
|
36
|
+
cd(tmp_path) do
|
37
|
+
output = `#{solidus_cmd} -h`
|
38
|
+
expect($?).to be_success
|
39
|
+
expect(output).to include('Commands:')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def check_create_extension
|
44
|
+
cd(tmp_path) do
|
45
|
+
output = `#{solidus_cmd} extension #{extension_name}`
|
46
|
+
expect($?).to be_success
|
47
|
+
expect(output).to include(gemspec_name)
|
48
|
+
expect(output).to include('.circleci')
|
49
|
+
end
|
50
|
+
|
51
|
+
cd(install_path) do
|
52
|
+
aggregate_failures do
|
53
|
+
%w[
|
54
|
+
bin/console
|
55
|
+
bin/rails
|
56
|
+
bin/rails-engine
|
57
|
+
bin/rails-sandbox
|
58
|
+
bin/sandbox
|
59
|
+
bin/setup
|
60
|
+
].each do |bin|
|
61
|
+
bin = Pathname(bin)
|
62
|
+
expect(
|
63
|
+
name: bin,
|
64
|
+
exist: bin.exist?,
|
65
|
+
executable: bin.stat.executable?
|
66
|
+
).to eq(
|
67
|
+
name: bin,
|
68
|
+
exist: true,
|
69
|
+
executable: true
|
70
|
+
)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def check_bundle_install
|
77
|
+
cd(install_path) do
|
78
|
+
open('Gemfile', 'a') { |f| f.puts "gem 'solidus_dev_support', path: '../../..'" }
|
79
|
+
end
|
80
|
+
|
81
|
+
expect { bundle_install }.to raise_error(CommandFailed, /invalid gemspec/)
|
82
|
+
|
83
|
+
# Update gemspec with the required fields
|
84
|
+
gemspec_path = install_path.join(gemspec_name)
|
85
|
+
gemspec = gemspec_path.read.lines
|
86
|
+
gemspec.grep(/spec\.author/).first.replace(" spec.author = 'John Doe'\n")
|
87
|
+
gemspec.grep(/spec\.email/).first.replace(" spec.email = 'john@example.com'\n")
|
88
|
+
gemspec.grep(/spec\.summary/).first.replace(" spec.summary = 'A nice extension'\n")
|
89
|
+
gemspec.grep(/spec\.description/).first.replace(" spec.description = 'A super nice extension'\n")
|
90
|
+
gemspec_path.write(gemspec.join)
|
91
|
+
|
92
|
+
expect(bundle_install).to match(/Bundle complete/)
|
93
|
+
end
|
94
|
+
|
95
|
+
def check_default_task
|
96
|
+
cd(install_path) do
|
97
|
+
output = sh('bin/rake')
|
98
|
+
expect(output).to include('Generating dummy Rails application')
|
99
|
+
expect(output).to include('0 examples, 0 failures')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def check_run_specs
|
104
|
+
install_path.join('spec', 'some_spec.rb').write(
|
105
|
+
"require 'spec_helper'\nRSpec.describe 'Some test' do it { expect(true).to be_truthy } end\n"
|
106
|
+
)
|
107
|
+
cd(install_path) do
|
108
|
+
output = sh('bundle exec rspec')
|
109
|
+
expect(output).to include('1 example, 0 failures')
|
110
|
+
expect(output).to include(ENV['CODECOV_TOKEN'] ? 'Coverage reports upload successfully' : 'Provide a CODECOV_TOKEN environment variable to enable Codecov uploads')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def check_sandbox
|
115
|
+
cd(install_path) do
|
116
|
+
# rubocop:disable Lint/InterpolationCheck
|
117
|
+
command = 'bin/rails-sandbox runner "puts %{The version of SolidusTestExtension is #{SolidusTestExtension::VERSION}}"'
|
118
|
+
# rubocop:enable Lint/InterpolationCheck
|
119
|
+
|
120
|
+
first_run_output = sh(command)
|
121
|
+
expect(first_run_output).to include("Creating the sandbox app...")
|
122
|
+
expect(first_run_output).to include('The version of SolidusTestExtension is 0.0.1')
|
123
|
+
|
124
|
+
second_run_output = sh(command)
|
125
|
+
expect(second_run_output).not_to include("Creating the sandbox app...")
|
126
|
+
expect(second_run_output).to include('The version of SolidusTestExtension is 0.0.1')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def sh(*args)
|
131
|
+
command = args.size == 1 ? args.first : args.shelljoin
|
132
|
+
output, status = with_unbundled_env { Open3.capture2e(command) }
|
133
|
+
|
134
|
+
if status.success?
|
135
|
+
output.to_s
|
136
|
+
else
|
137
|
+
if $DEBUG
|
138
|
+
warn '~' * 80
|
139
|
+
warn "$ #{command}"
|
140
|
+
warn output.to_s
|
141
|
+
end
|
142
|
+
raise(CommandFailed, "command failed: #{command}\n#{output}")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def with_unbundled_env(&block)
|
147
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
148
|
+
Bundler.with_unbundled_env(&block)
|
149
|
+
else
|
150
|
+
Bundler.with_clean_env(&block)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def bundle_install
|
155
|
+
# Optimize the bundle path within the CI, in this context using bundler env
|
156
|
+
# variables doesn't help because commands are run with a clean env.
|
157
|
+
bundle_path = "#{gem_root}/vendor/bundle"
|
158
|
+
|
159
|
+
command = 'bundle install'
|
160
|
+
command += " --path=#{bundle_path.shellescape}" if File.exist?(bundle_path)
|
161
|
+
|
162
|
+
output = nil
|
163
|
+
cd(install_path) { output = sh command }
|
164
|
+
output
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'solidus_dev_support/extension'
|
2
|
+
|
3
|
+
RSpec.describe SolidusDevSupport::Extension do
|
4
|
+
describe '#default_homepage' do
|
5
|
+
before do
|
6
|
+
expect(subject).to receive(:git).with('remote get-url origin', any_args).and_return(remote)
|
7
|
+
expect(subject).to receive(:github_user).and_return('[USERNAME]')
|
8
|
+
expect(subject).to receive(:file_name).and_return('solidus_foo_bar')
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'with a git ssh-style remote' do
|
12
|
+
let(:remote) { 'git@github.com:solidusio-contrib/solidus_extension_dev_tools.git' }
|
13
|
+
|
14
|
+
it 'generates a github home page value' do
|
15
|
+
expect(subject.default_homepage).to eq('https://github.com/solidusio-contrib/solidus_extension_dev_tools')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'with a git https remote' do
|
20
|
+
let(:remote) { 'https://github.com/solidusio-contrib/solidus_extension_dev_tools.git' }
|
21
|
+
|
22
|
+
it 'generates a github home page value' do
|
23
|
+
expect(subject.default_homepage).to eq('https://github.com/solidusio-contrib/solidus_extension_dev_tools')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#default_gemspec' do
|
29
|
+
it 'has a changelog_uri' do
|
30
|
+
expect(subject.default_gemspec.metadata['changelog_uri']).to end_with('/releases')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "solidus_dev_support"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
# Enable flags like --only-failures and --next-failure
|
8
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
9
|
+
|
10
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
11
|
+
config.disable_monkey_patching!
|
12
|
+
|
13
|
+
config.expect_with :rspec do |c|
|
14
|
+
c.syntax = :expect
|
15
|
+
end
|
16
|
+
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.
|
4
|
+
version: 1.6.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-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apparition
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: '0.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: database_cleaner
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,47 +151,47 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '4.3'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: rspec_junit_formatter
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: rspec-rails
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 4.0.0.beta3
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 4.0.0.beta3
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rubocop
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.
|
187
|
+
version: 0.87.1
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.
|
194
|
+
version: 0.87.1
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: rubocop-performance
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -354,29 +354,36 @@ files:
|
|
354
354
|
- lib/solidus_dev_support/testing_support/preferences.rb
|
355
355
|
- lib/solidus_dev_support/version.rb
|
356
356
|
- solidus_dev_support.gemspec
|
357
|
+
- spec/features/create_extension_spec.rb
|
358
|
+
- spec/lib/extension_spec.rb
|
359
|
+
- spec/spec_helper.rb
|
357
360
|
homepage: https://github.com/solidusio/solidus_dev_support
|
358
361
|
licenses:
|
359
362
|
- MIT
|
360
363
|
metadata:
|
361
364
|
homepage_uri: https://github.com/solidusio/solidus_dev_support
|
362
365
|
source_code_uri: https://github.com/solidusio/solidus_dev_support
|
366
|
+
changelog_uri: https://github.com/solidusio/solidus_dev_support/blob/master/CHANGELOG.md
|
363
367
|
post_install_message:
|
364
368
|
rdoc_options: []
|
365
369
|
require_paths:
|
366
370
|
- lib
|
367
371
|
required_ruby_version: !ruby/object:Gem::Requirement
|
368
372
|
requirements:
|
369
|
-
- - "
|
373
|
+
- - "~>"
|
370
374
|
- !ruby/object:Gem::Version
|
371
|
-
version: '
|
375
|
+
version: '2.5'
|
372
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
373
377
|
requirements:
|
374
378
|
- - ">="
|
375
379
|
- !ruby/object:Gem::Version
|
376
380
|
version: '0'
|
377
381
|
requirements: []
|
378
|
-
rubygems_version: 3.
|
382
|
+
rubygems_version: 3.1.4
|
379
383
|
signing_key:
|
380
384
|
specification_version: 4
|
381
385
|
summary: Development tools for Solidus extensions.
|
382
|
-
test_files:
|
386
|
+
test_files:
|
387
|
+
- spec/features/create_extension_spec.rb
|
388
|
+
- spec/lib/extension_spec.rb
|
389
|
+
- spec/spec_helper.rb
|