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.
@@ -1,15 +1,15 @@
1
1
  prototypes = [
2
2
  {
3
- name: "Shirt",
4
- properties: ["Manufacturer", "Brand", "Model", "Shirt Type", "Sleeve Type", "Material", "Fit", "Gender"]
3
+ name: 'Shirt',
4
+ properties: ['Manufacturer', 'Brand', 'Model', 'Shirt Type', 'Sleeve Type', 'Material', 'Fit', 'Gender']
5
5
  },
6
6
  {
7
- name: "Bag",
8
- properties: ["Type", "Size", "Material"]
7
+ name: 'Bag',
8
+ properties: ['Type', 'Size', 'Material']
9
9
  },
10
10
  {
11
- name: "Mugs",
12
- properties: ["Size", "Type"]
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: "North America")
2
+ north_america = Spree::Zone.find_by!(name: 'North America')
3
3
  rescue ActiveRecord::RecordNotFound
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."
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: "EU_VAT")
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: "UPS Ground (USD)",
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: "UPS Two Day (USD)",
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: "UPS One Day (USD)",
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: "UPS Ground (EU)",
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: "UPS Ground (EUR)",
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
- "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"]
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,4 +1,4 @@
1
- Spree::Sample.load_sample("variants")
1
+ Spree::Sample.load_sample('variants')
2
2
 
3
3
  country = Spree::Country.find_by(iso: 'US')
4
4
  location = Spree::StockLocation.first_or_create!(name: 'default',
@@ -1 +1 @@
1
- Spree::StoreCreditCategory.find_or_create_by!(name: "Default")
1
+ Spree::StoreCreditCategory.find_or_create_by!(name: 'Default')
@@ -1,10 +1,11 @@
1
- north_america = Spree::Zone.find_by!(name: "North America")
2
- clothing = Spree::TaxCategory.find_by!(name: "Clothing")
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: "North America",
5
+ name: 'North America',
6
6
  zone: north_america,
7
7
  amount: 0.05,
8
- tax_category: clothing).first_or_create! do |tax_rate|
8
+ tax_category: clothing
9
+ ).first_or_create! do |tax_rate|
9
10
  tax_rate.calculator = Spree::Calculator::DefaultTax.create!
10
11
  end
@@ -1,6 +1,6 @@
1
1
  taxonomies = [
2
2
  { name: I18n.t('spree.taxonomy_categories_name') },
3
- { name: I18n.t('spree.taxonomy_brands_name') }
3
+ { name: I18n.t('spree.taxonomy_brands_name') }
4
4
  ]
5
5
 
6
6
  taxonomies.each do |taxonomy_attrs|
data/db/samples/taxons.rb CHANGED
@@ -1,26 +1,26 @@
1
- Spree::Sample.load_sample("taxonomies")
2
- Spree::Sample.load_sample("products")
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: "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",
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: "Bags",
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: "Mugs",
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: "Clothing",
61
+ name: 'Clothing',
62
62
  taxonomy: categories,
63
63
  parent: I18n.t('spree.taxonomy_categories_name')
64
64
  },
65
65
  {
66
- name: "Shirts",
66
+ name: 'Shirts',
67
67
  taxonomy: categories,
68
- parent: "Clothing",
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: "T-Shirts",
76
+ name: 'T-Shirts',
77
77
  taxonomy: categories,
78
- parent: "Clothing",
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: "Ruby",
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: "Apache",
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: "Spree",
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: "Rails",
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|
@@ -1,166 +1,164 @@
1
- Spree::Sample.load_sample("option_values")
2
- Spree::Sample.load_sample("products")
1
+ Spree::Sample.load_sample('option_values')
2
+ Spree::Sample.load_sample('products')
3
3
 
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")
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: "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
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: "Red").first
27
- blue = Spree::OptionValue.where(name: "Blue").first
28
- green = Spree::OptionValue.where(name: "Green").first
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: "ROR-00001",
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: "ROR-00002",
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: "ROR-00003",
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: "ROR-00004",
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: "ROR-00005",
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: "ROR-00006",
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: "ROR-00007",
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: "ROR-00008",
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: "ROR-00009",
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: "ROR-00010",
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: "ROR-001",
96
- cost_price: 17,
95
+ sku: 'ROR-001',
96
+ cost_price: 17
97
97
  },
98
98
  ror_tote => {
99
- sku: "ROR-00011",
99
+ sku: 'ROR-00011',
100
100
  cost_price: 17
101
101
  },
102
102
  ror_bag => {
103
- sku: "ROR-00012",
103
+ sku: 'ROR-00012',
104
104
  cost_price: 21
105
105
  },
106
106
  ror_jr_spaghetti => {
107
- sku: "ROR-00013",
107
+ sku: 'ROR-00013',
108
108
  cost_price: 17
109
109
  },
110
110
  ror_mug => {
111
- sku: "ROR-00014",
111
+ sku: 'ROR-00014',
112
112
  cost_price: 11
113
113
  },
114
114
  ror_ringer => {
115
- sku: "ROR-00015",
115
+ sku: 'ROR-00015',
116
116
  cost_price: 17
117
117
  },
118
118
  ror_stein => {
119
- sku: "ROR-00016",
119
+ sku: 'ROR-00016',
120
120
  cost_price: 15
121
121
  },
122
122
  apache_baseball_jersey => {
123
- sku: "APC-00001",
123
+ sku: 'APC-00001',
124
124
  cost_price: 17
125
125
  },
126
126
  ruby_baseball_jersey => {
127
- sku: "RUB-00001",
127
+ sku: 'RUB-00001',
128
128
  cost_price: 17
129
129
  },
130
130
  spree_baseball_jersey => {
131
- sku: "SPR-00001",
131
+ sku: 'SPR-00001',
132
132
  cost_price: 17
133
133
  },
134
134
  spree_stein => {
135
- sku: "SPR-00016",
135
+ sku: 'SPR-00016',
136
136
  cost_price: 15
137
137
  },
138
138
  spree_jr_spaghetti => {
139
- sku: "SPR-00013",
139
+ sku: 'SPR-00013',
140
140
  cost_price: 17
141
141
  },
142
142
  spree_mug => {
143
- sku: "SPR-00014",
143
+ sku: 'SPR-00014',
144
144
  cost_price: 11
145
145
  },
146
146
  spree_ringer => {
147
- sku: "SPR-00015",
147
+ sku: 'SPR-00015',
148
148
  cost_price: 17
149
149
  },
150
150
  spree_tote => {
151
- sku: "SPR-00011",
151
+ sku: 'SPR-00011',
152
152
  cost_price: 13
153
153
  },
154
154
  spree_bag => {
155
- sku: "SPR-00012",
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|