solidus_sample 2.9.5 → 2.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/db/samples/assets.rb +79 -40
  3. data/db/samples/images/ruby_hoodie.jpg +0 -0
  4. data/db/samples/images/ruby_hoodie_zip.jpg +0 -0
  5. data/db/samples/images/ruby_mug.jpg +0 -0
  6. data/db/samples/images/ruby_polo.jpg +0 -0
  7. data/db/samples/images/ruby_polo_back.jpg +0 -0
  8. data/db/samples/images/solidus_girly.jpg +0 -0
  9. data/db/samples/images/solidus_girly_black.png +0 -0
  10. data/db/samples/images/solidus_girly_blue.png +0 -0
  11. data/db/samples/images/solidus_girly_white.png +0 -0
  12. data/db/samples/images/solidus_hoodie.jpg +0 -0
  13. data/db/samples/images/solidus_long.jpg +0 -0
  14. data/db/samples/images/solidus_long_back.jpg +0 -0
  15. data/db/samples/images/solidus_long_back_black.png +0 -0
  16. data/db/samples/images/solidus_long_back_blue.png +0 -0
  17. data/db/samples/images/solidus_long_back_white.png +0 -0
  18. data/db/samples/images/solidus_long_black.png +0 -0
  19. data/db/samples/images/solidus_long_blue.png +0 -0
  20. data/db/samples/images/solidus_long_white.png +0 -0
  21. data/db/samples/images/solidus_mug.jpg +0 -0
  22. data/db/samples/images/solidus_snapback_cap.jpg +0 -0
  23. data/db/samples/images/solidus_tshirt.jpg +0 -0
  24. data/db/samples/images/solidus_tshirt_back.jpg +0 -0
  25. data/db/samples/images/solidus_tshirt_back_black.png +0 -0
  26. data/db/samples/images/solidus_tshirt_back_blue.png +0 -0
  27. data/db/samples/images/solidus_tshirt_back_white.png +0 -0
  28. data/db/samples/images/solidus_tshirt_black.png +0 -0
  29. data/db/samples/images/solidus_tshirt_blue.png +0 -0
  30. data/db/samples/images/solidus_tshirt_white.png +0 -0
  31. data/db/samples/images/tote_bag_ruby.jpg +0 -0
  32. data/db/samples/images/tote_bag_solidus.jpg +0 -0
  33. data/db/samples/option_values.rb +13 -1
  34. data/db/samples/orders.rb +3 -3
  35. data/db/samples/product_option_types.rb +3 -3
  36. data/db/samples/product_properties.rb +78 -28
  37. data/db/samples/products.rb +97 -27
  38. data/db/samples/taxons.rb +58 -40
  39. data/db/samples/variants.rb +149 -62
  40. data/solidus_sample.gemspec +1 -1
  41. metadata +35 -25
  42. data/db/samples/images/apache_baseball.png +0 -0
  43. data/db/samples/images/ror_bag.jpeg +0 -0
  44. data/db/samples/images/ror_baseball.jpeg +0 -0
  45. data/db/samples/images/ror_baseball_back.jpeg +0 -0
  46. data/db/samples/images/ror_baseball_jersey_back_blue.png +0 -0
  47. data/db/samples/images/ror_baseball_jersey_back_green.png +0 -0
  48. data/db/samples/images/ror_baseball_jersey_back_red.png +0 -0
  49. data/db/samples/images/ror_baseball_jersey_blue.png +0 -0
  50. data/db/samples/images/ror_baseball_jersey_green.png +0 -0
  51. data/db/samples/images/ror_baseball_jersey_red.png +0 -0
  52. data/db/samples/images/ror_jr_spaghetti.jpeg +0 -0
  53. data/db/samples/images/ror_mug.jpeg +0 -0
  54. data/db/samples/images/ror_mug_back.jpeg +0 -0
  55. data/db/samples/images/ror_ringer.jpeg +0 -0
  56. data/db/samples/images/ror_ringer_back.jpeg +0 -0
  57. data/db/samples/images/ror_stein.jpeg +0 -0
  58. data/db/samples/images/ror_stein_back.jpeg +0 -0
  59. data/db/samples/images/ror_tote.jpeg +0 -0
  60. data/db/samples/images/ror_tote_back.jpeg +0 -0
  61. data/db/samples/images/ruby_baseball.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 064f012f67678d67d2387f96fea2cac7ab950083667049a317d2681a9f69dc18
4
- data.tar.gz: 2884dd811278122766ddddcc6fb3b37fb33e5ca8172204aacafeb55b762b5557
3
+ metadata.gz: b9d613b41f157f92e162bbd1fdb2d44964f21396d0ba93132504202165f674a9
4
+ data.tar.gz: 65651899c1475d102546fbe2752162e9ce82b86d6405db6993e5c1a7bcb322a3
5
5
  SHA512:
6
- metadata.gz: 1ea3b5546b9fc16ef14b61b8065c343cafb03c902f487a0449671b1bcea5dd0159edeffa3612beeae8dc0526c30c29f18003a7c495a6208dd777b3d3e611a9a0
7
- data.tar.gz: 3382a508d1531095d972dc854df2b9ca0224cf309c879d9c5f200f261d29765df56801a10b3fd4856992f89fd4220baf1d896d20e6e6d5e5794607e43d67bc38
6
+ metadata.gz: 8cd7043e1b10ded969b3cd1eb98f1641c97cc6b188447ac72a9a574557a96093139fc7295b4a8dc149617121d64fc3216d022c02b315a39829653e00b4fd178c
7
+ data.tar.gz: 79b6e0a60a96bf3c4b3638e1beff11cd208c5233746b75ffc971366495e953ae9a25445c58dad43d7657c26b94db983f33185bd090ba90f13820f7d27dc119df
@@ -4,99 +4,138 @@ Spree::Sample.load_sample("products")
4
4
  Spree::Sample.load_sample("variants")
5
5
 
6
6
  products = {}
7
- products[:ror_baseball_jersey] = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey")
8
- products[:ror_tote] = Spree::Product.find_by!(name: "Ruby on Rails Tote")
9
- products[:ror_bag] = Spree::Product.find_by!(name: "Ruby on Rails Bag")
10
- products[:ror_jr_spaghetti] = Spree::Product.find_by!(name: "Ruby on Rails Jr. Spaghetti")
11
- products[:ror_mug] = Spree::Product.find_by!(name: "Ruby on Rails Mug")
12
- products[:ror_ringer] = Spree::Product.find_by!(name: "Ruby on Rails Ringer T-Shirt")
13
- products[:ror_stein] = Spree::Product.find_by!(name: "Ruby on Rails Stein")
14
- products[:ruby_baseball_jersey] = Spree::Product.find_by!(name: "Ruby Baseball Jersey")
15
- products[:apache_baseball_jersey] = Spree::Product.find_by!(name: "Apache Baseball Jersey")
7
+ products[:solidus_tshirt] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus T-Shirt")
8
+ products[:solidus_long] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus Long Sleeve")
9
+ products[:solidus_girly] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus Girly")
10
+ products[:solidus_snapback_cap] = Spree::Product.find_by!(name: "Solidus Snapback Cap")
11
+ products[:solidus_hoodie] = Spree::Product.find_by!(name: "Solidus Hoodie Zip")
12
+ products[:ruby_hoodie] = Spree::Product.find_by!(name: "Ruby Hoodie")
13
+ products[:ruby_hoodie_zip] = Spree::Product.find_by!(name: "Ruby Hoodie Zip")
14
+ products[:ruby_polo] = Spree::Product.find_by!(name: "Ruby Polo")
15
+ products[:solidus_mug] = Spree::Product.find_by!(name: "Solidus Mug")
16
+ products[:ruby_mug] = Spree::Product.find_by!(name: "Ruby Mug")
17
+ products[:solidus_tote] = Spree::Product.find_by!(name: "Solidus Tote")
18
+ products[:ruby_tote] = Spree::Product.find_by!(name: "Ruby Tote")
16
19
 
17
- def image(name, type = "jpeg")
20
+ def image(name, type = "jpg")
18
21
  images_path = Pathname.new(File.dirname(__FILE__)) + "images"
19
22
  path = images_path + "#{name}.#{type}"
23
+
20
24
  return false if !File.exist?(path)
25
+
21
26
  path
22
27
  end
23
28
 
24
29
  images = {
25
- products[:ror_tote].master => [
30
+ products[:solidus_tshirt].master => [
26
31
  {
27
- attachment: image("ror_tote")
32
+ attachment: image("solidus_tshirt")
28
33
  },
29
34
  {
30
- attachment: image("ror_tote_back")
35
+ attachment: image("solidus_tshirt_back")
31
36
  }
32
37
  ],
33
- products[:ror_bag].master => [
38
+ products[:solidus_long].master => [
34
39
  {
35
- attachment: image("ror_bag")
40
+ attachment: image("solidus_long")
41
+ },
42
+ {
43
+ attachment: image("solidus_long_back")
36
44
  }
37
45
  ],
38
- products[:ror_baseball_jersey].master => [
46
+ products[:solidus_snapback_cap].master => [
39
47
  {
40
- attachment: image("ror_baseball")
41
- },
42
- {
43
- attachment: image("ror_baseball_back")
48
+ attachment: image("solidus_snapback_cap")
44
49
  }
45
50
  ],
46
- products[:ror_jr_spaghetti].master => [
51
+ products[:solidus_hoodie].master => [
47
52
  {
48
- attachment: image("ror_jr_spaghetti")
53
+ attachment: image("solidus_hoodie")
49
54
  }
50
55
  ],
51
- products[:ror_mug].master => [
56
+ products[:ruby_hoodie].master => [
52
57
  {
53
- attachment: image("ror_mug")
54
- },
58
+ attachment: image("ruby_hoodie")
59
+ }
60
+ ],
61
+ products[:ruby_hoodie_zip].master => [
55
62
  {
56
- attachment: image("ror_mug_back")
63
+ attachment: image("ruby_hoodie_zip")
57
64
  }
58
65
  ],
59
- products[:ror_ringer].master => [
66
+ products[:ruby_polo].master => [
60
67
  {
61
- attachment: image("ror_ringer")
68
+ attachment: image("ruby_polo")
62
69
  },
63
70
  {
64
- attachment: image("ror_ringer_back")
71
+ attachment: image("ruby_polo_back")
65
72
  }
66
73
  ],
67
- products[:ror_stein].master => [
74
+ products[:solidus_mug].master => [
68
75
  {
69
- attachment: image("ror_stein")
70
- },
76
+ attachment: image("solidus_mug")
77
+ }
78
+ ],
79
+ products[:ruby_mug].master => [
71
80
  {
72
- attachment: image("ror_stein_back")
81
+ attachment: image("ruby_mug")
73
82
  }
74
83
  ],
75
- products[:apache_baseball_jersey].master => [
84
+ products[:solidus_tote].master => [
76
85
  {
77
- attachment: image("apache_baseball", "png")
86
+ attachment: image("tote_bag_solidus")
78
87
  }
79
88
  ],
80
- products[:ruby_baseball_jersey].master => [
89
+ products[:ruby_tote].master => [
81
90
  {
82
- attachment: image("ruby_baseball", "png")
91
+ attachment: image("tote_bag_ruby")
92
+ }
93
+ ],
94
+ products[:solidus_girly].master => [
95
+ {
96
+ attachment: image("solidus_girly")
83
97
  }
84
98
  ]
85
99
  }
86
100
 
87
- products[:ror_baseball_jersey].variants.each do |variant|
101
+ products[:solidus_tshirt].variants.each do |variant|
88
102
  color = variant.option_value("tshirt-color").downcase
89
- main_image = image("ror_baseball_jersey_#{color}", "png")
103
+ main_image = image("solidus_tshirt_#{color}", "png")
90
104
  File.open(main_image) do |f|
91
105
  variant.images.create!(attachment: f)
92
106
  end
93
- back_image = image("ror_baseball_jersey_back_#{color}", "png")
107
+ back_image = image("solidus_tshirt_back_#{color}", "png")
108
+
94
109
  next unless back_image
110
+
95
111
  File.open(back_image) do |f|
96
112
  variant.images.create!(attachment: f)
97
113
  end
98
114
  end
99
115
 
116
+ products[:solidus_long].variants.each do |variant|
117
+ color = variant.option_value("tshirt-color").downcase
118
+ main_image = image("solidus_long_#{color}", "png")
119
+ File.open(main_image) do |f|
120
+ variant.images.create!(attachment: f)
121
+ end
122
+ back_image = image("solidus_long_back_#{color}", "png")
123
+
124
+ next unless back_image
125
+
126
+ File.open(back_image) do |f|
127
+ variant.images.create!(attachment: f)
128
+ end
129
+ end
130
+
131
+ products[:solidus_girly].reload.variants.each do |variant|
132
+ color = variant.option_value("tshirt-color").downcase
133
+ main_image = image("solidus_girly_#{color}", "png")
134
+ File.open(main_image) do |f|
135
+ variant.images.create!(attachment: f)
136
+ end
137
+ end
138
+
100
139
  images.each do |variant, attachments|
101
140
  puts "Loading images for #{variant.product.name}"
102
141
  attachments.each do |attachment|
@@ -33,12 +33,24 @@ Spree::OptionValue.create!([
33
33
  {
34
34
  name: "Red",
35
35
  presentation: "Red",
36
- position: 1,
36
+ position: 5,
37
37
  option_type: color
38
38
  },
39
39
  {
40
40
  name: "Green",
41
41
  presentation: "Green",
42
+ position: 4,
43
+ option_type: color
44
+ },
45
+ {
46
+ name: "Black",
47
+ presentation: "Black",
48
+ position: 1,
49
+ option_type: color
50
+ },
51
+ {
52
+ name: "White",
53
+ presentation: "White",
42
54
  position: 2,
43
55
  option_type: color
44
56
  },
@@ -28,20 +28,20 @@ orders << Spree::Order.create!(
28
28
  )
29
29
 
30
30
  orders[0].line_items.create!(
31
- variant: Spree::Product.find_by!(name: "Ruby on Rails Tote").master,
31
+ variant: Spree::Product.find_by!(name: "Solidus Tote").master,
32
32
  quantity: 1,
33
33
  price: 15.99
34
34
  )
35
35
 
36
36
  orders[1].line_items.create!(
37
- variant: Spree::Product.find_by!(name: "Ruby on Rails Bag").master,
37
+ variant: Spree::Product.find_by!(name: "Solidus Snapback Cap").master,
38
38
  quantity: 1,
39
39
  price: 22.99
40
40
  )
41
41
 
42
42
  orders.each do |order|
43
43
  order.payments.create!(payment_method: payment_method)
44
- order.update_attributes(store: store)
44
+ order.update(store: store)
45
45
 
46
46
  order.next! while !order.can_complete?
47
47
  order.complete!
@@ -5,6 +5,6 @@ Spree::Sample.load_sample("products")
5
5
  size = Spree::OptionType.find_by!(presentation: "Size")
6
6
  color = Spree::OptionType.find_by!(presentation: "Color")
7
7
 
8
- ror_baseball_jersey = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey")
9
- ror_baseball_jersey.option_types = [size, color]
10
- ror_baseball_jersey.save!
8
+ solidus_tshirt = Spree::Product.find_by!(name: "Solidus T-Shirt")
9
+ solidus_tshirt.option_types = [size, color]
10
+ solidus_tshirt.save!
@@ -2,60 +2,110 @@
2
2
 
3
3
  products =
4
4
  {
5
- "Ruby on Rails Baseball Jersey" =>
5
+ "Solidus Tote" =>
6
+ {
7
+ "Type" => "Tote",
8
+ "Size" => %{15" x 18" x 6"},
9
+ "Material" => "Canvas"
10
+ },
11
+ "Ruby Tote" =>
12
+ {
13
+ "Type" => "Tote",
14
+ "Size" => %{15" x 18" x 6"},
15
+ "Material" => "Canvas"
16
+ },
17
+ "Solidus Snapback Cap" =>
18
+ {
19
+ "Type" => "Snapback Cap",
20
+ "Size" => "One Size",
21
+ "Material" => "100% Cotton"
22
+ },
23
+ "Solidus T-Shirt" =>
24
+ {
25
+ "Manufacturer" => "Jerseys",
26
+ "Brand" => "Conditioned",
27
+ "Model" => "TL9002",
28
+ "Shirt Type" => "Ringer T",
29
+ "Sleeve Type" => "Short",
30
+ "Made from" => "100% Cotton",
31
+ "Fit" => "Loose",
32
+ "Gender" => "Men's"
33
+ },
34
+ "Solidus Long Sleeve" =>
6
35
  {
7
36
  "Manufacturer" => "Wilson",
8
37
  "Brand" => "Wannabe Sports",
9
- "Model" => "JK1002",
10
- "Shirt Type" => "Baseball Jersey",
38
+ "Model" => "TL9002",
39
+ "Shirt Type" => "Jersey",
11
40
  "Sleeve Type" => "Long",
12
41
  "Made from" => "100% cotton",
13
42
  "Fit" => "Loose",
14
43
  "Gender" => "Men's"
15
44
  },
16
- "Ruby on Rails Jr. Spaghetti" =>
45
+ "Solidus Hoodie Zip" =>
17
46
  {
18
47
  "Manufacturer" => "Jerseys",
48
+ "Brand" => "Wannabe Sports",
49
+ "Model" => "HD9001",
50
+ "Shirt Type" => "Jersey",
51
+ "Sleeve Type" => "Long",
52
+ "Made from" => "100% cotton",
53
+ "Fit" => "Loose",
54
+ "Gender" => "Unisex"
55
+ },
56
+ "Ruby Hoodie" =>
57
+ {
58
+ "Manufacturer" => "Wilson",
19
59
  "Brand" => "Resiliance",
20
- "Model" => "TL174",
21
- "Shirt Type" => "Jr. Spaghetti T",
22
- "Sleeve Type" => "None",
60
+ "Model" => "HD2001",
61
+ "Shirt Type" => "Baseball",
62
+ "Sleeve Type" => "Long",
23
63
  "Made from" => "90% Cotton, 10% Nylon",
24
- "Fit" => "Form",
25
- "Gender" => "Women's"
64
+ "Fit" => "Loose",
65
+ "Gender" => "Unisex"
26
66
  },
27
- "Ruby on Rails Ringer T-Shirt" =>
67
+ "Ruby Hoodie Zip" =>
28
68
  {
29
69
  "Manufacturer" => "Jerseys",
30
- "Brand" => "Conditioned",
31
- "Model" => "TL9002",
32
- "Shirt Type" => "Ringer T",
33
- "Sleeve Type" => "Short",
34
- "Made from" => "100% Vellum",
70
+ "Brand" => "Wannabe Sports",
71
+ "Model" => "HD9001",
72
+ "Shirt Type" => "Jersey",
73
+ "Sleeve Type" => "Long",
74
+ "Made from" => "100% cotton",
35
75
  "Fit" => "Loose",
36
- "Gender" => "Men's"
76
+ "Gender" => "Unisex"
37
77
  },
38
- "Ruby on Rails Tote" =>
78
+ "Ruby Polo" =>
39
79
  {
40
- "Type" => "Tote",
41
- "Size" => %{15" x 18" x 6"},
42
- "Material" => "Canvas"
80
+ "Manufacturer" => "Wilson",
81
+ "Brand" => "Resiliance",
82
+ "Model" => "PL9001",
83
+ "Shirt Type" => "Ringer T",
84
+ "Sleeve Type" => "Short",
85
+ "Made from" => "100% Cotton",
86
+ "Fit" => "Slim",
87
+ "Gender" => "Men's"
43
88
  },
44
- "Ruby on Rails Bag" =>
89
+ "Solidus Mug" =>
45
90
  {
46
- "Type" => "Messenger",
47
- "Size" => %{14 1/2" x 12" x 5"},
48
- "Material" => "600 Denier Polyester"
91
+ "Type" => "Mug",
92
+ "Size" => %{4.5" tall, 3.25" dia.}
49
93
  },
50
- "Ruby on Rails Mug" =>
94
+ "Ruby Mug" =>
51
95
  {
52
96
  "Type" => "Mug",
53
97
  "Size" => %{4.5" tall, 3.25" dia.}
54
98
  },
55
- "Ruby on Rails Stein" =>
99
+ "Solidus Girly" =>
56
100
  {
57
- "Type" => "Stein",
58
- "Size" => %{6.75" tall, 3.75" dia. base, 3" dia. rim}
101
+ "Manufacturer" => "Jerseys",
102
+ "Brand" => "Conditioned",
103
+ "Model" => "WM6001",
104
+ "Shirt Type" => "Skinny",
105
+ "Sleeve Type" => "Short",
106
+ "Made from" => "90% Cotton, 10% Nylon",
107
+ "Fit" => "Slim",
108
+ "Gender" => "Women's"
59
109
  }
60
110
  }
61
111