Skip to content

Commit 8e4c497

Browse files
authored
Merge pull request #151 from solidusio-contrib/kennyadsl/allow-solidus-4
Make the extension compatible with Solidus 4
2 parents 7072482 + ceeeedb commit 8e4c497

36 files changed

+446
-248
lines changed

Diff for: .circleci/config.yml

+48-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
11
version: 2.1
22

33
orbs:
4+
# Required for feature specs.
5+
browser-tools: circleci/[email protected]
6+
47
# Always take the latest version of the orb, this allows us to
58
# run specs against Solidus supported versions only without the need
69
# to change this configuration every time a Solidus version is released
710
# or goes EOL.
811
solidusio_extensions: solidusio/extensions@volatile
912

1013
jobs:
11-
run-specs-with-postgres:
12-
executor: solidusio_extensions/postgres
14+
run-specs:
15+
parameters:
16+
solidus:
17+
type: string
18+
default: main
19+
db:
20+
type: string
21+
default: "postgres"
22+
ruby:
23+
type: string
24+
default: "3.2"
25+
executor:
26+
name: solidusio_extensions/<< parameters.db >>
27+
ruby_version: << parameters.ruby >>
1328
steps:
14-
- solidusio_extensions/run-tests
15-
run-specs-with-mysql:
16-
executor: solidusio_extensions/mysql
29+
- checkout
30+
- browser-tools/install-chrome
31+
- solidusio_extensions/run-tests-solidus-<< parameters.solidus >>
32+
33+
lint-code:
34+
executor:
35+
name: solidusio_extensions/sqlite
36+
ruby_version: "3.0"
1737
steps:
18-
- solidusio_extensions/run-tests
38+
- solidusio_extensions/lint-code
1939

2040
workflows:
2141
"Run specs on supported Solidus versions":
2242
jobs:
23-
- run-specs-with-postgres
24-
- run-specs-with-mysql
43+
- run-specs:
44+
name: &name "run-specs-solidus-<< matrix.solidus >>-ruby-<< matrix.ruby >>-db-<< matrix.db >>"
45+
matrix:
46+
parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
47+
- run-specs:
48+
name: *name
49+
matrix:
50+
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
51+
- run-specs:
52+
name: *name
53+
matrix:
54+
parameters: { solidus: ["older"], ruby: ["3.0"], db: ["sqlite"] }
55+
- lint-code
56+
2557
"Weekly run specs against master":
2658
triggers:
2759
- schedule:
@@ -31,5 +63,11 @@ workflows:
3163
only:
3264
- master
3365
jobs:
34-
- run-specs-with-postgres
35-
- run-specs-with-mysql
66+
- run-specs:
67+
name: *name
68+
matrix:
69+
parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
70+
- run-specs:
71+
name: *name
72+
matrix:
73+
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }

Diff for: .github/stale.yml

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
# Number of days of inactivity before an issue becomes stale
2-
daysUntilStale: 60
3-
# Number of days of inactivity before a stale issue is closed
4-
daysUntilClose: 7
5-
# Issues with these labels will never be considered stale
6-
exemptLabels:
7-
- pinned
8-
- security
9-
# Label to use when marking an issue as stale
10-
staleLabel: wontfix
11-
# Comment to post when marking an issue as stale. Set to `false` to disable
12-
markComment: >
13-
This issue has been automatically marked as stale because it has not had
14-
recent activity. It will be closed if no further activity occurs. Thank you
15-
for your contributions.
16-
# Comment to post when closing a stale issue. Set to `false` to disable
17-
closeComment: false
1+
_extends: .github

Diff for: .github_changelog_generator

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
issues=false
2+
exclude-labels=infrastructure

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88
.sass-cache
99
coverage
1010
Gemfile.lock
11+
Gemfile-local
1112
tmp
1213
nbproject
1314
pkg
1415
*.swp
1516
spec/dummy
1617
spec/examples.txt
18+
/sandbox
19+
.rvmrc
20+
.ruby-version
21+
.ruby-gemset

Diff for: .rubocop.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
inherit_from: .rubocop_todo.yml
2+
13
require:
24
- solidus_dev_support/rubocop
35

4-
Rails/SkipsModelValidations:
5-
Exclude:
6-
- db/migrate/**/*
6+
AllCops:
7+
NewCops: disable

Diff for: .rubocop_todo.yml

+50-45
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,60 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2019-11-14 12:59:11 +0100 using RuboCop version 0.76.0.
3+
# on 2023-05-23 11:06:18 UTC using RuboCop version 1.51.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

99
# Offense count: 1
10-
Lint/AmbiguousBlockAssociation:
10+
Capybara/VisibilityMatcher:
1111
Exclude:
12-
- 'spec/features/admin/translations_spec.rb'
12+
- 'spec/features/admin/products_spec.rb'
1313

1414
# Offense count: 1
15-
Lint/BooleanSymbol:
15+
# Configuration parameters: Severity, Include.
16+
# Include: **/*.gemspec
17+
Gemspec/RequiredRubyVersion:
1618
Exclude:
17-
- 'db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb'
19+
- 'solidus_globalize.gemspec'
1820

19-
# Offense count: 3
20-
# Cop supports --auto-correct.
21-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
22-
# URISchemes: http, https
23-
Metrics/LineLength:
24-
Max: 196
21+
# Offense count: 1
22+
# This cop supports safe autocorrection (--autocorrect).
23+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
24+
Layout/ExtraSpacing:
25+
Exclude:
26+
- 'app/models/concerns/solidus_globalize/translatable.rb'
27+
28+
# Offense count: 1
29+
# This cop supports safe autocorrection (--autocorrect).
30+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
31+
# SupportedStylesForExponentOperator: space, no_space
32+
Layout/SpaceAroundOperators:
33+
Exclude:
34+
- 'app/models/concerns/solidus_globalize/translatable.rb'
2535

26-
# Offense count: 18
27-
# Configuration parameters: Prefixes.
36+
# Offense count: 20
37+
# Configuration parameters: Prefixes, AllowedPatterns.
2838
# Prefixes: when, with, without
2939
RSpec/ContextWording:
3040
Exclude:
41+
- 'spec/controllers/spree/admin/translations_controller_spec.rb'
3142
- 'spec/controllers/spree/products_controller_spec.rb'
3243
- 'spec/features/admin/products_spec.rb'
3344
- 'spec/features/admin/translations_spec.rb'
3445
- 'spec/features/translations_spec.rb'
3546
- 'spec/models/product_spec.rb'
3647
- 'spec/support/shared_contexts/translatable_context.rb'
3748

38-
# Offense count: 3
39-
RSpec/DescribeClass:
49+
# Offense count: 4
50+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
51+
# Include: **/*_spec*rb*, **/spec/**/*
52+
RSpec/FilePath:
4053
Exclude:
41-
- 'spec/features/admin/products_spec.rb'
42-
- 'spec/features/admin/translations_spec.rb'
43-
- 'spec/features/translations_spec.rb'
54+
- 'spec/models/product_property_spec.rb'
55+
- 'spec/models/product_spec.rb'
56+
- 'spec/models/shipping_method_spec.rb'
57+
- 'spec/models/taxon_spec.rb'
4458

4559
# Offense count: 9
4660
RSpec/LetSetup:
@@ -50,42 +64,33 @@ RSpec/LetSetup:
5064
- 'spec/features/translations_spec.rb'
5165
- 'spec/models/taxon_spec.rb'
5266

53-
# Offense count: 9
54-
# Configuration parameters: AggregateFailuresByDefault.
67+
# Offense count: 1
68+
RSpec/MultipleDescribes:
69+
Exclude:
70+
- 'spec/models/translated_models_spec.rb'
71+
72+
# Offense count: 10
5573
RSpec/MultipleExpectations:
56-
Max: 3
74+
Max: 4
5775

5876
# Offense count: 2
59-
# Configuration parameters: IgnoreSharedExamples.
77+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
78+
# SupportedStyles: always, named_only
6079
RSpec/NamedSubject:
6180
Exclude:
6281
- 'spec/models/product_property_spec.rb'
6382
- 'spec/support/shared_contexts/translatable_context.rb'
6483

6584
# Offense count: 1
6685
# Configuration parameters: Include.
67-
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
68-
Rails/Output:
86+
# Include: db/migrate/*.rb
87+
Rails/NotNullColumn:
6988
Exclude:
70-
- 'lib/generators/solidus_globalize/install/install_generator.rb'
71-
72-
# Offense count: 1
73-
# Cop supports --auto-correct.
74-
# Configuration parameters: EnforcedStyle.
75-
# SupportedStyles: always, never
76-
Style/FrozenStringLiteralComment:
77-
Exclude:
78-
- 'spec/support/shared_contexts/translatable_context.rb'
89+
- 'db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb'
7990

80-
# Offense count: 8
81-
# Configuration parameters: MinBodyLength.
82-
Style/GuardClause:
83-
Exclude:
84-
- 'db/migrate/20130419041407_add_translations_to_main_models.rb'
85-
- 'db/migrate/20130518224827_add_translations_to_product_permalink.rb'
86-
- 'db/migrate/20131009091000_add_translations_to_option_value.rb'
87-
- 'db/migrate/20140206202524_rename_activator_translations_to_promotion_translations.rb'
88-
- 'db/migrate/20140219130603_update_spree_product_translations.rb'
89-
- 'db/migrate/20141112121313_add_translations_to_product_properties.rb'
90-
- 'db/migrate/20150224152415_add_deleted_at_to_translation_tables.rb'
91-
- 'db/migrate/20150323210949_add_translations_to_store.rb'
91+
# Offense count: 2
92+
# This cop supports safe autocorrection (--autocorrect).
93+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
94+
# URISchemes: http, https
95+
Layout/LineLength:
96+
Max: 128

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

Diff for: Gemfile

+12-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
source 'https://rubygems.org'
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7-
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
8-
%w[solidusio/solidus solidusio/solidus_frontend]
9-
else
10-
%w[solidusio/solidus] * 2
11-
end
12-
gem 'solidus', github: solidus_git, branch: branch
13-
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
6+
branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
7+
gem 'solidus', github: 'solidusio/solidus', branch: branch
8+
9+
# The solidus_frontend gem has been pulled out since v3.2
10+
if branch >= 'v3.2'
11+
gem 'solidus_frontend'
12+
elsif branch == 'main'
13+
gem 'solidus_frontend', github: 'solidusio/solidus_frontend'
14+
else
15+
gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch
16+
end
1417

1518
# Needed to help Bundler figure out how to resolve dependencies,
1619
# otherwise it takes forever to resolve them.
@@ -20,6 +23,7 @@ gem 'rails', '>0.a'
2023
# Provides basic authentication functionality for testing parts of your engine
2124
# gem 'solidus_auth_devise'
2225

26+
gem 'friendly_id-globalize', github: 'norman/friendly_id-globalize', branch: "master"
2327
gem 'routing-filter'
2428

2529
case ENV['DB']

0 commit comments

Comments
 (0)