spree_sample 3.3.6 → 3.4.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/db/samples/assets.rb +184 -182
- data/lib/spree/sample.rb +10 -9
- data/lib/spree_sample.rb +18 -18
- data/lib/tasks/sample.rake +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95e18ede08cc41f536d4d63a715524b4d1adde65
|
4
|
+
data.tar.gz: e6cf84ee3ec0b529709d4108811506e85748552d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 841312bb666120ce2c32d7bd6cb2ce88d518584d1217a50adb475978b48d739205a26fe6fc6ab63dc4903a91f159169977a6a20be1d5d7a4db9ff83e0415288d
|
7
|
+
data.tar.gz: 3b992790dda2d7088dd6ad558bc0990ff8c793e727ef341a2a65f02327dcc0aa52206b1f7d4ec6b57f78b1f1a96806a56f1174f22b7ba06873a1bdc479b08c18
|
data/db/samples/assets.rb
CHANGED
@@ -1,195 +1,197 @@
|
|
1
|
-
|
2
|
-
Spree::Sample.load_sample("
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
31
|
-
end
|
30
|
+
def file_name(name, type = "jpeg")
|
31
|
+
"#{name}.#{type}"
|
32
|
+
end
|
32
33
|
|
33
|
-
images = {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
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
|
-
|
173
|
+
products[:ror_baseball_jersey].variants.each do |variant|
|
174
|
+
color = variant.option_value("tshirt-color").downcase
|
174
175
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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
|
-
|
181
|
-
|
182
|
-
|
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
|
-
|
188
|
-
|
189
|
-
|
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
|
-
|
192
|
-
|
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.
|
6
|
-
|
7
|
-
|
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
|
-
|
10
|
-
|
9
|
+
File.expand_path(samples_path + "#{file}.rb")
|
10
|
+
end
|
11
11
|
# Check to see if the specified file has been loaded before
|
12
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
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(
|
11
|
-
Spree::Sample.load_sample(
|
12
|
-
Spree::Sample.load_sample(
|
13
|
-
Spree::Sample.load_sample(
|
14
|
-
Spree::Sample.load_sample(
|
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(
|
17
|
-
Spree::Sample.load_sample(
|
18
|
-
Spree::Sample.load_sample(
|
19
|
-
Spree::Sample.load_sample(
|
20
|
-
Spree::Sample.load_sample(
|
21
|
-
Spree::Sample.load_sample(
|
22
|
-
Spree::Sample.load_sample(
|
23
|
-
Spree::Sample.load_sample(
|
24
|
-
Spree::Sample.load_sample(
|
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(
|
27
|
-
Spree::Sample.load_sample(
|
28
|
-
Spree::Sample.load_sample(
|
29
|
-
Spree::Sample.load_sample(
|
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
|
data/lib/tasks/sample.rake
CHANGED
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.
|
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:
|
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.
|
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.
|
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:
|
111
|
+
version: 1.3.1
|
112
112
|
requirements:
|
113
113
|
- none
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.6.
|
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.
|