spree_sample 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/samples/products.rb +7 -4
- data/db/samples/variants.rb +4 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f234b641d1c482be07af2a0880807eec787cbf282552bf104e06857c240651
|
4
|
+
data.tar.gz: 0e9ff36d0b307e5a746d8f67d498fe4ed03ea5689b8adfbf715144677f5d4390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b413b1b1e7f7fe094025d82aefdc397a3f5af3abc3d926c097f7227d974fdc6b5f0e36a71edb8083fe925a1c00da9bc9298cec18a6150726738c20febefd5637
|
7
|
+
data.tar.gz: 446f172cb45eab05f65d70b8fd5d5c907bfed4825cd9a850cb7e1d80f4129516f69328744263c7e23d5a07e530f56f581317dbf74cc3289b7c3acf9f4bb821e7
|
data/db/samples/products.rb
CHANGED
@@ -20,7 +20,7 @@ end.uniq
|
|
20
20
|
PRODUCTS.each do |(parent_name, taxon_name, product_name)|
|
21
21
|
parent = Spree::Taxon.find_by!(name: parent_name)
|
22
22
|
taxon = parent.children.find_by!(name: taxon_name)
|
23
|
-
|
23
|
+
Spree::Product.where(name: product_name.titleize).first_or_create! do |product|
|
24
24
|
product.price = rand(10...100) + 0.99
|
25
25
|
product.description = FFaker::Lorem.paragraph
|
26
26
|
product.available_on = Time.zone.now
|
@@ -28,10 +28,13 @@ PRODUCTS.each do |(parent_name, taxon_name, product_name)|
|
|
28
28
|
product.shipping_category = default_shipping_category
|
29
29
|
product.tax_category = clothing_tax_category
|
30
30
|
product.sku = [taxon_name.delete(' '), product_name.delete(' '), product.price].join('_')
|
31
|
-
|
31
|
+
product.taxons << parent unless product.taxons.include?(parent)
|
32
|
+
product.taxons << taxon unless product.taxons.include?(taxon)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
['Bestsellers', 'New', 'Trending', 'Streetstyle', 'Summer Sale'].each do |
|
36
|
-
|
36
|
+
Spree::Taxon.where(name: ['Bestsellers', 'New', 'Trending', 'Streetstyle', 'Summer Sale']).each do |taxon|
|
37
|
+
next if taxon.products.any?
|
38
|
+
|
39
|
+
taxon.products << Spree::Product.all.sample(30)
|
37
40
|
end
|
data/db/samples/variants.rb
CHANGED
@@ -14,29 +14,28 @@ size_option_values = Spree::OptionType.find_by!(name: 'size').option_values
|
|
14
14
|
VARIANTS.each do |(parent_name, taxon_name, product_name, color_name)|
|
15
15
|
parent = Spree::Taxon.find_by!(name: parent_name)
|
16
16
|
taxon = parent.children.find_by!(name: taxon_name)
|
17
|
-
product =
|
17
|
+
product = Spree::Product.find_by!(name: product_name.titleize)
|
18
18
|
color = color_option_values.find_by!(name: color_name)
|
19
19
|
|
20
20
|
size_option_values.each do |size|
|
21
21
|
if parent_name == 'Women' and %w[Dresses Skirts].include?(taxon_name)
|
22
22
|
length_option_values.each do |length|
|
23
23
|
option_values = [color, length, size]
|
24
|
-
product.variants.
|
24
|
+
product.variants.first_or_create! do |variant|
|
25
25
|
variant.cost_price = product.price
|
26
26
|
variant.option_values = option_values
|
27
27
|
variant.sku = product.sku + '_' + option_values.map(&:name).join('_')
|
28
28
|
variant.tax_category = clothing_tax_category
|
29
|
-
variant.save!
|
30
29
|
end
|
31
30
|
end
|
32
31
|
else
|
33
32
|
option_values = [color, size]
|
34
|
-
product.variants.
|
33
|
+
product.variants.first_or_create! do |variant|
|
35
34
|
variant.cost_price = product.price
|
36
35
|
variant.option_values = option_values
|
37
36
|
variant.sku = product.sku + '_' + option_values.map(&:name).join('_')
|
38
37
|
variant.tax_category = clothing_tax_category
|
39
|
-
|
38
|
+
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_sample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1.
|
19
|
+
version: 4.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1.
|
26
|
+
version: 4.1.1
|
27
27
|
description: Required dependency for Spree
|
28
28
|
email: sean@spreecommerce.com
|
29
29
|
executables: []
|