spree_sample 4.5.3 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7e754df042af896102950857ab9f8c33c40e4f35722e2499d3aba86a890babd
4
- data.tar.gz: 39f5e70043a5ece5dfe2f6f74c66d4b22b1150e7f78aff23b19432b658a7d803
3
+ metadata.gz: c45eb3fae7b9b7b6d0663b68adda93cc4077ae9bda4fea4953440a9408e8bc45
4
+ data.tar.gz: 4f0873ce35dc211b7f49c3c4986160894624e19e6f2b7477efb22c1532f0c58e
5
5
  SHA512:
6
- metadata.gz: 89e5c2d1ef19b3ff4bbfb8039801808991f55572d520d11611a5333c6acc40c66e2c6c2badb93652f8214603fc7e75f6f9951fbf9f94e887b8328491a9465b16
7
- data.tar.gz: 87503000e92f0adda0d27e9e33197e731f23aa639a67ab3f4526ae645b35db3529d103e5e1a60017fb7a713c6c4f1f126f541bcd6c1c5b986fcb51ab47f78519
6
+ metadata.gz: 6bc4d40aa1691266b336ce05d538bf1fcb30e7887b77b67715999b0fe8adb4ec8ee1c9570e59267da1986b2b889fcb8d7ef4ae389d41154358ee8c23e0ffd0ee
7
+ data.tar.gz: 1b0c4f71620b325058970c047f1ddf23c9edca6bed53f347e0a8b2f3f6610179146f7e9c7211a54dac504d62400d23349d37449c64a0cd50139b64a88227d441
@@ -0,0 +1,6 @@
1
+ # settings for default store
2
+ Spree::DataFeed::Google.create!(
3
+ store: Spree::Store.default,
4
+ name: 'Default Google Data Feed'
5
+ )
6
+
@@ -17,5 +17,7 @@ option_types_attributes = [
17
17
  ]
18
18
 
19
19
  option_types_attributes.each do |attrs|
20
- Spree::OptionType.where(attrs).first_or_create!
20
+ unless Spree::OptionType.where(attrs).exists?
21
+ Spree::OptionType.create!(attrs)
22
+ end
21
23
  end
@@ -43,7 +43,6 @@ men_tshirts_properties = [
43
43
  'gender' => 'Men\'s'
44
44
  }
45
45
  ]
46
-
47
46
  Spree::Taxon.find_by!(name: 'Men').children.find_by!(name: 'T-shirts').products.each do |product|
48
47
  men_tshirts_properties.sample.each do |prop_name, prop_value|
49
48
  product.set_property(prop_name, prop_value, prop_name.gsub('_', ' ').capitalize)
@@ -19,17 +19,20 @@ end.uniq
19
19
  PRODUCTS.each do |(parent_name, taxon_name, product_name)|
20
20
  parent = Spree::Taxon.find_by!(name: parent_name)
21
21
  taxon = parent.children.find_by!(name: taxon_name)
22
- Spree::Product.where(name: product_name.titleize).first_or_create! do |product|
22
+ next if Spree::Product.where(name: product_name.titleize).any?
23
+
24
+ Spree::Product.create!(name: product_name.titleize) do |product|
23
25
  product.price = rand(10...100) + 0.99
24
26
  product.description = FFaker::Lorem.paragraph
25
27
  product.available_on = Time.zone.now
26
28
  product.make_active_at = Time.zone.now
27
29
  product.status = 'active'
28
- if parent_name == 'Women' and %w[Dresses Skirts].include?(taxon_name)
29
- product.option_types = [color, length, size]
30
- else
31
- product.option_types = [color, size]
32
- end
30
+ product.option_types =
31
+ if parent_name == 'Women' && %w[Dresses Skirts].include?(taxon_name)
32
+ [color, length, size]
33
+ else
34
+ [color, size]
35
+ end
33
36
  product.shipping_category = default_shipping_category
34
37
  product.tax_category = clothing_tax_category
35
38
  product.sku = [taxon_name.delete(' '), product_name.delete(' '), product.price].join('_')
@@ -14,7 +14,9 @@ properties = {
14
14
  }
15
15
 
16
16
  properties.each do |name, presentation|
17
- Spree::Property.where(name: name, presentation: presentation).first_or_create!
17
+ unless Spree::Property.where(name: name, presentation: presentation).exists?
18
+ Spree::Property.create!(name: name, presentation: presentation)
19
+ end
18
20
  end
19
21
 
20
22
  Spree::Property.where(name: %w[brand manufacturer]).update(filterable: true)
data/db/samples/stores.rb CHANGED
@@ -3,12 +3,12 @@ default_store.checkout_zone = Spree::Zone.find_by(name: 'North America')
3
3
  default_store.default_country = Spree::Country.find_by(iso: 'US')
4
4
  default_store.supported_currencies = 'CAD,USD'
5
5
  default_store.supported_locales = 'en,fr'
6
- default_store.url = Rails.env.development? ? 'localhost:3000' : 'demo.spreecommerce.org'
6
+ default_store.url = Rails.env.development? ? 'localhost:4000' : 'demo.spreecommerce.org'
7
7
  default_store.save!
8
8
 
9
9
  eu_store = Spree::Store.find_or_initialize_by(code: 'eustore')
10
10
  eu_store.name = 'EU Store'
11
- eu_store.url = Rails.env.development? ? 'eu.lvh.me:3000' : 'demo-eu.spreecommerce.org'
11
+ eu_store.url = Rails.env.development? ? 'eu.lvh.me:4000' : 'demo-eu.spreecommerce.org'
12
12
  eu_store.mail_from_address = 'eustore@example.com'
13
13
  eu_store.default_currency = 'EUR'
14
14
  eu_store.default_locale = 'de'
@@ -19,7 +19,7 @@ eu_store.save!
19
19
 
20
20
  uk_store = Spree::Store.find_or_initialize_by(code: 'ukstore')
21
21
  uk_store.name = 'UK Store'
22
- uk_store.url = Rails.env.development? ? 'uk.lvh.me:3000' : 'demo-uk.spreecommerce.org'
22
+ uk_store.url = Rails.env.development? ? 'uk.lvh.me:4000' : 'demo-uk.spreecommerce.org'
23
23
  uk_store.mail_from_address = 'ukstore@example.com'
24
24
  uk_store.default_currency = 'GBP'
25
25
  uk_store.default_locale = 'en'
@@ -8,5 +8,9 @@ taxonomies = [
8
8
  ]
9
9
 
10
10
  taxonomies.each do |taxonomy_attrs|
11
- Spree::Taxonomy.where(taxonomy_attrs).first_or_create!
11
+ if Spree::Taxonomy.where(taxonomy_attrs).any?
12
+ Spree::Taxonomy.where(taxonomy_attrs).first
13
+ else
14
+ Spree::Taxonomy.create!(taxonomy_attrs)
15
+ end
12
16
  end
data/db/samples/taxons.rb CHANGED
@@ -16,34 +16,65 @@ categories = Spree::Taxonomy.find_by!(name: I18n.t('spree.taxonomy_categories_na
16
16
  categories_taxon = Spree::Taxon.where(name: I18n.t('spree.taxonomy_categories_name')).first_or_create!
17
17
 
18
18
  TAXON_NAMES.each do |taxon_name|
19
- taxon = categories_taxon.children.where(name: taxon_name).first_or_create!
19
+ taxon =
20
+ if not categories_taxon.children.where(name: taxon_name).exists?
21
+ Spree::Taxon.create!(name: taxon_name, parent_id: categories_taxon.id, taxonomy: categories)
22
+ else
23
+ categories_taxon.children.where(name: taxon_name).first
24
+ end
20
25
  taxon.taxonomy = categories
21
26
  taxon.save!
22
27
  end
23
28
 
24
29
  CHILDREN_TAXON_NAMES.each do |(parent_name, taxon_name)|
25
30
  parent = Spree::Taxon.where(name: parent_name).first
26
- taxon = parent.children.where(name: taxon_name).first_or_create!
31
+ taxon =
32
+ if parent.children.where(name: taxon_name).any?
33
+ parent.children.where(name: taxon_name).first
34
+ else
35
+ Spree::Taxon.create!(name: taxon_name, parent_id: parent.id, taxonomy: categories)
36
+ end
27
37
  taxon.taxonomy = categories
28
38
  taxon.save!
29
39
  end
30
40
 
31
- taxon = categories_taxon.children.where(name: 'New').first_or_create!
41
+ taxon =
42
+ if categories_taxon.children.where(name: 'New').any?
43
+ categories_taxon.children.where(name: 'New').first
44
+ else
45
+ Spree::Taxon.create!(name: 'New', parent_id: categories_taxon.id, taxonomy: categories)
46
+ end
32
47
  taxon.taxonomy = categories
33
48
  taxon.save!
34
49
 
35
50
  ADDITIONAL_TAXONS.each do |taxon_name|
36
- taxon = categories_taxon.children.where(name: taxon_name).first_or_create!
51
+ taxon =
52
+ if categories_taxon.children.where(name: taxon_name).any?
53
+ categories_taxon.children.where(name: taxon_name).first
54
+ else
55
+ Spree::Taxon.create!(name: taxon_name, parent_id: categories_taxon.id, taxonomy: categories)
56
+ end
37
57
  taxon.taxonomy = categories
38
58
  taxon.save!
39
59
  end
40
60
 
41
61
  SPECIAL_TAXONS.each do |parent_name, taxon_name|
42
- parent = categories_taxon.children.where(name: parent_name.to_s).first_or_create!
62
+ parent =
63
+ if categories_taxon.children.where(name: parent_name.to_s).any?
64
+ categories_taxon.children.where(name: parent_name.to_s).first
65
+ else
66
+ Spree::Taxon.create!(name: parent_name.to_s, parent_id: categories_taxon.id, taxonomy: categories)
67
+ end
43
68
  parent.taxonomy = categories
44
69
  parent.save!
45
70
 
46
- taxon = parent.children.where(name: taxon_name).first_or_create!
71
+ taxon =
72
+ if parent.children.where(name: taxon_name).any?
73
+ parent.children.where(name: taxon_name).first
74
+ else
75
+ Spree::Taxon.create!(name: taxon_name, parent_id: parent.id, taxonomy: categories)
76
+ end
77
+
47
78
  taxon.taxonomy = categories
48
79
  taxon.save!
49
80
  end
data/lib/spree_sample.rb CHANGED
@@ -5,6 +5,7 @@ module SpreeSample
5
5
  class Engine < Rails::Engine
6
6
  engine_name 'spree_sample'
7
7
 
8
+ config.active_record.yaml_column_permitted_classes = [Symbol]
8
9
  # Needs to be here so we can access it inside the tests
9
10
  def self.load_samples
10
11
  Spree::Sample.load_sample('addresses')
@@ -31,6 +32,7 @@ module SpreeSample
31
32
  Spree::Sample.load_sample('reimbursements')
32
33
  Spree::Sample.load_sample('return_authorization_reasons')
33
34
  Spree::Sample.load_sample('stores')
35
+ Spree::Sample.load_sample('data_feeds')
34
36
 
35
37
  Spree::Sample.load_sample('cms_standard_pages')
36
38
  Spree::Sample.load_sample('cms_feature_pages')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_sample
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.3
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-14 00:00:00.000000000 Z
12
+ date: 2023-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.5.3
20
+ version: 4.6.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 4.5.3
27
+ version: 4.6.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: ffaker
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +56,7 @@ files:
56
56
  - db/samples/cms_homepages.rb
57
57
  - db/samples/cms_sections.rb
58
58
  - db/samples/cms_standard_pages.rb
59
+ - db/samples/data_feeds.rb
59
60
  - db/samples/images/apache_baseball.png
60
61
  - db/samples/images/ror_bag.jpeg
61
62
  - db/samples/images/ror_baseball.jpeg
@@ -121,9 +122,9 @@ licenses:
121
122
  - BSD-3-Clause
122
123
  metadata:
123
124
  bug_tracker_uri: https://github.com/spree/spree/issues
124
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.5.3
125
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.6.0
125
126
  documentation_uri: https://dev-docs.spreecommerce.org/
126
- source_code_uri: https://github.com/spree/spree/tree/v4.5.3
127
+ source_code_uri: https://github.com/spree/spree/tree/v4.6.0
127
128
  post_install_message:
128
129
  rdoc_options: []
129
130
  require_paths: