spree_sample 3.3.6 → 3.4.0.rc1

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
  SHA1:
3
- metadata.gz: 2d1dcd8171f15765393a08fa9446f0ab816eb801
4
- data.tar.gz: 218518985a2311c92ecd2c0a1ca55971f2572293
3
+ metadata.gz: 95e18ede08cc41f536d4d63a715524b4d1adde65
4
+ data.tar.gz: e6cf84ee3ec0b529709d4108811506e85748552d
5
5
  SHA512:
6
- metadata.gz: 1cf516cc1d24102760f70105bfe8f4473d6645927a82216ee4ff04173086b0dd1052f0154ac286c674259f497dd98576290c1cd57a7b0c6d944b161d543bb78c
7
- data.tar.gz: a3f94582e8103a067aee052d1dc523b923d5c014662f61699ad6e05a099b2e5410f3aacb2e86254bf9f48fc63405496bd3f8ab4eb66085bb6c8d1acad950cf6f
6
+ metadata.gz: 841312bb666120ce2c32d7bd6cb2ce88d518584d1217a50adb475978b48d739205a26fe6fc6ab63dc4903a91f159169977a6a20be1d5d7a4db9ff83e0415288d
7
+ data.tar.gz: 3b992790dda2d7088dd6ad558bc0990ff8c793e727ef341a2a65f02327dcc0aa52206b1f7d4ec6b57f78b1f1a96806a56f1174f22b7ba06873a1bdc479b08c18
data/db/samples/assets.rb CHANGED
@@ -1,195 +1,197 @@
1
- Spree::Sample.load_sample("products")
2
- Spree::Sample.load_sample("variants")
1
+ unless ENV['SKIP_SAMPLE_IMAGES']
2
+ Spree::Sample.load_sample("products")
3
+ Spree::Sample.load_sample("variants")
3
4
 
4
- products = {}
5
- products[:ror_baseball_jersey] = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey")
6
- products[:ror_tote] = Spree::Product.find_by!(name: "Ruby on Rails Tote")
7
- products[:ror_bag] = Spree::Product.find_by!(name: "Ruby on Rails Bag")
8
- products[:ror_jr_spaghetti] = Spree::Product.find_by!(name: "Ruby on Rails Jr. Spaghetti")
9
- products[:ror_mug] = Spree::Product.find_by!(name: "Ruby on Rails Mug")
10
- products[:ror_ringer] = Spree::Product.find_by!(name: "Ruby on Rails Ringer T-Shirt")
11
- products[:ror_stein] = Spree::Product.find_by!(name: "Ruby on Rails Stein")
12
- products[:spree_baseball_jersey] = Spree::Product.find_by!(name: "Spree Baseball Jersey")
13
- products[:spree_stein] = Spree::Product.find_by!(name: "Spree Stein")
14
- products[:spree_jr_spaghetti] = Spree::Product.find_by!(name: "Spree Jr. Spaghetti")
15
- products[:spree_mug] = Spree::Product.find_by!(name: "Spree Mug")
16
- products[:spree_ringer] = Spree::Product.find_by!(name: "Spree Ringer T-Shirt")
17
- products[:spree_tote] = Spree::Product.find_by!(name: "Spree Tote")
18
- products[:spree_bag] = Spree::Product.find_by!(name: "Spree Bag")
19
- products[:ruby_baseball_jersey] = Spree::Product.find_by!(name: "Ruby Baseball Jersey")
20
- products[:apache_baseball_jersey] = Spree::Product.find_by!(name: "Apache Baseball Jersey")
5
+ products = {}
6
+ products[:ror_baseball_jersey] = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey")
7
+ products[:ror_tote] = Spree::Product.find_by!(name: "Ruby on Rails Tote")
8
+ products[:ror_bag] = Spree::Product.find_by!(name: "Ruby on Rails Bag")
9
+ products[:ror_jr_spaghetti] = Spree::Product.find_by!(name: "Ruby on Rails Jr. Spaghetti")
10
+ products[:ror_mug] = Spree::Product.find_by!(name: "Ruby on Rails Mug")
11
+ products[:ror_ringer] = Spree::Product.find_by!(name: "Ruby on Rails Ringer T-Shirt")
12
+ products[:ror_stein] = Spree::Product.find_by!(name: "Ruby on Rails Stein")
13
+ products[:spree_baseball_jersey] = Spree::Product.find_by!(name: "Spree Baseball Jersey")
14
+ products[:spree_stein] = Spree::Product.find_by!(name: "Spree Stein")
15
+ products[:spree_jr_spaghetti] = Spree::Product.find_by!(name: "Spree Jr. Spaghetti")
16
+ products[:spree_mug] = Spree::Product.find_by!(name: "Spree Mug")
17
+ products[:spree_ringer] = Spree::Product.find_by!(name: "Spree Ringer T-Shirt")
18
+ products[:spree_tote] = Spree::Product.find_by!(name: "Spree Tote")
19
+ products[:spree_bag] = Spree::Product.find_by!(name: "Spree Bag")
20
+ products[:ruby_baseball_jersey] = Spree::Product.find_by!(name: "Ruby Baseball Jersey")
21
+ products[:apache_baseball_jersey] = Spree::Product.find_by!(name: "Apache Baseball Jersey")
21
22
 
22
- def image(name, type = "jpeg")
23
- images_path = Pathname.new(File.dirname(__FILE__)) + "images"
24
- path = images_path + file_name(name, type)
25
- return false if !File.exist?(path)
26
- File.open(path)
27
- end
23
+ def image(name, type = "jpeg")
24
+ images_path = Pathname.new(File.dirname(__FILE__)) + "images"
25
+ path = images_path + file_name(name, type)
26
+ return false if !File.exist?(path)
27
+ File.open(path)
28
+ end
28
29
 
29
- def file_name(name, type = "jpeg")
30
- "#{name}.#{type}"
31
- end
30
+ def file_name(name, type = "jpeg")
31
+ "#{name}.#{type}"
32
+ end
32
33
 
33
- images = {
34
- products[:ror_tote].master => [
35
- {
36
- name: file_name("ror_tote"),
37
- attachment: image("ror_tote")
38
- },
39
- {
40
- name: file_name("ror_tote_back"),
41
- attachment: image("ror_tote_back")
42
- }
43
- ],
44
- products[:ror_bag].master => [
45
- {
46
- name: file_name("ror_bag"),
47
- attachment: image("ror_bag")
48
- }
49
- ],
50
- products[:ror_baseball_jersey].master => [
51
- {
52
- name: file_name("ror_baseball"),
53
- attachment: image("ror_baseball")
54
- },
55
- {
56
- name: file_name("ror_baseball_back"),
57
- attachment: image("ror_baseball_back")
58
- }
59
- ],
60
- products[:ror_jr_spaghetti].master => [
61
- {
62
- name: file_name("ror_jr_spaghetti"),
63
- attachment: image("ror_jr_spaghetti")
64
- }
65
- ],
66
- products[:ror_mug].master => [
67
- {
68
- name: file_name("ror_mug"),
69
- attachment: image("ror_mug")
70
- },
71
- {
72
- name: file_name("ror_mug_back"),
73
- attachment: image("ror_mug_back")
74
- }
75
- ],
76
- products[:ror_ringer].master => [
77
- {
78
- name: file_name("ror_ringer"),
79
- attachment: image("ror_ringer")
80
- },
81
- {
82
- name: file_name("ror_ringer_back"),
83
- attachment: image("ror_ringer_back")
84
- }
85
- ],
86
- products[:ror_stein].master => [
87
- {
88
- name: file_name("ror_stein"),
89
- attachment: image("ror_stein")
90
- },
91
- {
92
- name: file_name("ror_stein_back"),
93
- attachment: image("ror_stein_back")
94
- }
95
- ],
96
- products[:apache_baseball_jersey].master => [
97
- {
98
- name: file_name("apache_baseball", "png"),
99
- attachment: image("apache_baseball", "png")
100
- },
101
- ],
102
- products[:ruby_baseball_jersey].master => [
103
- {
104
- name: file_name("ruby_baseball", "png"),
105
- attachment: image("ruby_baseball", "png")
106
- },
107
- ],
108
- products[:spree_bag].master => [
109
- {
110
- name: file_name("spree_bag"),
111
- attachment: image("spree_bag")
112
- },
113
- ],
114
- products[:spree_tote].master => [
115
- {
116
- name: file_name("spree_tote_front"),
117
- attachment: image("spree_tote_front")
118
- },
119
- {
120
- name: file_name("spree_tote_back"),
121
- attachment: image("spree_tote_back")
122
- }
123
- ],
124
- products[:spree_ringer].master => [
125
- {
126
- name: file_name("spree_ringer_t"),
127
- attachment: image("spree_ringer_t")
128
- },
129
- {
130
- name: file_name("spree_ringer_t_back"),
131
- attachment: image("spree_ringer_t_back")
132
- }
133
- ],
134
- products[:spree_jr_spaghetti].master => [
135
- {
136
- name: file_name("spree_spaghetti"),
137
- attachment: image("spree_spaghetti")
138
- }
139
- ],
140
- products[:spree_baseball_jersey].master => [
141
- {
142
- name: file_name("spree_jersey"),
143
- attachment: image("spree_jersey")
144
- },
145
- {
146
- name: file_name("spree_jersey_back"),
147
- attachment: image("spree_jersey_back")
148
- }
149
- ],
150
- products[:spree_stein].master => [
151
- {
152
- name: file_name("spree_stein"),
153
- attachment: image("spree_stein")
154
- },
155
- {
156
- name: file_name("spree_stein_back"),
157
- attachment: image("spree_stein_back")
158
- }
159
- ],
160
- products[:spree_mug].master => [
161
- {
162
- name: file_name("spree_mug"),
163
- attachment: image("spree_mug")
164
- },
165
- {
166
- name: file_name("spree_mug_back"),
167
- attachment: image("spree_mug_back")
168
- }
169
- ],
170
- }
34
+ images = {
35
+ products[:ror_tote].master => [
36
+ {
37
+ name: file_name("ror_tote"),
38
+ attachment: image("ror_tote")
39
+ },
40
+ {
41
+ name: file_name("ror_tote_back"),
42
+ attachment: image("ror_tote_back")
43
+ }
44
+ ],
45
+ products[:ror_bag].master => [
46
+ {
47
+ name: file_name("ror_bag"),
48
+ attachment: image("ror_bag")
49
+ }
50
+ ],
51
+ products[:ror_baseball_jersey].master => [
52
+ {
53
+ name: file_name("ror_baseball"),
54
+ attachment: image("ror_baseball")
55
+ },
56
+ {
57
+ name: file_name("ror_baseball_back"),
58
+ attachment: image("ror_baseball_back")
59
+ }
60
+ ],
61
+ products[:ror_jr_spaghetti].master => [
62
+ {
63
+ name: file_name("ror_jr_spaghetti"),
64
+ attachment: image("ror_jr_spaghetti")
65
+ }
66
+ ],
67
+ products[:ror_mug].master => [
68
+ {
69
+ name: file_name("ror_mug"),
70
+ attachment: image("ror_mug")
71
+ },
72
+ {
73
+ name: file_name("ror_mug_back"),
74
+ attachment: image("ror_mug_back")
75
+ }
76
+ ],
77
+ products[:ror_ringer].master => [
78
+ {
79
+ name: file_name("ror_ringer"),
80
+ attachment: image("ror_ringer")
81
+ },
82
+ {
83
+ name: file_name("ror_ringer_back"),
84
+ attachment: image("ror_ringer_back")
85
+ }
86
+ ],
87
+ products[:ror_stein].master => [
88
+ {
89
+ name: file_name("ror_stein"),
90
+ attachment: image("ror_stein")
91
+ },
92
+ {
93
+ name: file_name("ror_stein_back"),
94
+ attachment: image("ror_stein_back")
95
+ }
96
+ ],
97
+ products[:apache_baseball_jersey].master => [
98
+ {
99
+ name: file_name("apache_baseball", "png"),
100
+ attachment: image("apache_baseball", "png")
101
+ },
102
+ ],
103
+ products[:ruby_baseball_jersey].master => [
104
+ {
105
+ name: file_name("ruby_baseball", "png"),
106
+ attachment: image("ruby_baseball", "png")
107
+ },
108
+ ],
109
+ products[:spree_bag].master => [
110
+ {
111
+ name: file_name("spree_bag"),
112
+ attachment: image("spree_bag")
113
+ },
114
+ ],
115
+ products[:spree_tote].master => [
116
+ {
117
+ name: file_name("spree_tote_front"),
118
+ attachment: image("spree_tote_front")
119
+ },
120
+ {
121
+ name: file_name("spree_tote_back"),
122
+ attachment: image("spree_tote_back")
123
+ }
124
+ ],
125
+ products[:spree_ringer].master => [
126
+ {
127
+ name: file_name("spree_ringer_t"),
128
+ attachment: image("spree_ringer_t")
129
+ },
130
+ {
131
+ name: file_name("spree_ringer_t_back"),
132
+ attachment: image("spree_ringer_t_back")
133
+ }
134
+ ],
135
+ products[:spree_jr_spaghetti].master => [
136
+ {
137
+ name: file_name("spree_spaghetti"),
138
+ attachment: image("spree_spaghetti")
139
+ }
140
+ ],
141
+ products[:spree_baseball_jersey].master => [
142
+ {
143
+ name: file_name("spree_jersey"),
144
+ attachment: image("spree_jersey")
145
+ },
146
+ {
147
+ name: file_name("spree_jersey_back"),
148
+ attachment: image("spree_jersey_back")
149
+ }
150
+ ],
151
+ products[:spree_stein].master => [
152
+ {
153
+ name: file_name("spree_stein"),
154
+ attachment: image("spree_stein")
155
+ },
156
+ {
157
+ name: file_name("spree_stein_back"),
158
+ attachment: image("spree_stein_back")
159
+ }
160
+ ],
161
+ products[:spree_mug].master => [
162
+ {
163
+ name: file_name("spree_mug"),
164
+ attachment: image("spree_mug")
165
+ },
166
+ {
167
+ name: file_name("spree_mug_back"),
168
+ attachment: image("spree_mug_back")
169
+ }
170
+ ],
171
+ }
171
172
 
172
- products[:ror_baseball_jersey].variants.each do |variant|
173
- color = variant.option_value("tshirt-color").downcase
173
+ products[:ror_baseball_jersey].variants.each do |variant|
174
+ color = variant.option_value("tshirt-color").downcase
174
175
 
175
- if variant.images.where(attachment_file_name: file_name("ror_baseball_jersey_#{color}", "png")).none?
176
- main_image = image("ror_baseball_jersey_#{color}", "png")
177
- variant.images.create!(attachment: main_image)
178
- end
176
+ if variant.images.where(attachment_file_name: file_name("ror_baseball_jersey_#{color}", "png")).none?
177
+ main_image = image("ror_baseball_jersey_#{color}", "png")
178
+ variant.images.create!(attachment: main_image)
179
+ end
179
180
 
180
- if variant.images.where(attachment_file_name: file_name("ror_baseball_jersey_back_#{color}", "png")).none?
181
- back_image = image("ror_baseball_jersey_back_#{color}", "png")
182
- variant.images.create!(attachment: back_image)
181
+ if variant.images.where(attachment_file_name: file_name("ror_baseball_jersey_back_#{color}", "png")).none?
182
+ back_image = image("ror_baseball_jersey_back_#{color}", "png")
183
+ variant.images.create!(attachment: back_image)
184
+ end
183
185
  end
184
- end
185
186
 
186
- images.each do |variant, attachments|
187
- puts "Loading images for #{variant.product.name}"
188
- attachments.each do |attrs|
189
- file_name = attrs.delete(:name)
187
+ images.each do |variant, attachments|
188
+ puts "Loading images for #{variant.product.name}"
189
+ attachments.each do |attrs|
190
+ file_name = attrs.delete(:name)
190
191
 
191
- if variant.images.where(attachment_file_name: file_name).none?
192
- variant.images.create!(attrs)
192
+ if variant.images.where(attachment_file_name: file_name).none?
193
+ variant.images.create!(attrs)
194
+ end
193
195
  end
194
196
  end
195
197
  end
data/lib/spree/sample.rb CHANGED
@@ -2,22 +2,23 @@ module Spree
2
2
  module Sample
3
3
  def self.load_sample(file)
4
4
  # If file exists within application it takes precendence.
5
- if File.exists?(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
6
- path = File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
7
- else
5
+ path = if File.exist?(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
6
+ File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
7
+ else
8
8
  # Otherwise we will use this gems default file.
9
- path = File.expand_path(samples_path + "#{file}.rb")
10
- end
9
+ File.expand_path(samples_path + "#{file}.rb")
10
+ end
11
11
  # Check to see if the specified file has been loaded before
12
- if !$LOADED_FEATURES.include?(path)
12
+ unless $LOADED_FEATURES.include?(path)
13
13
  require path
14
14
  puts "Loaded #{file.titleize} samples"
15
15
  end
16
16
  end
17
17
 
18
18
  private
19
- def self.samples_path
20
- Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples'))
21
- end
19
+
20
+ def self.samples_path
21
+ Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples'))
22
+ end
22
23
  end
23
24
  end
data/lib/spree_sample.rb CHANGED
@@ -7,26 +7,26 @@ module SpreeSample
7
7
 
8
8
  # Needs to be here so we can access it inside the tests
9
9
  def self.load_samples
10
- Spree::Sample.load_sample("payment_methods")
11
- Spree::Sample.load_sample("shipping_categories")
12
- Spree::Sample.load_sample("shipping_methods")
13
- Spree::Sample.load_sample("tax_categories")
14
- Spree::Sample.load_sample("tax_rates")
10
+ Spree::Sample.load_sample('payment_methods')
11
+ Spree::Sample.load_sample('shipping_categories')
12
+ Spree::Sample.load_sample('shipping_methods')
13
+ Spree::Sample.load_sample('tax_categories')
14
+ Spree::Sample.load_sample('tax_rates')
15
15
 
16
- Spree::Sample.load_sample("products")
17
- Spree::Sample.load_sample("taxons")
18
- Spree::Sample.load_sample("option_values")
19
- Spree::Sample.load_sample("product_option_types")
20
- Spree::Sample.load_sample("product_properties")
21
- Spree::Sample.load_sample("prototypes")
22
- Spree::Sample.load_sample("variants")
23
- Spree::Sample.load_sample("stock")
24
- Spree::Sample.load_sample("assets")
16
+ Spree::Sample.load_sample('products')
17
+ Spree::Sample.load_sample('taxons')
18
+ Spree::Sample.load_sample('option_values')
19
+ Spree::Sample.load_sample('product_option_types')
20
+ Spree::Sample.load_sample('product_properties')
21
+ Spree::Sample.load_sample('prototypes')
22
+ Spree::Sample.load_sample('variants')
23
+ Spree::Sample.load_sample('stock')
24
+ Spree::Sample.load_sample('assets')
25
25
 
26
- Spree::Sample.load_sample("orders")
27
- Spree::Sample.load_sample("adjustments")
28
- Spree::Sample.load_sample("payments")
29
- Spree::Sample.load_sample("store_credit_categories")
26
+ Spree::Sample.load_sample('orders')
27
+ Spree::Sample.load_sample('adjustments')
28
+ Spree::Sample.load_sample('payments')
29
+ Spree::Sample.load_sample('store_credit_categories')
30
30
  end
31
31
  end
32
32
  end
@@ -5,7 +5,7 @@ require 'spree/sample'
5
5
  namespace :spree_sample do
6
6
  desc 'Loads sample data'
7
7
  task load: :environment do
8
- if ARGV.include?("db:migrate")
8
+ if ARGV.include?('db:migrate')
9
9
  puts %Q{
10
10
  Please run db:migrate separately from spree_sample:load.
11
11
 
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: 3.3.6
4
+ version: 3.4.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2017-09-22 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: 3.3.6
19
+ version: 3.4.0.rc1
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: 3.3.6
26
+ version: 3.4.0.rc1
27
27
  description: Required dependency for Spree
28
28
  email: sean@spreecommerce.com
29
29
  executables: []
@@ -106,13 +106,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
109
+ - - ">"
110
110
  - !ruby/object:Gem::Version
111
- version: '0'
111
+ version: 1.3.1
112
112
  requirements:
113
113
  - none
114
114
  rubyforge_project:
115
- rubygems_version: 2.6.14
115
+ rubygems_version: 2.6.12
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Sample data (including images) for use with Spree.