solidus_volume_pricing 1.0.0 → 1.1.1
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 +50 -12
- data/.gem_release.yml +5 -0
- data/.github/dependabot.yml +7 -0
- data/.github/stale.yml +1 -0
- data/.github_changelog_generator +2 -0
- data/.gitignore +15 -7
- data/.rspec +1 -2
- data/.rubocop.yml +2 -7
- data/.rubocop_todo.yml +18 -76
- data/CHANGELOG.md +1 -55
- data/Gemfile +26 -12
- data/{LICENSE.md → LICENSE} +2 -2
- data/OLD_CHANGELOG.md +86 -0
- data/README.md +5 -5
- data/Rakefile +4 -19
- data/app/controllers/spree/admin/volume_price_models_controller.rb +1 -1
- data/app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb +6 -4
- data/app/models/spree/volume_price.rb +41 -41
- data/app/models/spree/volume_price_model.rb +9 -7
- data/app/views/spree/admin/volume_prices/_volume_price_fields.html.erb +5 -3
- data/bin/console +17 -0
- data/bin/rails +5 -6
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/rake +7 -0
- data/bin/sandbox +78 -0
- data/bin/setup +8 -0
- data/db/migrate/20150603143015_create_spree_volume_price_models.rb +1 -0
- data/lib/generators/solidus_volume_pricing/install/install_generator.rb +8 -4
- data/lib/solidus_volume_pricing/engine.rb +13 -3
- data/{spec/factories/volume_price_factory.rb → lib/solidus_volume_pricing/testing_support/factories.rb} +2 -2
- data/lib/solidus_volume_pricing/version.rb +1 -16
- data/lib/solidus_volume_pricing.rb +1 -0
- data/solidus_volume_pricing.gemspec +38 -29
- data/spec/controllers/spree/admin/variants_controller_spec.rb +1 -1
- data/spec/features/manage_volume_price_models_feature_spec.rb +3 -7
- data/spec/features/manage_volume_prices_feature_spec.rb +6 -7
- data/spec/lib/solidus_volume_pricing/range_from_string_spec.rb +2 -2
- data/spec/models/solidus_volume_pricing/pricer_spec.rb +0 -4
- data/spec/models/spree/line_item_spec.rb +0 -1
- data/spec/models/spree/volume_price_spec.rb +1 -10
- data/spec/spec_helper.rb +26 -5
- metadata +98 -30
- data/app/decorators/models/solidus_volume_pricing/spree/user_decorator.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4860d509fe7eac365878042f66055496fcd28cf4eec93c4b9ec608c77270c51
|
4
|
+
data.tar.gz: d53e5dcc7f6c5508b1e3f195a95c6b44d99b6d3ffdf480daeea86d27341b81c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a2c166baa55ca052a30926ca44f53070b7630c8ef193e3136c3d975181f8d48967202291ce4b50e0d1d18cbcda1d1bfb00d7c2abf067536cc90faeb24e5c95
|
7
|
+
data.tar.gz: a687a9d5bf1f547f9a6fcf858c2d2e84dde9858ffabd4b71d4283f2738aed3c3f93ce22988b9686a859fcb6d72c0e688c00884af201c1d965e39803759a0fd8d
|
data/.circleci/config.yml
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
version: 2.1
|
2
2
|
|
3
3
|
orbs:
|
4
|
+
# Required for feature specs.
|
5
|
+
browser-tools: circleci/browser-tools@1.1
|
6
|
+
|
4
7
|
# Always take the latest version of the orb, this allows us to
|
5
8
|
# run specs against Solidus supported versions only without the need
|
6
9
|
# to change this configuration every time a Solidus version is released
|
@@ -8,28 +11,63 @@ orbs:
|
|
8
11
|
solidusio_extensions: solidusio/extensions@volatile
|
9
12
|
|
10
13
|
jobs:
|
11
|
-
run-specs
|
12
|
-
|
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 >>
|
13
28
|
steps:
|
14
|
-
-
|
15
|
-
|
16
|
-
|
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"
|
17
37
|
steps:
|
18
|
-
- solidusio_extensions/
|
38
|
+
- solidusio_extensions/lint-code
|
19
39
|
|
20
40
|
workflows:
|
21
41
|
"Run specs on supported Solidus versions":
|
22
42
|
jobs:
|
23
|
-
- run-specs
|
24
|
-
|
25
|
-
|
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
|
+
|
57
|
+
"Weekly run specs against main":
|
26
58
|
triggers:
|
27
59
|
- schedule:
|
28
60
|
cron: "0 0 * * 4" # every Thursday
|
29
61
|
filters:
|
30
62
|
branches:
|
31
63
|
only:
|
32
|
-
-
|
64
|
+
- main
|
33
65
|
jobs:
|
34
|
-
- run-specs
|
35
|
-
|
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"] }
|
data/.gem_release.yml
ADDED
data/.github/stale.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
_extends: .github
|
data/.gitignore
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
*.gem
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
\#*
|
3
|
+
*~
|
4
|
+
.#*
|
5
5
|
.DS_Store
|
6
|
+
.idea
|
7
|
+
.project
|
8
|
+
.sass-cache
|
9
|
+
coverage
|
6
10
|
Gemfile.lock
|
7
|
-
|
11
|
+
Gemfile-local
|
12
|
+
tmp
|
13
|
+
nbproject
|
14
|
+
pkg
|
15
|
+
*.swp
|
8
16
|
spec/dummy
|
9
|
-
|
17
|
+
spec/examples.txt
|
18
|
+
/sandbox
|
10
19
|
.rvmrc
|
11
20
|
.ruby-version
|
12
21
|
.ruby-gemset
|
13
|
-
|
14
|
-
spec/examples.txt
|
22
|
+
.byebug*
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
3
|
require:
|
4
|
-
-
|
5
|
-
|
6
|
-
inherit_gem:
|
7
|
-
solidus_extension_dev_tools: .rubocop.extension.yml
|
4
|
+
- solidus_dev_support/rubocop
|
8
5
|
|
9
6
|
AllCops:
|
10
|
-
|
11
|
-
- spec/dummy/**/*
|
12
|
-
- vendor/**/*
|
7
|
+
NewCops: disable
|
data/.rubocop_todo.yml
CHANGED
@@ -1,49 +1,24 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-05-12 15:47:30 UTC using RuboCop version 1.50.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters:
|
11
|
-
# Include: **/*.gemspec,
|
12
|
-
Gemspec/RequiredRubyVersion:
|
13
|
-
Exclude:
|
14
|
-
- 'solidus_volume_pricing.gemspec'
|
15
|
-
|
16
|
-
# Offense count: 2
|
17
|
-
Lint/InterpolationCheck:
|
18
|
-
Exclude:
|
19
|
-
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
20
|
-
|
21
|
-
# Offense count: 21
|
22
|
-
# Cop supports --auto-correct.
|
23
|
-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
24
|
-
# URISchemes: http, https
|
25
|
-
Metrics/LineLength:
|
26
|
-
Max: 160
|
27
|
-
|
28
|
-
# Offense count: 43
|
29
|
-
# Configuration parameters: Prefixes.
|
9
|
+
# Offense count: 42
|
10
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
30
11
|
# Prefixes: when, with, without
|
31
12
|
RSpec/ContextWording:
|
32
13
|
Exclude:
|
33
|
-
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
|
34
14
|
- 'spec/helpers/base_helper_spec.rb'
|
35
15
|
- 'spec/models/solidus_volume_pricing/pricer_spec.rb'
|
36
16
|
- 'spec/models/spree/order_spec.rb'
|
37
17
|
- 'spec/models/spree/volume_price_spec.rb'
|
38
18
|
|
39
|
-
# Offense count: 2
|
40
|
-
RSpec/DescribeClass:
|
41
|
-
Exclude:
|
42
|
-
- 'spec/features/manage_volume_price_models_feature_spec.rb'
|
43
|
-
- 'spec/features/manage_volume_prices_feature_spec.rb'
|
44
|
-
|
45
19
|
# Offense count: 1
|
46
|
-
# Configuration parameters: CustomTransform, IgnoreMethods.
|
20
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
21
|
+
# Include: **/*_spec*rb*, **/spec/**/*
|
47
22
|
RSpec/FilePath:
|
48
23
|
Exclude:
|
49
24
|
- 'spec/helpers/base_helper_spec.rb'
|
@@ -56,12 +31,17 @@ RSpec/InstanceVariable:
|
|
56
31
|
- 'spec/models/spree/order_spec.rb'
|
57
32
|
|
58
33
|
# Offense count: 5
|
59
|
-
# Configuration parameters: AggregateFailuresByDefault.
|
60
34
|
RSpec/MultipleExpectations:
|
61
35
|
Max: 3
|
62
36
|
|
63
|
-
# Offense count:
|
64
|
-
# Configuration parameters:
|
37
|
+
# Offense count: 82
|
38
|
+
# Configuration parameters: AllowSubject.
|
39
|
+
RSpec/MultipleMemoizedHelpers:
|
40
|
+
Max: 8
|
41
|
+
|
42
|
+
# Offense count: 57
|
43
|
+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
44
|
+
# SupportedStyles: always, named_only
|
65
45
|
RSpec/NamedSubject:
|
66
46
|
Exclude:
|
67
47
|
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
@@ -70,57 +50,19 @@ RSpec/NamedSubject:
|
|
70
50
|
- 'spec/models/spree/volume_price_spec.rb'
|
71
51
|
|
72
52
|
# Offense count: 74
|
53
|
+
# Configuration parameters: AllowedGroups.
|
73
54
|
RSpec/NestedGroups:
|
74
55
|
Max: 7
|
75
56
|
|
76
|
-
# Offense count:
|
77
|
-
|
78
|
-
# Include: db/migrate/*.rb
|
79
|
-
Rails/CreateTableWithTimestamps:
|
80
|
-
Exclude:
|
81
|
-
- 'db/migrate/20150603143015_create_spree_volume_price_models.rb'
|
82
|
-
|
83
|
-
# Offense count: 1
|
84
|
-
# Configuration parameters: Include.
|
85
|
-
# Include: app/models/**/*.rb
|
86
|
-
Rails/HasManyOrHasOneDependent:
|
57
|
+
# Offense count: 2
|
58
|
+
RSpec/RepeatedExampleGroupDescription:
|
87
59
|
Exclude:
|
88
|
-
- '
|
60
|
+
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
89
61
|
|
90
62
|
# Offense count: 2
|
91
|
-
# Configuration parameters: Include.
|
63
|
+
# Configuration parameters: IgnoreScopes, Include.
|
92
64
|
# Include: app/models/**/*.rb
|
93
65
|
Rails/InverseOf:
|
94
66
|
Exclude:
|
95
67
|
- 'app/models/spree/volume_price.rb'
|
96
68
|
- 'app/models/spree/volume_price_model.rb'
|
97
|
-
|
98
|
-
# Offense count: 1
|
99
|
-
# Configuration parameters: Include.
|
100
|
-
# Include: app/controllers/**/*.rb
|
101
|
-
Rails/LexicallyScopedActionFilter:
|
102
|
-
Exclude:
|
103
|
-
- 'app/controllers/spree/admin/volume_price_models_controller.rb'
|
104
|
-
|
105
|
-
# Offense count: 1
|
106
|
-
# Configuration parameters: Include.
|
107
|
-
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
|
108
|
-
Rails/Output:
|
109
|
-
Exclude:
|
110
|
-
- 'lib/generators/solidus_volume_pricing/install/install_generator.rb'
|
111
|
-
|
112
|
-
# Offense count: 2
|
113
|
-
# Configuration parameters: Blacklist, Whitelist.
|
114
|
-
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
115
|
-
Rails/SkipsModelValidations:
|
116
|
-
Exclude:
|
117
|
-
- 'spec/models/spree/volume_price_spec.rb'
|
118
|
-
|
119
|
-
# Offense count: 2
|
120
|
-
# Cop supports --auto-correct.
|
121
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
122
|
-
# SupportedStyles: nested, compact
|
123
|
-
Style/ClassAndModuleChildren:
|
124
|
-
Exclude:
|
125
|
-
- 'app/models/spree/volume_price.rb'
|
126
|
-
- 'app/models/spree/volume_price_model.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,57 +1,3 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v0.2.1...v1.0.0)
|
6
|
-
|
7
|
-
**Implemented enhancements:**
|
8
|
-
|
9
|
-
- Replace `I18n.t` with `t` in views [\#22](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/22)
|
10
|
-
|
11
|
-
**Closed issues:**
|
12
|
-
|
13
|
-
- can we create packs of product by this ? [\#13](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/13)
|
14
|
-
- Rails v 5.0.1 [\#8](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/8)
|
15
|
-
|
16
|
-
**Merged pull requests:**
|
17
|
-
|
18
|
-
- Replace I18n.t with t in views [\#34](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/34) ([aldesantis](https://github.com/aldesantis))
|
19
|
-
- Reformat readme [\#33](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/33) ([aldesantis](https://github.com/aldesantis))
|
20
|
-
- Adopt solidus\_extension\_dev\_tools [\#32](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/32) ([aldesantis](https://github.com/aldesantis))
|
21
|
-
- Switch to sassc/rails [\#30](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/30) ([pelargir](https://github.com/pelargir))
|
22
|
-
- Update pg requirement from ~\> 0.21 to ~\> 1.1 [\#27](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/27) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
23
|
-
- Update coffee-rails requirement from ~\> 4.0 to ~\> 5.0 [\#26](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/26) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
24
|
-
- Adopt CircleCI instead of Travis [\#23](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/23) ([aldesantis](https://github.com/aldesantis))
|
25
|
-
- Solidus 2.4 UI updates [\#21](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/21) ([tvdeyen](https://github.com/tvdeyen))
|
26
|
-
- Test suite maintenance [\#20](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/20) ([aitbw](https://github.com/aitbw))
|
27
|
-
- Remove 2.2 from CI \(EOL\) [\#19](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/19) ([jacobherrington](https://github.com/jacobherrington))
|
28
|
-
- Remove versions past EOL from .travis.yml [\#17](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/17) ([jacobherrington](https://github.com/jacobherrington))
|
29
|
-
- Add Solidus 2.1-2.7 to .travis.yml [\#16](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/16) ([jacobherrington](https://github.com/jacobherrington))
|
30
|
-
- Remove deprecated icon option from button [\#12](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/12) ([pelargir](https://github.com/pelargir))
|
31
|
-
- V2.1 [\#11](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/11) ([seand7565](https://github.com/seand7565))
|
32
|
-
- Role fix [\#9](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/9) ([Senjai](https://github.com/Senjai))
|
33
|
-
- 1.0 fixes [\#7](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/7) ([tvdeyen](https://github.com/tvdeyen))
|
34
|
-
- Add pricers to calculate volume prices [\#4](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/4) ([tvdeyen](https://github.com/tvdeyen))
|
35
|
-
- Remove String monkey patch [\#3](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/3) ([tvdeyen](https://github.com/tvdeyen))
|
36
|
-
|
37
|
-
## [v0.2.1](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v0.2.1) (2017-01-20)
|
38
|
-
|
39
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v0.1.1...v0.2.1)
|
40
|
-
|
41
|
-
**Merged pull requests:**
|
42
|
-
|
43
|
-
- 0.2 fixes [\#6](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/6) ([tvdeyen](https://github.com/tvdeyen))
|
44
|
-
- Solidus 1.3 [\#2](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/2) ([tvdeyen](https://github.com/tvdeyen))
|
45
|
-
|
46
|
-
## [v0.1.1](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v0.1.1) (2017-01-20)
|
47
|
-
|
48
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/9bcf78426749d2d73878c6c7c8eb3bf0e5747ada...v0.1.1)
|
49
|
-
|
50
|
-
**Merged pull requests:**
|
51
|
-
|
52
|
-
- 0.1 fixes [\#5](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/5) ([tvdeyen](https://github.com/tvdeyen))
|
53
|
-
- Rename to solidus [\#1](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/1) ([tvdeyen](https://github.com/tvdeyen))
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
3
|
+
See https://github.com/solidusio/solidus_volume_pricing/releases or [OLD_CHANGELOG.md](OLD_CHANGELOG.md) for older versions.
|
data/Gemfile
CHANGED
@@ -1,27 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
4
5
|
|
5
|
-
branch = ENV.fetch('SOLIDUS_BRANCH', '
|
6
|
-
gem 'solidus',
|
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
|
+
gem 'solidus_frontend'
|
7
11
|
|
8
12
|
# Needed to help Bundler figure out how to resolve dependencies,
|
9
|
-
# otherwise it takes forever to resolve them
|
10
|
-
|
11
|
-
|
12
|
-
else
|
13
|
-
gem 'rails', '~> 5.2'
|
14
|
-
end
|
13
|
+
# otherwise it takes forever to resolve them.
|
14
|
+
# See https://github.com/bundler/bundler/issues/6677
|
15
|
+
gem 'rails', '>0.a'
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
# Provides basic authentication functionality for testing parts of your engine
|
18
|
+
gem 'solidus_auth_devise'
|
19
|
+
|
20
|
+
case ENV.fetch('DB', nil)
|
19
21
|
when 'mysql'
|
20
22
|
gem 'mysql2'
|
23
|
+
when 'postgresql'
|
24
|
+
gem 'pg'
|
21
25
|
else
|
22
26
|
gem 'sqlite3'
|
23
27
|
end
|
24
28
|
|
25
|
-
|
29
|
+
# While we still support Ruby < 3 we need to workaround a limitation in
|
30
|
+
# the 'async' gem that relies on the latest ruby, since RubyGems doesn't
|
31
|
+
# resolve gems based on the required ruby version.
|
32
|
+
gem 'async', '< 3' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
|
26
33
|
|
27
34
|
gemspec
|
35
|
+
|
36
|
+
# Use a local Gemfile to include development dependencies that might not be
|
37
|
+
# relevant for the project or for other contributors, e.g. pry-byebug.
|
38
|
+
#
|
39
|
+
# We use `send` instead of calling `eval_gemfile` to work around an issue with
|
40
|
+
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
|
41
|
+
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
|
data/{LICENSE.md → LICENSE}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2009-2015 Spree Commerce and contributors
|
1
|
+
Copyright (c) 2009-2015 Spree Commerce and contributors, 2019 Sean Schofield
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -9,7 +9,7 @@ are permitted provided that the following conditions are met:
|
|
9
9
|
* Redistributions in binary form must reproduce the above copyright notice,
|
10
10
|
this list of conditions and the following disclaimer in the documentation
|
11
11
|
and/or other materials provided with the distribution.
|
12
|
-
* Neither the name
|
12
|
+
* Neither the name Solidus nor the names of its contributors may be used to
|
13
13
|
endorse or promote products derived from this software without specific
|
14
14
|
prior written permission.
|
15
15
|
|
data/OLD_CHANGELOG.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v1.1.0](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v1.1.0) (2023-02-09)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v1.0.0...v1.1.0)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Dependabot can't resolve your Ruby dependency files [\#57](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/57)
|
10
|
+
- Prepare Solidus Volume Pricing for Solidus 3.0 [\#53](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/53)
|
11
|
+
- Dependabot can't resolve your Ruby dependency files [\#52](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/52)
|
12
|
+
- Dependabot can't resolve your Ruby dependency files [\#51](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/51)
|
13
|
+
- Role base volume pricing not working [\#47](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/47)
|
14
|
+
- Dependabot couldn't find a Gemfile-local for this project [\#44](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/44)
|
15
|
+
- Dependabot can't resolve your Ruby dependency files [\#42](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/42)
|
16
|
+
- Dependabot can't resolve your Ruby dependency files [\#41](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/41)
|
17
|
+
- Dependabot can't resolve your Ruby dependency files [\#40](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/40)
|
18
|
+
- Dependabot can't resolve your Ruby dependency files [\#39](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/39)
|
19
|
+
- Dependabot can't resolve your Ruby dependency files [\#38](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/38)
|
20
|
+
- Dependabot can't resolve your Ruby dependency files [\#37](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/37)
|
21
|
+
- Dependabot can't resolve your Ruby dependency files [\#36](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/36)
|
22
|
+
- Dependabot can't resolve your Ruby dependency files [\#35](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/35)
|
23
|
+
- Can we get a new release? [\#29](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/29)
|
24
|
+
|
25
|
+
**Merged pull requests:**
|
26
|
+
|
27
|
+
- Update supported ruby version [\#66](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/66) ([mcrisologo](https://github.com/mcrisologo))
|
28
|
+
- Bump version to 1.1.0 [\#65](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/65) ([mcrisologo](https://github.com/mcrisologo))
|
29
|
+
- Update to use forked solidus\_frontend when needed [\#64](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/64) ([waiting-for-dev](https://github.com/waiting-for-dev))
|
30
|
+
- Configure autoloader to ignore decorators [\#61](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/61) ([pelargir](https://github.com/pelargir))
|
31
|
+
- Updating gemspec for Ruby 3 support [\#60](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/60) ([embold-given](https://github.com/embold-given))
|
32
|
+
- Solidus 3 preparation [\#59](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/59) ([cpfergus1](https://github.com/cpfergus1))
|
33
|
+
- Upgrade to GitHub-native Dependabot [\#58](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/58) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
34
|
+
- Relax solidus\_support dependency [\#50](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/50) ([kennyadsl](https://github.com/kennyadsl))
|
35
|
+
- Fix Dependabot looking for Gemfile-local [\#48](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/48) ([aldesantis](https://github.com/aldesantis))
|
36
|
+
- Fix role discounts [\#46](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/46) ([hrdchz](https://github.com/hrdchz))
|
37
|
+
- Rerun dev tools extension update command to improve the structure [\#45](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/45) ([blocknotes](https://github.com/blocknotes))
|
38
|
+
- Upgrade the extension using solidus\_dev\_support [\#43](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/43) ([blocknotes](https://github.com/blocknotes))
|
39
|
+
|
40
|
+
## [v1.0.0](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v1.0.0) (2019-11-23)
|
41
|
+
|
42
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v0.2.1...v1.0.0)
|
43
|
+
|
44
|
+
**Implemented enhancements:**
|
45
|
+
|
46
|
+
- Replace `I18n.t` with `t` in views [\#22](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/22)
|
47
|
+
|
48
|
+
**Closed issues:**
|
49
|
+
|
50
|
+
- can we create packs of product by this ? [\#13](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/13)
|
51
|
+
- Rails v 5.0.1 [\#8](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/8)
|
52
|
+
|
53
|
+
**Merged pull requests:**
|
54
|
+
|
55
|
+
- Replace I18n.t with t in views [\#34](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/34) ([aldesantis](https://github.com/aldesantis))
|
56
|
+
- Reformat readme [\#33](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/33) ([aldesantis](https://github.com/aldesantis))
|
57
|
+
- Adopt solidus\_extension\_dev\_tools [\#32](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/32) ([aldesantis](https://github.com/aldesantis))
|
58
|
+
- Switch to sassc/rails [\#30](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/30) ([pelargir](https://github.com/pelargir))
|
59
|
+
- Update pg requirement from ~\> 0.21 to ~\> 1.1 [\#27](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/27) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
60
|
+
- Update coffee-rails requirement from ~\> 4.0 to ~\> 5.0 [\#26](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/26) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
61
|
+
- Adopt CircleCI instead of Travis [\#23](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/23) ([aldesantis](https://github.com/aldesantis))
|
62
|
+
- Solidus 2.4 UI updates [\#21](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/21) ([tvdeyen](https://github.com/tvdeyen))
|
63
|
+
- Test suite maintenance [\#20](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/20) ([aitbw](https://github.com/aitbw))
|
64
|
+
- Remove 2.2 from CI \(EOL\) [\#19](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/19) ([jacobherrington](https://github.com/jacobherrington))
|
65
|
+
- Remove versions past EOL from .travis.yml [\#17](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/17) ([jacobherrington](https://github.com/jacobherrington))
|
66
|
+
- Add Solidus 2.1-2.7 to .travis.yml [\#16](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/16) ([jacobherrington](https://github.com/jacobherrington))
|
67
|
+
- Remove deprecated icon option from button [\#12](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/12) ([pelargir](https://github.com/pelargir))
|
68
|
+
- V2.1 [\#11](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/11) ([seand7565](https://github.com/seand7565))
|
69
|
+
- Role fix [\#9](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/9) ([Senjai](https://github.com/Senjai))
|
70
|
+
- 1.0 fixes [\#7](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/7) ([tvdeyen](https://github.com/tvdeyen))
|
71
|
+
- Add pricers to calculate volume prices [\#4](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/4) ([tvdeyen](https://github.com/tvdeyen))
|
72
|
+
- Remove String monkey patch [\#3](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/3) ([tvdeyen](https://github.com/tvdeyen))
|
73
|
+
- Solidus 1.3 [\#2](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/2) ([tvdeyen](https://github.com/tvdeyen))
|
74
|
+
- Rename to solidus [\#1](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/1) ([tvdeyen](https://github.com/tvdeyen))
|
75
|
+
|
76
|
+
## [v0.2.1](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v0.2.1) (2017-01-20)
|
77
|
+
|
78
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v0.1.1...v0.2.1)
|
79
|
+
|
80
|
+
## [v0.1.1](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v0.1.1) (2017-01-20)
|
81
|
+
|
82
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/9bcf78426749d2d73878c6c7c8eb3bf0e5747ada...v0.1.1)
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -14,14 +14,14 @@ Each VolumePrice contains the following values:
|
|
14
14
|
|
15
15
|
1. **Variant:** Each VolumePrice is associated with a _Variant_, which is used to link products to
|
16
16
|
particular prices.
|
17
|
-
|
18
|
-
|
17
|
+
2. **Name:** The human readable representation of the quantity range (Ex. 10-100). (Optional)
|
18
|
+
3. **Discount Type** The type of discount to apply. **Price:** sets price to the amount specified.
|
19
19
|
* **Dollar:** subtracts specified amount from the Variant price.
|
20
20
|
* **Percent:** subtracts the specified amounts percentage from the Variant price.
|
21
|
-
|
21
|
+
4. **Range:** The quantity range for which the price is valid (See Below for Examples of Valid
|
22
22
|
Ranges.)
|
23
|
-
|
24
|
-
|
23
|
+
5. **Amount:** The price of the product if the line item quantity falls within the specified range.
|
24
|
+
6. **Position:** Integer value for `acts_as_list` (Helps keep the volume prices in a defined order.)
|
25
25
|
|
26
26
|
## Install
|
27
27
|
|
data/Rakefile
CHANGED
@@ -1,23 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'bundler'
|
4
|
-
Bundler::GemHelper.install_tasks
|
3
|
+
require 'bundler/gem_tasks'
|
5
4
|
|
6
|
-
require '
|
7
|
-
|
5
|
+
require 'solidus_dev_support/rake_tasks'
|
6
|
+
SolidusDevSupport::RakeTasks.install
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
task :default do
|
12
|
-
if Dir["spec/dummy"].empty?
|
13
|
-
Rake::Task[:test_app].invoke
|
14
|
-
Dir.chdir("../../")
|
15
|
-
end
|
16
|
-
Rake::Task[:spec].invoke
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'Generates a dummy app for testing'
|
20
|
-
task :test_app do
|
21
|
-
ENV['LIB_NAME'] = 'solidus_volume_pricing'
|
22
|
-
Rake::Task['extension:test_app'].invoke
|
23
|
-
end
|
8
|
+
task default: 'extension:specs'
|
@@ -7,11 +7,13 @@ module SolidusVolumePricing
|
|
7
7
|
base.class_eval do
|
8
8
|
has_and_belongs_to_many :volume_price_models
|
9
9
|
has_many :volume_prices, -> { order(position: :asc) }, dependent: :destroy
|
10
|
-
has_many :model_volume_prices, -> {
|
10
|
+
has_many :model_volume_prices, -> {
|
11
|
+
order(position: :asc)
|
12
|
+
}, class_name: '::Spree::VolumePrice', through: :volume_price_models, source: :volume_prices
|
11
13
|
accepts_nested_attributes_for :volume_prices, allow_destroy: true,
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
reject_if: proc { |volume_price|
|
15
|
+
volume_price[:amount].blank? && volume_price[:range].blank?
|
16
|
+
}
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|