spree_sample 3.5.0 → 3.6.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 +5 -5
- data/db/samples.rb +2 -2
- data/db/samples/addresses.rb +7 -5
- data/db/samples/adjustments.rb +17 -15
- data/db/samples/assets.rb +105 -92
- data/db/samples/option_types.rb +4 -4
- data/db/samples/option_values.rb +19 -19
- data/db/samples/orders.rb +24 -20
- data/db/samples/payment_methods.rb +4 -4
- data/db/samples/product_option_types.rb +5 -5
- data/db/samples/product_properties.rb +81 -81
- data/db/samples/products.rb +31 -32
- data/db/samples/prototypes.rb +6 -6
- data/db/samples/shipping_methods.rb +14 -14
- data/db/samples/stock.rb +1 -1
- data/db/samples/store_credit_categories.rb +1 -1
- data/db/samples/tax_rates.rb +5 -4
- data/db/samples/taxonomies.rb +1 -1
- data/db/samples/taxons.rb +32 -32
- data/db/samples/variants.rb +54 -56
- data/lib/spree/sample.rb +1 -3
- data/lib/tasks/sample.rake +1 -1
- metadata +7 -7
data/db/samples/prototypes.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
prototypes = [
|
2
2
|
{
|
3
|
-
name:
|
4
|
-
properties: [
|
3
|
+
name: 'Shirt',
|
4
|
+
properties: ['Manufacturer', 'Brand', 'Model', 'Shirt Type', 'Sleeve Type', 'Material', 'Fit', 'Gender']
|
5
5
|
},
|
6
6
|
{
|
7
|
-
name:
|
8
|
-
properties: [
|
7
|
+
name: 'Bag',
|
8
|
+
properties: ['Type', 'Size', 'Material']
|
9
9
|
},
|
10
10
|
{
|
11
|
-
name:
|
12
|
-
properties: [
|
11
|
+
name: 'Mugs',
|
12
|
+
properties: ['Size', 'Type']
|
13
13
|
}
|
14
14
|
]
|
15
15
|
|
@@ -1,41 +1,41 @@
|
|
1
1
|
begin
|
2
|
-
north_america = Spree::Zone.find_by!(name:
|
2
|
+
north_america = Spree::Zone.find_by!(name: 'North America')
|
3
3
|
rescue ActiveRecord::RecordNotFound
|
4
|
-
puts
|
5
|
-
puts
|
4
|
+
puts 'Couldn\'t find \'North America\' zone. Did you run `rake db:seed` first?'
|
5
|
+
puts 'That task will set up the countries, states and zones required for Spree.'
|
6
6
|
exit
|
7
7
|
end
|
8
8
|
|
9
|
-
europe_vat = Spree::Zone.find_by!(name:
|
9
|
+
europe_vat = Spree::Zone.find_by!(name: 'EU_VAT')
|
10
10
|
shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default')
|
11
11
|
|
12
12
|
shipping_methods = [
|
13
13
|
{
|
14
|
-
name:
|
14
|
+
name: 'UPS Ground (USD)',
|
15
15
|
zones: [north_america],
|
16
16
|
display_on: 'both',
|
17
17
|
shipping_categories: [shipping_category]
|
18
18
|
},
|
19
19
|
{
|
20
|
-
name:
|
20
|
+
name: 'UPS Two Day (USD)',
|
21
21
|
zones: [north_america],
|
22
22
|
display_on: 'both',
|
23
23
|
shipping_categories: [shipping_category]
|
24
24
|
},
|
25
25
|
{
|
26
|
-
name:
|
26
|
+
name: 'UPS One Day (USD)',
|
27
27
|
zones: [north_america],
|
28
28
|
display_on: 'both',
|
29
29
|
shipping_categories: [shipping_category]
|
30
30
|
},
|
31
31
|
{
|
32
|
-
name:
|
32
|
+
name: 'UPS Ground (EU)',
|
33
33
|
zones: [europe_vat],
|
34
34
|
display_on: 'both',
|
35
35
|
shipping_categories: [shipping_category]
|
36
36
|
},
|
37
37
|
{
|
38
|
-
name:
|
38
|
+
name: 'UPS Ground (EUR)',
|
39
39
|
zones: [europe_vat],
|
40
40
|
display_on: 'both',
|
41
41
|
shipping_categories: [shipping_category]
|
@@ -52,11 +52,11 @@ shipping_methods.each do |attributes|
|
|
52
52
|
end
|
53
53
|
|
54
54
|
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
'UPS Ground (USD)' => [5, 'USD'],
|
56
|
+
'UPS Ground (EU)' => [5, 'USD'],
|
57
|
+
'UPS One Day (USD)' => [15, 'USD'],
|
58
|
+
'UPS Two Day (USD)' => [10, 'USD'],
|
59
|
+
'UPS Ground (EUR)' => [8, 'EUR']
|
60
60
|
}.each do |shipping_method_name, (price, currency)|
|
61
61
|
shipping_method = Spree::ShippingMethod.find_by!(name: shipping_method_name)
|
62
62
|
shipping_method.calculator.preferences = {
|
data/db/samples/stock.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Spree::StoreCreditCategory.find_or_create_by!(name:
|
1
|
+
Spree::StoreCreditCategory.find_or_create_by!(name: 'Default')
|
data/db/samples/tax_rates.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
north_america = Spree::Zone.find_by!(name:
|
2
|
-
clothing = Spree::TaxCategory.find_by!(name:
|
1
|
+
north_america = Spree::Zone.find_by!(name: 'North America')
|
2
|
+
clothing = Spree::TaxCategory.find_by!(name: 'Clothing')
|
3
3
|
|
4
4
|
Spree::TaxRate.where(
|
5
|
-
name:
|
5
|
+
name: 'North America',
|
6
6
|
zone: north_america,
|
7
7
|
amount: 0.05,
|
8
|
-
tax_category: clothing
|
8
|
+
tax_category: clothing
|
9
|
+
).first_or_create! do |tax_rate|
|
9
10
|
tax_rate.calculator = Spree::Calculator::DefaultTax.create!
|
10
11
|
end
|
data/db/samples/taxonomies.rb
CHANGED
data/db/samples/taxons.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
Spree::Sample.load_sample(
|
2
|
-
Spree::Sample.load_sample(
|
1
|
+
Spree::Sample.load_sample('taxonomies')
|
2
|
+
Spree::Sample.load_sample('products')
|
3
3
|
|
4
4
|
categories = Spree::Taxonomy.find_by!(name: I18n.t('spree.taxonomy_categories_name'))
|
5
5
|
brands = Spree::Taxonomy.find_by!(name: I18n.t('spree.taxonomy_brands_name'))
|
6
6
|
|
7
7
|
products = {
|
8
|
-
ror_tote:
|
9
|
-
ror_bag:
|
10
|
-
ror_mug:
|
11
|
-
ror_stein:
|
12
|
-
ror_baseball_jersey:
|
13
|
-
ror_jr_spaghetti:
|
14
|
-
ror_ringer:
|
15
|
-
spree_stein:
|
16
|
-
spree_mug:
|
17
|
-
spree_ringer:
|
18
|
-
spree_baseball_jersey:
|
19
|
-
spree_tote:
|
20
|
-
spree_bag:
|
21
|
-
spree_jr_spaghetti:
|
22
|
-
apache_baseball_jersey:
|
23
|
-
ruby_baseball_jersey:
|
8
|
+
ror_tote: 'Ruby on Rails Tote',
|
9
|
+
ror_bag: 'Ruby on Rails Bag',
|
10
|
+
ror_mug: 'Ruby on Rails Mug',
|
11
|
+
ror_stein: 'Ruby on Rails Stein',
|
12
|
+
ror_baseball_jersey: 'Ruby on Rails Baseball Jersey',
|
13
|
+
ror_jr_spaghetti: 'Ruby on Rails Jr. Spaghetti',
|
14
|
+
ror_ringer: 'Ruby on Rails Ringer T-Shirt',
|
15
|
+
spree_stein: 'Spree Stein',
|
16
|
+
spree_mug: 'Spree Mug',
|
17
|
+
spree_ringer: 'Spree Ringer T-Shirt',
|
18
|
+
spree_baseball_jersey: 'Spree Baseball Jersey',
|
19
|
+
spree_tote: 'Spree Tote',
|
20
|
+
spree_bag: 'Spree Bag',
|
21
|
+
spree_jr_spaghetti: 'Spree Jr. Spaghetti',
|
22
|
+
apache_baseball_jersey: 'Apache Baseball Jersey',
|
23
|
+
ruby_baseball_jersey: 'Ruby Baseball Jersey'
|
24
24
|
}
|
25
25
|
|
26
26
|
products.each do |key, name|
|
@@ -34,7 +34,7 @@ taxons = [
|
|
34
34
|
position: 0
|
35
35
|
},
|
36
36
|
{
|
37
|
-
name:
|
37
|
+
name: 'Bags',
|
38
38
|
taxonomy: categories,
|
39
39
|
parent: I18n.t('spree.taxonomy_categories_name'),
|
40
40
|
position: 1,
|
@@ -46,7 +46,7 @@ taxons = [
|
|
46
46
|
]
|
47
47
|
},
|
48
48
|
{
|
49
|
-
name:
|
49
|
+
name: 'Mugs',
|
50
50
|
taxonomy: categories,
|
51
51
|
parent: I18n.t('spree.taxonomy_categories_name'),
|
52
52
|
position: 2,
|
@@ -58,14 +58,14 @@ taxons = [
|
|
58
58
|
]
|
59
59
|
},
|
60
60
|
{
|
61
|
-
name:
|
61
|
+
name: 'Clothing',
|
62
62
|
taxonomy: categories,
|
63
63
|
parent: I18n.t('spree.taxonomy_categories_name')
|
64
64
|
},
|
65
65
|
{
|
66
|
-
name:
|
66
|
+
name: 'Shirts',
|
67
67
|
taxonomy: categories,
|
68
|
-
parent:
|
68
|
+
parent: 'Clothing',
|
69
69
|
position: 0,
|
70
70
|
products: [
|
71
71
|
products[:ror_jr_spaghetti],
|
@@ -73,9 +73,9 @@ taxons = [
|
|
73
73
|
]
|
74
74
|
},
|
75
75
|
{
|
76
|
-
name:
|
76
|
+
name: 'T-Shirts',
|
77
77
|
taxonomy: categories,
|
78
|
-
parent:
|
78
|
+
parent: 'Clothing',
|
79
79
|
products: [
|
80
80
|
products[:ror_baseball_jersey],
|
81
81
|
products[:ror_ringer],
|
@@ -91,7 +91,7 @@ taxons = [
|
|
91
91
|
taxonomy: brands
|
92
92
|
},
|
93
93
|
{
|
94
|
-
name:
|
94
|
+
name: 'Ruby',
|
95
95
|
taxonomy: brands,
|
96
96
|
parent: I18n.t('spree.taxonomy_brands_name'),
|
97
97
|
products: [
|
@@ -99,7 +99,7 @@ taxons = [
|
|
99
99
|
]
|
100
100
|
},
|
101
101
|
{
|
102
|
-
name:
|
102
|
+
name: 'Apache',
|
103
103
|
taxonomy: brands,
|
104
104
|
parent: I18n.t('spree.taxonomy_brands_name'),
|
105
105
|
products: [
|
@@ -107,7 +107,7 @@ taxons = [
|
|
107
107
|
]
|
108
108
|
},
|
109
109
|
{
|
110
|
-
name:
|
110
|
+
name: 'Spree',
|
111
111
|
taxonomy: brands,
|
112
112
|
parent: I18n.t('spree.taxonomy_brands_name'),
|
113
113
|
products: [
|
@@ -117,11 +117,11 @@ taxons = [
|
|
117
117
|
products[:spree_baseball_jersey],
|
118
118
|
products[:spree_tote],
|
119
119
|
products[:spree_bag],
|
120
|
-
products[:spree_jr_spaghetti]
|
120
|
+
products[:spree_jr_spaghetti]
|
121
121
|
]
|
122
122
|
},
|
123
123
|
{
|
124
|
-
name:
|
124
|
+
name: 'Rails',
|
125
125
|
taxonomy: brands,
|
126
126
|
parent: I18n.t('spree.taxonomy_brands_name'),
|
127
127
|
products: [
|
@@ -131,9 +131,9 @@ taxons = [
|
|
131
131
|
products[:ror_stein],
|
132
132
|
products[:ror_baseball_jersey],
|
133
133
|
products[:ror_jr_spaghetti],
|
134
|
-
products[:ror_ringer]
|
134
|
+
products[:ror_ringer]
|
135
135
|
]
|
136
|
-
}
|
136
|
+
}
|
137
137
|
]
|
138
138
|
|
139
139
|
taxons.each do |taxon_attrs|
|
data/db/samples/variants.rb
CHANGED
@@ -1,166 +1,164 @@
|
|
1
|
-
Spree::Sample.load_sample(
|
2
|
-
Spree::Sample.load_sample(
|
1
|
+
Spree::Sample.load_sample('option_values')
|
2
|
+
Spree::Sample.load_sample('products')
|
3
3
|
|
4
|
-
ror_baseball_jersey = Spree::Product.find_by!(name:
|
5
|
-
ror_tote = Spree::Product.find_by!(name:
|
6
|
-
ror_bag = Spree::Product.find_by!(name:
|
7
|
-
ror_jr_spaghetti = Spree::Product.find_by!(name:
|
8
|
-
ror_mug = Spree::Product.find_by!(name:
|
9
|
-
ror_ringer = Spree::Product.find_by!(name:
|
10
|
-
ror_stein = Spree::Product.find_by!(name:
|
11
|
-
spree_baseball_jersey = Spree::Product.find_by!(name:
|
12
|
-
spree_stein = Spree::Product.find_by!(name:
|
13
|
-
spree_jr_spaghetti = Spree::Product.find_by!(name:
|
14
|
-
spree_mug = Spree::Product.find_by!(name:
|
15
|
-
spree_ringer = Spree::Product.find_by!(name:
|
16
|
-
spree_tote = Spree::Product.find_by!(name:
|
17
|
-
spree_bag = Spree::Product.find_by!(name:
|
18
|
-
ruby_baseball_jersey = Spree::Product.find_by!(name:
|
19
|
-
apache_baseball_jersey = Spree::Product.find_by!(name:
|
4
|
+
ror_baseball_jersey = Spree::Product.find_by!(name: 'Ruby on Rails Baseball Jersey')
|
5
|
+
ror_tote = Spree::Product.find_by!(name: 'Ruby on Rails Tote')
|
6
|
+
ror_bag = Spree::Product.find_by!(name: 'Ruby on Rails Bag')
|
7
|
+
ror_jr_spaghetti = Spree::Product.find_by!(name: 'Ruby on Rails Jr. Spaghetti')
|
8
|
+
ror_mug = Spree::Product.find_by!(name: 'Ruby on Rails Mug')
|
9
|
+
ror_ringer = Spree::Product.find_by!(name: 'Ruby on Rails Ringer T-Shirt')
|
10
|
+
ror_stein = Spree::Product.find_by!(name: 'Ruby on Rails Stein')
|
11
|
+
spree_baseball_jersey = Spree::Product.find_by!(name: 'Spree Baseball Jersey')
|
12
|
+
spree_stein = Spree::Product.find_by!(name: 'Spree Stein')
|
13
|
+
spree_jr_spaghetti = Spree::Product.find_by!(name: 'Spree Jr. Spaghetti')
|
14
|
+
spree_mug = Spree::Product.find_by!(name: 'Spree Mug')
|
15
|
+
spree_ringer = Spree::Product.find_by!(name: 'Spree Ringer T-Shirt')
|
16
|
+
spree_tote = Spree::Product.find_by!(name: 'Spree Tote')
|
17
|
+
spree_bag = Spree::Product.find_by!(name: 'Spree Bag')
|
18
|
+
ruby_baseball_jersey = Spree::Product.find_by!(name: 'Ruby Baseball Jersey')
|
19
|
+
apache_baseball_jersey = Spree::Product.find_by!(name: 'Apache Baseball Jersey')
|
20
20
|
|
21
|
-
small = Spree::OptionValue.where(name:
|
22
|
-
medium = Spree::OptionValue.where(name:
|
23
|
-
large = Spree::OptionValue.where(name:
|
24
|
-
extra_large = Spree::OptionValue.where(name:
|
21
|
+
small = Spree::OptionValue.where(name: 'Small').first
|
22
|
+
medium = Spree::OptionValue.where(name: 'Medium').first
|
23
|
+
large = Spree::OptionValue.where(name: 'Large').first
|
24
|
+
extra_large = Spree::OptionValue.where(name: 'Extra Large').first
|
25
25
|
|
26
|
-
red = Spree::OptionValue.where(name:
|
27
|
-
blue = Spree::OptionValue.where(name:
|
28
|
-
green = Spree::OptionValue.where(name:
|
26
|
+
red = Spree::OptionValue.where(name: 'Red').first
|
27
|
+
blue = Spree::OptionValue.where(name: 'Blue').first
|
28
|
+
green = Spree::OptionValue.where(name: 'Green').first
|
29
29
|
|
30
30
|
variants = [
|
31
31
|
{
|
32
32
|
product: ror_baseball_jersey,
|
33
33
|
option_values: [small, red],
|
34
|
-
sku:
|
34
|
+
sku: 'ROR-00001',
|
35
35
|
cost_price: 17
|
36
36
|
},
|
37
37
|
{
|
38
38
|
product: ror_baseball_jersey,
|
39
39
|
option_values: [small, blue],
|
40
|
-
sku:
|
40
|
+
sku: 'ROR-00002',
|
41
41
|
cost_price: 17
|
42
42
|
},
|
43
43
|
{
|
44
44
|
product: ror_baseball_jersey,
|
45
45
|
option_values: [small, green],
|
46
|
-
sku:
|
46
|
+
sku: 'ROR-00003',
|
47
47
|
cost_price: 17
|
48
48
|
},
|
49
49
|
{
|
50
50
|
product: ror_baseball_jersey,
|
51
51
|
option_values: [medium, red],
|
52
|
-
sku:
|
52
|
+
sku: 'ROR-00004',
|
53
53
|
cost_price: 17
|
54
54
|
},
|
55
55
|
{
|
56
56
|
product: ror_baseball_jersey,
|
57
57
|
option_values: [medium, blue],
|
58
|
-
sku:
|
58
|
+
sku: 'ROR-00005',
|
59
59
|
cost_price: 17
|
60
60
|
},
|
61
61
|
{
|
62
62
|
product: ror_baseball_jersey,
|
63
63
|
option_values: [medium, green],
|
64
|
-
sku:
|
64
|
+
sku: 'ROR-00006',
|
65
65
|
cost_price: 17
|
66
66
|
},
|
67
67
|
{
|
68
68
|
product: ror_baseball_jersey,
|
69
69
|
option_values: [large, red],
|
70
|
-
sku:
|
70
|
+
sku: 'ROR-00007',
|
71
71
|
cost_price: 17
|
72
72
|
},
|
73
73
|
{
|
74
74
|
product: ror_baseball_jersey,
|
75
75
|
option_values: [large, blue],
|
76
|
-
sku:
|
76
|
+
sku: 'ROR-00008',
|
77
77
|
cost_price: 17
|
78
78
|
},
|
79
79
|
{
|
80
80
|
product: ror_baseball_jersey,
|
81
81
|
option_values: [large, green],
|
82
|
-
sku:
|
82
|
+
sku: 'ROR-00009',
|
83
83
|
cost_price: 17
|
84
84
|
},
|
85
85
|
{
|
86
86
|
product: ror_baseball_jersey,
|
87
87
|
option_values: [extra_large, green],
|
88
|
-
sku:
|
88
|
+
sku: 'ROR-00010',
|
89
89
|
cost_price: 17
|
90
|
-
}
|
90
|
+
}
|
91
91
|
]
|
92
92
|
|
93
93
|
masters = {
|
94
94
|
ror_baseball_jersey => {
|
95
|
-
sku:
|
96
|
-
cost_price: 17
|
95
|
+
sku: 'ROR-001',
|
96
|
+
cost_price: 17
|
97
97
|
},
|
98
98
|
ror_tote => {
|
99
|
-
sku:
|
99
|
+
sku: 'ROR-00011',
|
100
100
|
cost_price: 17
|
101
101
|
},
|
102
102
|
ror_bag => {
|
103
|
-
sku:
|
103
|
+
sku: 'ROR-00012',
|
104
104
|
cost_price: 21
|
105
105
|
},
|
106
106
|
ror_jr_spaghetti => {
|
107
|
-
sku:
|
107
|
+
sku: 'ROR-00013',
|
108
108
|
cost_price: 17
|
109
109
|
},
|
110
110
|
ror_mug => {
|
111
|
-
sku:
|
111
|
+
sku: 'ROR-00014',
|
112
112
|
cost_price: 11
|
113
113
|
},
|
114
114
|
ror_ringer => {
|
115
|
-
sku:
|
115
|
+
sku: 'ROR-00015',
|
116
116
|
cost_price: 17
|
117
117
|
},
|
118
118
|
ror_stein => {
|
119
|
-
sku:
|
119
|
+
sku: 'ROR-00016',
|
120
120
|
cost_price: 15
|
121
121
|
},
|
122
122
|
apache_baseball_jersey => {
|
123
|
-
sku:
|
123
|
+
sku: 'APC-00001',
|
124
124
|
cost_price: 17
|
125
125
|
},
|
126
126
|
ruby_baseball_jersey => {
|
127
|
-
sku:
|
127
|
+
sku: 'RUB-00001',
|
128
128
|
cost_price: 17
|
129
129
|
},
|
130
130
|
spree_baseball_jersey => {
|
131
|
-
sku:
|
131
|
+
sku: 'SPR-00001',
|
132
132
|
cost_price: 17
|
133
133
|
},
|
134
134
|
spree_stein => {
|
135
|
-
sku:
|
135
|
+
sku: 'SPR-00016',
|
136
136
|
cost_price: 15
|
137
137
|
},
|
138
138
|
spree_jr_spaghetti => {
|
139
|
-
sku:
|
139
|
+
sku: 'SPR-00013',
|
140
140
|
cost_price: 17
|
141
141
|
},
|
142
142
|
spree_mug => {
|
143
|
-
sku:
|
143
|
+
sku: 'SPR-00014',
|
144
144
|
cost_price: 11
|
145
145
|
},
|
146
146
|
spree_ringer => {
|
147
|
-
sku:
|
147
|
+
sku: 'SPR-00015',
|
148
148
|
cost_price: 17
|
149
149
|
},
|
150
150
|
spree_tote => {
|
151
|
-
sku:
|
151
|
+
sku: 'SPR-00011',
|
152
152
|
cost_price: 13
|
153
153
|
},
|
154
154
|
spree_bag => {
|
155
|
-
sku:
|
155
|
+
sku: 'SPR-00012',
|
156
156
|
cost_price: 21
|
157
157
|
}
|
158
158
|
}
|
159
159
|
|
160
160
|
variants.each do |attrs|
|
161
|
-
if Spree::Variant.where(product_id: attrs[:product].id, sku: attrs[:sku]).none?
|
162
|
-
Spree::Variant.create!(attrs)
|
163
|
-
end
|
161
|
+
Spree::Variant.create!(attrs) if Spree::Variant.where(product_id: attrs[:product].id, sku: attrs[:sku]).none?
|
164
162
|
end
|
165
163
|
|
166
164
|
masters.each do |product, variant_attrs|
|