spree_sample 4.0.9 → 4.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/samples/adjustments.rb +4 -2
- data/db/samples/option_types.rb +10 -5
- data/db/samples/option_values.rb +50 -48
- data/db/samples/orders.rb +14 -10
- data/db/samples/product_properties.rb +98 -113
- data/db/samples/products.rb +24 -111
- data/db/samples/promotions.rb +6 -6
- data/db/samples/properties.rb +18 -0
- data/db/samples/prototypes.rb +5 -3
- data/db/samples/return_authorization_reasons.rb +13 -0
- data/db/samples/stock.rb +16 -9
- data/db/samples/tax_categories.rb +0 -1
- data/db/samples/tax_rates.rb +7 -4
- data/db/samples/taxonomies.rb +1 -2
- data/db/samples/taxons.rb +30 -139
- data/db/samples/variants.csv +194 -0
- data/db/samples/variants.rb +36 -159
- data/db/samples/zones.rb +3 -0
- data/lib/spree_sample.rb +6 -2
- data/spree_sample.gemspec +3 -9
- metadata +15 -17
- data/db/samples/assets.rb +0 -201
- data/db/samples/product_option_types.rb +0 -12
data/spree_sample.gemspec
CHANGED
@@ -5,20 +5,14 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.name = 'spree_sample'
|
7
7
|
s.version = Spree.version
|
8
|
-
s.author = 'Sean Schofield'
|
9
|
-
s.email = 'sean@spreecommerce.com'
|
10
8
|
s.summary = 'Sample data (including images) for use with Spree.'
|
11
9
|
s.description = 'Required dependency for Spree'
|
10
|
+
|
11
|
+
s.author = 'Sean Schofield'
|
12
|
+
s.email = 'sean@spreecommerce.com'
|
12
13
|
s.homepage = 'http://spreecommerce.org'
|
13
14
|
s.license = 'BSD-3-Clause'
|
14
15
|
|
15
|
-
s.metadata = {
|
16
|
-
"bug_tracker_uri" => "https://github.com/spree/spree/issues",
|
17
|
-
"changelog_uri" => "https://github.com/spree/spree/releases/tag/v#{s.version}",
|
18
|
-
"documentation_uri" => "https://guides.spreecommerce.org/",
|
19
|
-
"source_code_uri" => "https://github.com/spree/spree/tree/v#{s.version}",
|
20
|
-
}
|
21
|
-
|
22
16
|
s.files = `git ls-files`.split("\n").reject { |f| f.match(/^spec/) && !f.match(/^spec\/fixtures/) }
|
23
17
|
s.require_path = 'lib'
|
24
18
|
s.requirements << 'none'
|
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.0.
|
4
|
+
version: 4.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-31 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.0.
|
19
|
+
version: 4.1.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: 4.0.
|
26
|
+
version: 4.1.0.rc1
|
27
27
|
description: Required dependency for Spree
|
28
28
|
email: sean@spreecommerce.com
|
29
29
|
executables: []
|
@@ -36,7 +36,6 @@ files:
|
|
36
36
|
- db/samples.rb
|
37
37
|
- db/samples/addresses.rb
|
38
38
|
- db/samples/adjustments.rb
|
39
|
-
- db/samples/assets.rb
|
40
39
|
- db/samples/images/apache_baseball.png
|
41
40
|
- db/samples/images/ror_bag.jpeg
|
42
41
|
- db/samples/images/ror_baseball.jpeg
|
@@ -74,11 +73,12 @@ files:
|
|
74
73
|
- db/samples/orders.rb
|
75
74
|
- db/samples/payment_methods.rb
|
76
75
|
- db/samples/payments.rb
|
77
|
-
- db/samples/product_option_types.rb
|
78
76
|
- db/samples/product_properties.rb
|
79
77
|
- db/samples/products.rb
|
80
78
|
- db/samples/promotions.rb
|
79
|
+
- db/samples/properties.rb
|
81
80
|
- db/samples/prototypes.rb
|
81
|
+
- db/samples/return_authorization_reasons.rb
|
82
82
|
- db/samples/shipping_categories.rb
|
83
83
|
- db/samples/shipping_methods.rb
|
84
84
|
- db/samples/stock.rb
|
@@ -87,7 +87,9 @@ files:
|
|
87
87
|
- db/samples/tax_rates.rb
|
88
88
|
- db/samples/taxonomies.rb
|
89
89
|
- db/samples/taxons.rb
|
90
|
+
- db/samples/variants.csv
|
90
91
|
- db/samples/variants.rb
|
92
|
+
- db/samples/zones.rb
|
91
93
|
- lib/spree/sample.rb
|
92
94
|
- lib/spree_sample.rb
|
93
95
|
- lib/tasks/sample.rake
|
@@ -95,12 +97,8 @@ files:
|
|
95
97
|
homepage: http://spreecommerce.org
|
96
98
|
licenses:
|
97
99
|
- BSD-3-Clause
|
98
|
-
metadata:
|
99
|
-
|
100
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.0.9
|
101
|
-
documentation_uri: https://guides.spreecommerce.org/
|
102
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.0.9
|
103
|
-
post_install_message:
|
100
|
+
metadata: {}
|
101
|
+
post_install_message:
|
104
102
|
rdoc_options: []
|
105
103
|
require_paths:
|
106
104
|
- lib
|
@@ -111,13 +109,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
109
|
version: '0'
|
112
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
111
|
requirements:
|
114
|
-
- - "
|
112
|
+
- - ">"
|
115
113
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
114
|
+
version: 1.3.1
|
117
115
|
requirements:
|
118
116
|
- none
|
119
|
-
rubygems_version: 3.
|
120
|
-
signing_key:
|
117
|
+
rubygems_version: 3.0.3
|
118
|
+
signing_key:
|
121
119
|
specification_version: 4
|
122
120
|
summary: Sample data (including images) for use with Spree.
|
123
121
|
test_files: []
|
data/db/samples/assets.rb
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
unless ENV['SKIP_SAMPLE_IMAGES']
|
2
|
-
Spree::Sample.load_sample('products')
|
3
|
-
Spree::Sample.load_sample('variants')
|
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')
|
21
|
-
|
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 unless File.exist?(path)
|
26
|
-
|
27
|
-
File.open(path)
|
28
|
-
end
|
29
|
-
|
30
|
-
def file_name(name, type = 'jpeg')
|
31
|
-
"#{name}.#{type}"
|
32
|
-
end
|
33
|
-
|
34
|
-
def attach_paperclip_image(variant, name, type)
|
35
|
-
if variant.images.where(attachment_file_name: file_name(name, type)).none?
|
36
|
-
image = image(name, type)
|
37
|
-
variant.images.create!(attachment: image)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def attach_active_storage_image(variant, name, type)
|
42
|
-
if variant.images.with_attached_attachment.where(active_storage_blobs: { filename: file_name(name, type) }).none?
|
43
|
-
image = image(name, type)
|
44
|
-
variant.images.create!(attachment: { io: image, filename: file_name(name, type) })
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
images = {
|
49
|
-
products[:ror_tote].master => [
|
50
|
-
{
|
51
|
-
name: file_name('ror_tote'),
|
52
|
-
attachment: image('ror_tote')
|
53
|
-
},
|
54
|
-
{
|
55
|
-
name: file_name('ror_tote_back'),
|
56
|
-
attachment: image('ror_tote_back')
|
57
|
-
}
|
58
|
-
],
|
59
|
-
products[:ror_bag].master => [
|
60
|
-
{
|
61
|
-
name: file_name('ror_bag'),
|
62
|
-
attachment: image('ror_bag')
|
63
|
-
}
|
64
|
-
],
|
65
|
-
products[:ror_baseball_jersey].master => [
|
66
|
-
{
|
67
|
-
name: file_name('ror_baseball'),
|
68
|
-
attachment: image('ror_baseball')
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: file_name('ror_baseball_back'),
|
72
|
-
attachment: image('ror_baseball_back')
|
73
|
-
}
|
74
|
-
],
|
75
|
-
products[:ror_jr_spaghetti].master => [
|
76
|
-
{
|
77
|
-
name: file_name('ror_jr_spaghetti'),
|
78
|
-
attachment: image('ror_jr_spaghetti')
|
79
|
-
}
|
80
|
-
],
|
81
|
-
products[:ror_mug].master => [
|
82
|
-
{
|
83
|
-
name: file_name('ror_mug'),
|
84
|
-
attachment: image('ror_mug')
|
85
|
-
},
|
86
|
-
{
|
87
|
-
name: file_name('ror_mug_back'),
|
88
|
-
attachment: image('ror_mug_back')
|
89
|
-
}
|
90
|
-
],
|
91
|
-
products[:ror_ringer].master => [
|
92
|
-
{
|
93
|
-
name: file_name('ror_ringer'),
|
94
|
-
attachment: image('ror_ringer')
|
95
|
-
},
|
96
|
-
{
|
97
|
-
name: file_name('ror_ringer_back'),
|
98
|
-
attachment: image('ror_ringer_back')
|
99
|
-
}
|
100
|
-
],
|
101
|
-
products[:ror_stein].master => [
|
102
|
-
{
|
103
|
-
name: file_name('ror_stein'),
|
104
|
-
attachment: image('ror_stein')
|
105
|
-
},
|
106
|
-
{
|
107
|
-
name: file_name('ror_stein_back'),
|
108
|
-
attachment: image('ror_stein_back')
|
109
|
-
}
|
110
|
-
],
|
111
|
-
products[:apache_baseball_jersey].master => [
|
112
|
-
{
|
113
|
-
name: file_name('apache_baseball', 'png'),
|
114
|
-
attachment: image('apache_baseball', 'png')
|
115
|
-
}
|
116
|
-
],
|
117
|
-
products[:ruby_baseball_jersey].master => [
|
118
|
-
{
|
119
|
-
name: file_name('ruby_baseball', 'png'),
|
120
|
-
attachment: image('ruby_baseball', 'png')
|
121
|
-
}
|
122
|
-
],
|
123
|
-
products[:spree_bag].master => [
|
124
|
-
{
|
125
|
-
name: file_name('spree_bag'),
|
126
|
-
attachment: image('spree_bag')
|
127
|
-
}
|
128
|
-
],
|
129
|
-
products[:spree_tote].master => [
|
130
|
-
{
|
131
|
-
name: file_name('spree_tote_front'),
|
132
|
-
attachment: image('spree_tote_front')
|
133
|
-
},
|
134
|
-
{
|
135
|
-
name: file_name('spree_tote_back'),
|
136
|
-
attachment: image('spree_tote_back')
|
137
|
-
}
|
138
|
-
],
|
139
|
-
products[:spree_ringer].master => [
|
140
|
-
{
|
141
|
-
name: file_name('spree_ringer_t'),
|
142
|
-
attachment: image('spree_ringer_t')
|
143
|
-
},
|
144
|
-
{
|
145
|
-
name: file_name('spree_ringer_t_back'),
|
146
|
-
attachment: image('spree_ringer_t_back')
|
147
|
-
}
|
148
|
-
],
|
149
|
-
products[:spree_jr_spaghetti].master => [
|
150
|
-
{
|
151
|
-
name: file_name('spree_spaghetti'),
|
152
|
-
attachment: image('spree_spaghetti')
|
153
|
-
}
|
154
|
-
],
|
155
|
-
products[:spree_baseball_jersey].master => [
|
156
|
-
{
|
157
|
-
name: file_name('spree_jersey'),
|
158
|
-
attachment: image('spree_jersey')
|
159
|
-
},
|
160
|
-
{
|
161
|
-
name: file_name('spree_jersey_back'),
|
162
|
-
attachment: image('spree_jersey_back')
|
163
|
-
}
|
164
|
-
],
|
165
|
-
products[:spree_stein].master => [
|
166
|
-
{
|
167
|
-
name: file_name('spree_stein'),
|
168
|
-
attachment: image('spree_stein')
|
169
|
-
},
|
170
|
-
{
|
171
|
-
name: file_name('spree_stein_back'),
|
172
|
-
attachment: image('spree_stein_back')
|
173
|
-
}
|
174
|
-
],
|
175
|
-
products[:spree_mug].master => [
|
176
|
-
{
|
177
|
-
name: file_name('spree_mug'),
|
178
|
-
attachment: image('spree_mug')
|
179
|
-
},
|
180
|
-
{
|
181
|
-
name: file_name('spree_mug_back'),
|
182
|
-
attachment: image('spree_mug_back')
|
183
|
-
}
|
184
|
-
]
|
185
|
-
}
|
186
|
-
|
187
|
-
products[:ror_baseball_jersey].variants.each do |variant|
|
188
|
-
color = variant.option_value('tshirt-color').downcase
|
189
|
-
|
190
|
-
attach_active_storage_image(variant, "ror_baseball_jersey_#{color}", 'png')
|
191
|
-
attach_active_storage_image(variant, "ror_baseball_jersey_back_#{color}", 'png')
|
192
|
-
end
|
193
|
-
|
194
|
-
images.each do |variant, attachments|
|
195
|
-
puts "Loading images for #{variant.product.name}"
|
196
|
-
attachments.each do |attrs|
|
197
|
-
name, type = attrs.delete(:name).split('.')
|
198
|
-
attach_active_storage_image(variant, name, type)
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Spree::Sample.load_sample('products')
|
2
|
-
|
3
|
-
size = Spree::OptionType.find_by!(presentation: 'Size')
|
4
|
-
color = Spree::OptionType.find_by!(presentation: 'Color')
|
5
|
-
|
6
|
-
ror_baseball_jersey = Spree::Product.find_by!(name: 'Ruby on Rails Baseball Jersey')
|
7
|
-
ror_baseball_jersey.option_types = [size, color]
|
8
|
-
ror_baseball_jersey.save!
|
9
|
-
|
10
|
-
spree_baseball_jersey = Spree::Product.find_by!(name: 'Spree Baseball Jersey')
|
11
|
-
spree_baseball_jersey.option_types = [size, color]
|
12
|
-
spree_baseball_jersey.save!
|