solidus_sample 1.2.3 → 1.3.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a39ec85d3ff3df1b453e9a8b58c9c9a42ddfd4c5
4
- data.tar.gz: 1038ed2209ba164d6115ad465eac08e06efa456c
3
+ metadata.gz: 5a40c101dfb897fbb6d5c26dbce21244f98032e7
4
+ data.tar.gz: 9905529e96ee4352ab7a567b90e35d4b95171f9f
5
5
  SHA512:
6
- metadata.gz: 2ceedcb4764c8a070a524d8da47992e6b7a4bee357489b669911c4c74348a831bd3ae4e7f464f4de1639ff5ea3e9b1c09691cc58bab0f3c0296315441e16ffd1
7
- data.tar.gz: e60e862098f95068314eaf171e72610f597219e873980d42d45719765d02a2b54b57dc21e63e4a66c6f403d5123e26e101e34157b63db01d478412f1022a5c97
6
+ metadata.gz: d4ced38353a704621855f5f9d89f6dd126cea563f2e191eda76fe0e190e5fd9b3a955be73da5be1de9f5786c9c96494fadcd566b21b7e3451c295ce40e8a6df6
7
+ data.tar.gz: afbf595ce9a7356620c9d62786b5dc5508fcebd3ceccf9549f9f9aed53a4e3cc6d1f888723555863723b4de4cbfc6b468fe52e8c06483bf4a4ff53b71e49a8c6
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
- eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb'))
1
+ eval_gemfile File.expand_path('../../common_spree_dependencies.rb', __FILE__)
2
2
 
3
- gem 'solidus_core', :path => '../core'
3
+ gem 'solidus_core', path: '../core'
4
4
 
5
5
  gemspec
data/Rakefile CHANGED
@@ -11,4 +11,4 @@ task :test_app do
11
11
  end
12
12
 
13
13
  RSpec::Core::RakeTask.new
14
- task :default => :spec
14
+ task default: :spec
@@ -3,24 +3,24 @@ new_york = Spree::State.find_by_name!("New York")
3
3
 
4
4
  # Billing address
5
5
  Spree::Address.create!(
6
- :firstname => Faker::Name.first_name,
7
- :lastname => Faker::Name.last_name,
8
- :address1 => Faker::Address.street_address,
9
- :address2 => Faker::Address.secondary_address,
10
- :city => Faker::Address.city,
11
- :state => new_york,
12
- :zipcode => 16804,
13
- :country => united_states,
14
- :phone => Faker::PhoneNumber.phone_number)
6
+ firstname: FFaker::Name.first_name,
7
+ lastname: FFaker::Name.last_name,
8
+ address1: FFaker::Address.street_address,
9
+ address2: FFaker::Address.secondary_address,
10
+ city: FFaker::Address.city,
11
+ state: new_york,
12
+ zipcode: 16_804,
13
+ country: united_states,
14
+ phone: FFaker::PhoneNumber.phone_number)
15
15
 
16
- #Shipping address
16
+ # Shipping address
17
17
  Spree::Address.create!(
18
- :firstname => Faker::Name.first_name,
19
- :lastname => Faker::Name.last_name,
20
- :address1 => Faker::Address.street_address,
21
- :address2 => Faker::Address.secondary_address,
22
- :city => Faker::Address.city,
23
- :state => new_york,
24
- :zipcode => 16804,
25
- :country => united_states,
26
- :phone => Faker::PhoneNumber.phone_number)
18
+ firstname: FFaker::Name.first_name,
19
+ lastname: FFaker::Name.last_name,
20
+ address1: FFaker::Address.street_address,
21
+ address2: FFaker::Address.secondary_address,
22
+ city: FFaker::Address.city,
23
+ state: new_york,
24
+ zipcode: 16_804,
25
+ country: united_states,
26
+ phone: FFaker::PhoneNumber.phone_number)
data/db/samples/assets.rb CHANGED
@@ -2,7 +2,7 @@ Spree::Sample.load_sample("products")
2
2
  Spree::Sample.load_sample("variants")
3
3
 
4
4
  products = {}
5
- products[:ror_baseball_jersey] = Spree::Product.find_by_name!("Ruby on Rails Baseball Jersey")
5
+ products[:ror_baseball_jersey] = Spree::Product.find_by_name!("Ruby on Rails Baseball Jersey")
6
6
  products[:ror_tote] = Spree::Product.find_by_name!("Ruby on Rails Tote")
7
7
  products[:ror_bag] = Spree::Product.find_by_name!("Ruby on Rails Bag")
8
8
  products[:ror_jr_spaghetti] = Spree::Product.find_by_name!("Ruby on Rails Jr. Spaghetti")
@@ -12,8 +12,7 @@ products[:ror_stein] = Spree::Product.find_by_name!("Ruby on Rails Stein")
12
12
  products[:ruby_baseball_jersey] = Spree::Product.find_by_name!("Ruby Baseball Jersey")
13
13
  products[:apache_baseball_jersey] = Spree::Product.find_by_name!("Apache Baseball Jersey")
14
14
 
15
-
16
- def image(name, type="jpeg")
15
+ def image(name, type = "jpeg")
17
16
  images_path = Pathname.new(File.dirname(__FILE__)) + "images"
18
17
  path = images_path + "#{name}.#{type}"
19
18
  return false if !File.exist?(path)
@@ -23,63 +22,63 @@ end
23
22
  images = {
24
23
  products[:ror_tote].master => [
25
24
  {
26
- :attachment => image("ror_tote")
25
+ attachment: image("ror_tote")
27
26
  },
28
27
  {
29
- :attachment => image("ror_tote_back")
28
+ attachment: image("ror_tote_back")
30
29
  }
31
30
  ],
32
31
  products[:ror_bag].master => [
33
32
  {
34
- :attachment => image("ror_bag")
33
+ attachment: image("ror_bag")
35
34
  }
36
35
  ],
37
36
  products[:ror_baseball_jersey].master => [
38
37
  {
39
- :attachment => image("ror_baseball")
38
+ attachment: image("ror_baseball")
40
39
  },
41
40
  {
42
- :attachment => image("ror_baseball_back")
41
+ attachment: image("ror_baseball_back")
43
42
  }
44
43
  ],
45
44
  products[:ror_jr_spaghetti].master => [
46
45
  {
47
- :attachment => image("ror_jr_spaghetti")
46
+ attachment: image("ror_jr_spaghetti")
48
47
  }
49
48
  ],
50
49
  products[:ror_mug].master => [
51
50
  {
52
- :attachment => image("ror_mug")
51
+ attachment: image("ror_mug")
53
52
  },
54
53
  {
55
- :attachment => image("ror_mug_back")
54
+ attachment: image("ror_mug_back")
56
55
  }
57
56
  ],
58
57
  products[:ror_ringer].master => [
59
58
  {
60
- :attachment => image("ror_ringer")
59
+ attachment: image("ror_ringer")
61
60
  },
62
61
  {
63
- :attachment => image("ror_ringer_back")
62
+ attachment: image("ror_ringer_back")
64
63
  }
65
64
  ],
66
65
  products[:ror_stein].master => [
67
66
  {
68
- :attachment => image("ror_stein")
67
+ attachment: image("ror_stein")
69
68
  },
70
69
  {
71
- :attachment => image("ror_stein_back")
70
+ attachment: image("ror_stein_back")
72
71
  }
73
72
  ],
74
73
  products[:apache_baseball_jersey].master => [
75
74
  {
76
- :attachment => image("apache_baseball", "png")
77
- },
75
+ attachment: image("apache_baseball", "png")
76
+ }
78
77
  ],
79
78
  products[:ruby_baseball_jersey].master => [
80
79
  {
81
- :attachment => image("ruby_baseball", "png")
82
- },
80
+ attachment: image("ruby_baseball", "png")
81
+ }
83
82
  ]
84
83
  }
85
84
 
@@ -87,13 +86,12 @@ products[:ror_baseball_jersey].variants.each do |variant|
87
86
  color = variant.option_value("tshirt-color").downcase
88
87
  main_image = image("ror_baseball_jersey_#{color}", "png")
89
88
  File.open(main_image) do |f|
90
- variant.images.create!(:attachment => f)
89
+ variant.images.create!(attachment: f)
91
90
  end
92
91
  back_image = image("ror_baseball_jersey_back_#{color}", "png")
93
- if back_image
94
- File.open(back_image) do |f|
95
- variant.images.create!(:attachment => f)
96
- end
92
+ next unless back_image
93
+ File.open(back_image) do |f|
94
+ variant.images.create!(attachment: f)
97
95
  end
98
96
  end
99
97
 
@@ -105,4 +103,3 @@ images.each do |variant, attachments|
105
103
  end
106
104
  end
107
105
  end
108
-
@@ -1,12 +1,12 @@
1
1
  Spree::OptionType.create!([
2
2
  {
3
- :name => "tshirt-size",
4
- :presentation => "Size",
5
- :position => 1
3
+ name: "tshirt-size",
4
+ presentation: "Size",
5
+ position: 1
6
6
  },
7
7
  {
8
- :name => "tshirt-color",
9
- :presentation => "Color",
10
- :position => 2
8
+ name: "tshirt-color",
9
+ presentation: "Color",
10
+ position: 2
11
11
  }
12
12
  ])
@@ -5,45 +5,45 @@ color = Spree::OptionType.find_by_presentation!("Color")
5
5
 
6
6
  Spree::OptionValue.create!([
7
7
  {
8
- :name => "Small",
9
- :presentation => "S",
10
- :position => 1,
11
- :option_type => size
8
+ name: "Small",
9
+ presentation: "S",
10
+ position: 1,
11
+ option_type: size
12
12
  },
13
13
  {
14
- :name => "Medium",
15
- :presentation => "M",
16
- :position => 2,
17
- :option_type => size
14
+ name: "Medium",
15
+ presentation: "M",
16
+ position: 2,
17
+ option_type: size
18
18
  },
19
19
  {
20
- :name => "Large",
21
- :presentation => "L",
22
- :position => 3,
23
- :option_type => size
20
+ name: "Large",
21
+ presentation: "L",
22
+ position: 3,
23
+ option_type: size
24
24
  },
25
25
  {
26
- :name => "Extra Large",
27
- :presentation => "XL",
28
- :position => 4,
29
- :option_type => size
26
+ name: "Extra Large",
27
+ presentation: "XL",
28
+ position: 4,
29
+ option_type: size
30
30
  },
31
31
  {
32
- :name => "Red",
33
- :presentation => "Red",
34
- :position => 1,
35
- :option_type => color,
32
+ name: "Red",
33
+ presentation: "Red",
34
+ position: 1,
35
+ option_type: color
36
36
  },
37
37
  {
38
- :name => "Green",
39
- :presentation => "Green",
40
- :position => 2,
41
- :option_type => color,
38
+ name: "Green",
39
+ presentation: "Green",
40
+ position: 2,
41
+ option_type: color
42
42
  },
43
43
  {
44
- :name => "Blue",
45
- :presentation => "Blue",
46
- :position => 3,
47
- :option_type => color
44
+ name: "Blue",
45
+ presentation: "Blue",
46
+ position: 3,
47
+ option_type: color
48
48
  }
49
- ])
49
+ ])
data/db/samples/orders.rb CHANGED
@@ -6,32 +6,32 @@ store = Spree::Store.first!
6
6
 
7
7
  orders = []
8
8
  orders << Spree::Order.create!(
9
- :number => "R123456789",
10
- :email => "spree@example.com",
11
- :item_total => 150.95,
12
- :adjustment_total => 150.95,
13
- :total => 301.90,
14
- :shipping_address => Spree::Address.first,
15
- :billing_address => Spree::Address.last)
9
+ number: "R123456789",
10
+ email: "spree@example.com",
11
+ item_total: 150.95,
12
+ adjustment_total: 150.95,
13
+ total: 301.90,
14
+ shipping_address: Spree::Address.first,
15
+ billing_address: Spree::Address.last)
16
16
 
17
17
  orders << Spree::Order.create!(
18
- :number => "R987654321",
19
- :email => "spree@example.com",
20
- :item_total => 15.95,
21
- :adjustment_total => 15.95,
22
- :total => 31.90,
23
- :shipping_address => Spree::Address.first,
24
- :billing_address => Spree::Address.last)
18
+ number: "R987654321",
19
+ email: "spree@example.com",
20
+ item_total: 15.95,
21
+ adjustment_total: 15.95,
22
+ total: 31.90,
23
+ shipping_address: Spree::Address.first,
24
+ billing_address: Spree::Address.last)
25
25
 
26
26
  orders[0].line_items.create!(
27
- :variant => Spree::Product.find_by_name!("Ruby on Rails Tote").master,
28
- :quantity => 1,
29
- :price => 15.99)
27
+ variant: Spree::Product.find_by_name!("Ruby on Rails Tote").master,
28
+ quantity: 1,
29
+ price: 15.99)
30
30
 
31
31
  orders[1].line_items.create!(
32
- :variant => Spree::Product.find_by_name!("Ruby on Rails Bag").master,
33
- :quantity => 1,
34
- :price => 22.99)
32
+ variant: Spree::Product.find_by_name!("Ruby on Rails Bag").master,
33
+ quantity: 1,
34
+ price: 22.99)
35
35
 
36
36
  orders.each do |order|
37
37
  order.payments.create!(payment_method: payment_method)
@@ -1,15 +1,15 @@
1
1
  Spree::Gateway::Bogus.create!(
2
2
  {
3
- :name => "Credit Card",
4
- :description => "Bogus payment gateway",
5
- :active => true
3
+ name: "Credit Card",
4
+ description: "Bogus payment gateway",
5
+ active: true
6
6
  }
7
7
  )
8
8
 
9
9
  Spree::PaymentMethod::Check.create!(
10
10
  {
11
- :name => "Check",
12
- :description => "Pay by check.",
13
- :active => true
11
+ name: "Check",
12
+ description: "Pay by check.",
13
+ active: true
14
14
  }
15
15
  )
@@ -1,22 +1,15 @@
1
1
  # create payments based on the totals since they can't be known in YAML (quantities are random)
2
- method = Spree::PaymentMethod.where(:name => 'Credit Card', :active => true).first
3
-
4
- # Hack the current method so we're able to return a gateway without a RAILS_ENV
5
- Spree::Gateway.class_eval do
6
- def self.current
7
- Spree::Gateway::Bogus.new
8
- end
9
- end
2
+ method = Spree::PaymentMethod.where(name: 'Credit Card', active: true).first
10
3
 
11
4
  # This table was previously called spree_creditcards, and older migrations
12
5
  # reference it as such. Make it explicit here that this table has been renamed.
13
6
  Spree::CreditCard.table_name = 'spree_credit_cards'
14
7
 
15
- creditcard = Spree::CreditCard.create(:cc_type => 'visa', :month => 12, :year => 2.years.from_now.year, :last_digits => '1111',
16
- :name => 'Sean Schofield', :gateway_customer_profile_id => 'BGS-1234')
8
+ creditcard = Spree::CreditCard.create(cc_type: 'visa', month: 12, year: 2.years.from_now.year, last_digits: '1111',
9
+ name: 'Sean Schofield', gateway_customer_profile_id: 'BGS-1234')
17
10
 
18
- Spree::Order.all.each_with_index do |order, index|
11
+ Spree::Order.all.each_with_index do |order, _index|
19
12
  order.update!
20
- payment = order.payments.create!(:amount => order.total, :source => creditcard.clone, :payment_method => method)
21
- payment.update_columns(:state => 'pending', :response_code => '12345')
13
+ payment = order.payments.create!(amount: order.total, source: creditcard.clone, payment_method: method)
14
+ payment.update_columns(state: 'pending', response_code: '12345')
22
15
  end
@@ -6,4 +6,3 @@ color = Spree::OptionType.find_by_presentation!("Color")
6
6
  ror_baseball_jersey = Spree::Product.find_by_name!("Ruby on Rails Baseball Jersey")
7
7
  ror_baseball_jersey.option_types = [size, color]
8
8
  ror_baseball_jersey.save!
9
-
@@ -1,7 +1,7 @@
1
1
  products =
2
- {
3
- "Ruby on Rails Baseball Jersey" =>
4
- {
2
+ {
3
+ "Ruby on Rails Baseball Jersey" =>
4
+ {
5
5
  "Manufacturer" => "Wilson",
6
6
  "Brand" => "Wannabe Sports",
7
7
  "Model" => "JK1002",
@@ -36,24 +36,24 @@ products =
36
36
  "Ruby on Rails Tote" =>
37
37
  {
38
38
  "Type" => "Tote",
39
- "Size" => %Q{15" x 18" x 6"},
39
+ "Size" => %{15" x 18" x 6"},
40
40
  "Material" => "Canvas"
41
41
  },
42
42
  "Ruby on Rails Bag" =>
43
43
  {
44
44
  "Type" => "Messenger",
45
- "Size" => %Q{14 1/2" x 12" x 5"},
45
+ "Size" => %{14 1/2" x 12" x 5"},
46
46
  "Material" => "600 Denier Polyester"
47
47
  },
48
- "Ruby on Rails Mug" =>
48
+ "Ruby on Rails Mug" =>
49
49
  {
50
50
  "Type" => "Mug",
51
- "Size" => %Q{4.5" tall, 3.25" dia.}
51
+ "Size" => %{4.5" tall, 3.25" dia.}
52
52
  },
53
53
  "Ruby on Rails Stein" =>
54
54
  {
55
55
  "Type" => "Stein",
56
- "Size" => %Q{6.75" tall, 3.75" dia. base, 3" dia. rim}
56
+ "Size" => %{6.75" tall, 3.75" dia. base, 3" dia. rim}
57
57
  }
58
58
  }
59
59
 
@@ -5,72 +5,72 @@ tax_category = Spree::TaxCategory.find_by_name!("Default")
5
5
  shipping_category = Spree::ShippingCategory.find_by_name!("Default")
6
6
 
7
7
  default_attrs = {
8
- description: Faker::Lorem.paragraph,
8
+ description: FFaker::Lorem.paragraph,
9
9
  available_on: Time.current
10
10
  }
11
11
 
12
12
  products = [
13
13
  {
14
- :name => "Ruby on Rails Tote",
15
- :tax_category => tax_category,
16
- :shipping_category => shipping_category,
17
- :price => 15.99,
18
- :eur_price => 14,
14
+ name: "Ruby on Rails Tote",
15
+ tax_category: tax_category,
16
+ shipping_category: shipping_category,
17
+ price: 15.99,
18
+ eur_price: 14
19
19
  },
20
20
  {
21
- :name => "Ruby on Rails Bag",
22
- :tax_category => tax_category,
23
- :shipping_category => shipping_category,
24
- :price => 22.99,
25
- :eur_price => 19,
21
+ name: "Ruby on Rails Bag",
22
+ tax_category: tax_category,
23
+ shipping_category: shipping_category,
24
+ price: 22.99,
25
+ eur_price: 19
26
26
  },
27
27
  {
28
- :name => "Ruby on Rails Baseball Jersey",
29
- :tax_category => tax_category,
30
- :shipping_category => shipping_category,
31
- :price => 19.99,
32
- :eur_price => 16
28
+ name: "Ruby on Rails Baseball Jersey",
29
+ tax_category: tax_category,
30
+ shipping_category: shipping_category,
31
+ price: 19.99,
32
+ eur_price: 16
33
33
  },
34
34
  {
35
- :name => "Ruby on Rails Jr. Spaghetti",
36
- :tax_category => tax_category,
37
- :shipping_category => shipping_category,
38
- :price => 19.99,
39
- :eur_price => 16
35
+ name: "Ruby on Rails Jr. Spaghetti",
36
+ tax_category: tax_category,
37
+ shipping_category: shipping_category,
38
+ price: 19.99,
39
+ eur_price: 16
40
40
 
41
41
  },
42
42
  {
43
- :name => "Ruby on Rails Ringer T-Shirt",
44
- :shipping_category => shipping_category,
45
- :tax_category => tax_category,
46
- :price => 19.99,
47
- :eur_price => 16
43
+ name: "Ruby on Rails Ringer T-Shirt",
44
+ shipping_category: shipping_category,
45
+ tax_category: tax_category,
46
+ price: 19.99,
47
+ eur_price: 16
48
48
  },
49
49
  {
50
- :name => "Ruby Baseball Jersey",
51
- :tax_category => tax_category,
52
- :shipping_category => shipping_category,
53
- :price => 19.99,
54
- :eur_price => 16
50
+ name: "Ruby Baseball Jersey",
51
+ tax_category: tax_category,
52
+ shipping_category: shipping_category,
53
+ price: 19.99,
54
+ eur_price: 16
55
55
  },
56
56
  {
57
- :name => "Apache Baseball Jersey",
58
- :tax_category => tax_category,
59
- :shipping_category => shipping_category,
60
- :price => 19.99,
61
- :eur_price => 16
57
+ name: "Apache Baseball Jersey",
58
+ tax_category: tax_category,
59
+ shipping_category: shipping_category,
60
+ price: 19.99,
61
+ eur_price: 16
62
62
  },
63
63
  {
64
- :name => "Ruby on Rails Mug",
65
- :shipping_category => shipping_category,
66
- :price => 13.99,
67
- :eur_price => 12
64
+ name: "Ruby on Rails Mug",
65
+ shipping_category: shipping_category,
66
+ price: 13.99,
67
+ eur_price: 12
68
68
  },
69
69
  {
70
- :name => "Ruby on Rails Stein",
71
- :shipping_category => shipping_category,
72
- :price => 16.99,
73
- :eur_price => 14
70
+ name: "Ruby on Rails Stein",
71
+ shipping_category: shipping_category,
72
+ price: 16.99,
73
+ eur_price: 14
74
74
  }
75
75
  ]
76
76
 
@@ -1,20 +1,20 @@
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
 
16
16
  prototypes.each do |prototype_attrs|
17
- prototype = Spree::Prototype.create!(:name => prototype_attrs[:name])
17
+ prototype = Spree::Prototype.create!(name: prototype_attrs[:name])
18
18
  prototype_attrs[:properties].each do |property|
19
19
  prototype.properties << Spree::Property.find_by_name!(property)
20
20
  end
@@ -1 +1 @@
1
- Spree::ShippingCategory.find_or_create_by!(:name => "Default")
1
+ Spree::ShippingCategory.find_or_create_by!(name: "Default")
@@ -12,39 +12,39 @@ shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default')
12
12
 
13
13
  Spree::ShippingMethod.create!([
14
14
  {
15
- :name => "UPS Ground (USD)",
16
- :zones => [north_america],
17
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
18
- :tax_category => tax_category,
19
- :shipping_categories => [shipping_category]
15
+ name: "UPS Ground (USD)",
16
+ zones: [north_america],
17
+ calculator: Spree::Calculator::Shipping::FlatRate.create!,
18
+ tax_category: tax_category,
19
+ shipping_categories: [shipping_category]
20
20
  },
21
21
  {
22
- :name => "UPS Two Day (USD)",
23
- :zones => [north_america],
24
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
25
- :tax_category => tax_category,
26
- :shipping_categories => [shipping_category]
22
+ name: "UPS Two Day (USD)",
23
+ zones: [north_america],
24
+ calculator: Spree::Calculator::Shipping::FlatRate.create!,
25
+ tax_category: tax_category,
26
+ shipping_categories: [shipping_category]
27
27
  },
28
28
  {
29
- :name => "UPS One Day (USD)",
30
- :zones => [north_america],
31
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
32
- :tax_category => tax_category,
33
- :shipping_categories => [shipping_category]
29
+ name: "UPS One Day (USD)",
30
+ zones: [north_america],
31
+ calculator: Spree::Calculator::Shipping::FlatRate.create!,
32
+ tax_category: tax_category,
33
+ shipping_categories: [shipping_category]
34
34
  },
35
35
  {
36
- :name => "UPS Ground (EU)",
37
- :zones => [europe_vat],
38
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
39
- :tax_category => tax_category,
40
- :shipping_categories => [shipping_category]
36
+ name: "UPS Ground (EU)",
37
+ zones: [europe_vat],
38
+ calculator: Spree::Calculator::Shipping::FlatRate.create!,
39
+ tax_category: tax_category,
40
+ shipping_categories: [shipping_category]
41
41
  },
42
42
  {
43
- :name => "UPS Ground (EUR)",
44
- :zones => [europe_vat],
45
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
46
- :tax_category => tax_category,
47
- :shipping_categories => [shipping_category]
43
+ name: "UPS Ground (EUR)",
44
+ zones: [europe_vat],
45
+ calculator: Spree::Calculator::Shipping::FlatRate.create!,
46
+ tax_category: tax_category,
47
+ shipping_categories: [shipping_category]
48
48
  }
49
49
  ])
50
50
 
@@ -63,4 +63,3 @@ Spree::ShippingMethod.create!([
63
63
  shipping_method.calculator.save!
64
64
  shipping_method.save!
65
65
  end
66
-
data/db/samples/stock.rb CHANGED
@@ -7,6 +7,6 @@ location.save!
7
7
 
8
8
  Spree::Variant.all.each do |variant|
9
9
  variant.stock_items.each do |stock_item|
10
- Spree::StockMovement.create(:quantity => 10, :stock_item => stock_item)
10
+ Spree::StockMovement.create(quantity: 10, stock_item: stock_item)
11
11
  end
12
12
  end
data/db/samples/stores.rb CHANGED
@@ -2,5 +2,5 @@ Spree::Store.create!(
2
2
  name: "Sample Store",
3
3
  code: "sample-store",
4
4
  url: "solidus.example.com",
5
- mail_from_address: "store@example.com",
5
+ mail_from_address: "store@example.com"
6
6
  )
@@ -1 +1 @@
1
- Spree::TaxCategory.find_or_create_by!(:name => "Default")
1
+ Spree::TaxCategory.find_or_create_by!(name: "Default")
@@ -1,9 +1,9 @@
1
1
  north_america = Spree::Zone.find_by_name!("North America")
2
2
  clothing = Spree::TaxCategory.find_by_name!("Default")
3
3
  tax_rate = Spree::TaxRate.create(
4
- :name => "North America",
5
- :zone => north_america,
6
- :amount => 0.05,
7
- :tax_category => clothing)
4
+ name: "North America",
5
+ zone: north_america,
6
+ amount: 0.05,
7
+ tax_category: clothing)
8
8
  tax_rate.calculator = Spree::Calculator::DefaultTax.create!
9
9
  tax_rate.save!
@@ -1,6 +1,6 @@
1
1
  taxonomies = [
2
- { :name => "Categories" },
3
- { :name => "Brand" }
2
+ { name: "Categories" },
3
+ { name: "Brand" }
4
4
  ]
5
5
 
6
6
  taxonomies.each do |taxonomy_attrs|
data/db/samples/taxons.rb CHANGED
@@ -4,109 +4,108 @@ Spree::Sample.load_sample("products")
4
4
  categories = Spree::Taxonomy.find_by_name!("Categories")
5
5
  brands = Spree::Taxonomy.find_by_name!("Brand")
6
6
 
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
- :apache_baseball_jersey => "Apache Baseball Jersey",
16
- :ruby_baseball_jersey => "Ruby Baseball Jersey",
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
+ apache_baseball_jersey: "Apache Baseball Jersey",
16
+ ruby_baseball_jersey: "Ruby Baseball Jersey"
17
17
  }
18
18
 
19
-
20
19
  products.each do |key, name|
21
20
  products[key] = Spree::Product.find_by_name!(name)
22
21
  end
23
22
 
24
23
  taxons = [
25
24
  {
26
- :name => "Categories",
27
- :taxonomy => categories,
28
- :position => 0
25
+ name: "Categories",
26
+ taxonomy: categories,
27
+ position: 0
29
28
  },
30
29
  {
31
- :name => "Bags",
32
- :taxonomy => categories,
33
- :parent => "Categories",
34
- :position => 1,
35
- :products => [
30
+ name: "Bags",
31
+ taxonomy: categories,
32
+ parent: "Categories",
33
+ position: 1,
34
+ products: [
36
35
  products[:ror_tote],
37
36
  products[:ror_bag]
38
37
  ]
39
38
  },
40
39
  {
41
- :name => "Mugs",
42
- :taxonomy => categories,
43
- :parent => "Categories",
44
- :position => 2,
45
- :products => [
40
+ name: "Mugs",
41
+ taxonomy: categories,
42
+ parent: "Categories",
43
+ position: 2,
44
+ products: [
46
45
  products[:ror_mug],
47
46
  products[:ror_stein]
48
47
  ]
49
48
  },
50
49
  {
51
- :name => "Clothing",
52
- :taxonomy => categories,
53
- :parent => "Categories"
50
+ name: "Clothing",
51
+ taxonomy: categories,
52
+ parent: "Categories"
54
53
  },
55
54
  {
56
- :name => "Shirts",
57
- :taxonomy => categories,
58
- :parent => "Clothing",
59
- :position => 0,
60
- :products => [
61
- products[:ror_jr_spaghetti],
55
+ name: "Shirts",
56
+ taxonomy: categories,
57
+ parent: "Clothing",
58
+ position: 0,
59
+ products: [
60
+ products[:ror_jr_spaghetti]
62
61
  ]
63
62
  },
64
63
  {
65
- :name => "T-Shirts",
66
- :taxonomy => categories,
67
- :parent => "Clothing" ,
68
- :products => [
64
+ name: "T-Shirts",
65
+ taxonomy: categories,
66
+ parent: "Clothing",
67
+ products: [
69
68
  products[:ror_baseball_jersey],
70
69
  products[:ror_ringer],
71
70
  products[:apache_baseball_jersey],
72
71
  products[:ruby_baseball_jersey]
73
72
  ],
74
- :position => 0
73
+ position: 0
75
74
  },
76
75
  {
77
- :name => "Brands",
78
- :taxonomy => brands
76
+ name: "Brands",
77
+ taxonomy: brands
79
78
  },
80
79
  {
81
- :name => "Ruby",
82
- :taxonomy => brands,
83
- :parent => "Brand",
84
- :products => [
80
+ name: "Ruby",
81
+ taxonomy: brands,
82
+ parent: "Brand",
83
+ products: [
85
84
  products[:ruby_baseball_jersey]
86
85
  ]
87
86
  },
88
87
  {
89
- :name => "Apache",
90
- :taxonomy => brands,
91
- :parent => "Brand",
92
- :products => [
88
+ name: "Apache",
89
+ taxonomy: brands,
90
+ parent: "Brand",
91
+ products: [
93
92
  products[:apache_baseball_jersey]
94
93
  ]
95
94
  },
96
95
  {
97
- :name => "Rails",
98
- :taxonomy => brands,
99
- :parent => "Brand",
100
- :products => [
96
+ name: "Rails",
97
+ taxonomy: brands,
98
+ parent: "Brand",
99
+ products: [
101
100
  products[:ror_tote],
102
101
  products[:ror_bag],
103
102
  products[:ror_mug],
104
103
  products[:ror_stein],
105
104
  products[:ror_baseball_jersey],
106
105
  products[:ror_jr_spaghetti],
107
- products[:ror_ringer],
106
+ products[:ror_ringer]
108
107
  ]
109
- },
108
+ }
110
109
  ]
111
110
 
112
111
  taxons.each do |taxon_attrs|
@@ -22,103 +22,103 @@ green = Spree::OptionValue.find_by_name!("Green")
22
22
 
23
23
  variants = [
24
24
  {
25
- :product => ror_baseball_jersey,
26
- :option_values => [small, red],
27
- :sku => "ROR-00001",
28
- :cost_price => 17
25
+ product: ror_baseball_jersey,
26
+ option_values: [small, red],
27
+ sku: "ROR-00001",
28
+ cost_price: 17
29
29
  },
30
30
  {
31
- :product => ror_baseball_jersey,
32
- :option_values => [small, blue],
33
- :sku => "ROR-00002",
34
- :cost_price => 17
31
+ product: ror_baseball_jersey,
32
+ option_values: [small, blue],
33
+ sku: "ROR-00002",
34
+ cost_price: 17
35
35
  },
36
36
  {
37
- :product => ror_baseball_jersey,
38
- :option_values => [small, green],
39
- :sku => "ROR-00003",
40
- :cost_price => 17
37
+ product: ror_baseball_jersey,
38
+ option_values: [small, green],
39
+ sku: "ROR-00003",
40
+ cost_price: 17
41
41
  },
42
42
  {
43
- :product => ror_baseball_jersey,
44
- :option_values => [medium, red],
45
- :sku => "ROR-00004",
46
- :cost_price => 17
43
+ product: ror_baseball_jersey,
44
+ option_values: [medium, red],
45
+ sku: "ROR-00004",
46
+ cost_price: 17
47
47
  },
48
48
  {
49
- :product => ror_baseball_jersey,
50
- :option_values => [medium, blue],
51
- :sku => "ROR-00005",
52
- :cost_price => 17
49
+ product: ror_baseball_jersey,
50
+ option_values: [medium, blue],
51
+ sku: "ROR-00005",
52
+ cost_price: 17
53
53
  },
54
54
  {
55
- :product => ror_baseball_jersey,
56
- :option_values => [medium, green],
57
- :sku => "ROR-00006",
58
- :cost_price => 17
55
+ product: ror_baseball_jersey,
56
+ option_values: [medium, green],
57
+ sku: "ROR-00006",
58
+ cost_price: 17
59
59
  },
60
60
  {
61
- :product => ror_baseball_jersey,
62
- :option_values => [large, red],
63
- :sku => "ROR-00007",
64
- :cost_price => 17
61
+ product: ror_baseball_jersey,
62
+ option_values: [large, red],
63
+ sku: "ROR-00007",
64
+ cost_price: 17
65
65
  },
66
66
  {
67
- :product => ror_baseball_jersey,
68
- :option_values => [large, blue],
69
- :sku => "ROR-00008",
70
- :cost_price => 17
67
+ product: ror_baseball_jersey,
68
+ option_values: [large, blue],
69
+ sku: "ROR-00008",
70
+ cost_price: 17
71
71
  },
72
72
  {
73
- :product => ror_baseball_jersey,
74
- :option_values => [large, green],
75
- :sku => "ROR-00009",
76
- :cost_price => 17
73
+ product: ror_baseball_jersey,
74
+ option_values: [large, green],
75
+ sku: "ROR-00009",
76
+ cost_price: 17
77
77
  },
78
78
  {
79
- :product => ror_baseball_jersey,
80
- :option_values => [extra_large, green],
81
- :sku => "ROR-00010",
82
- :cost_price => 17
83
- },
79
+ product: ror_baseball_jersey,
80
+ option_values: [extra_large, green],
81
+ sku: "ROR-00010",
82
+ cost_price: 17
83
+ }
84
84
  ]
85
85
 
86
86
  masters = {
87
87
  ror_baseball_jersey => {
88
- :sku => "ROR-001",
89
- :cost_price => 17,
88
+ sku: "ROR-001",
89
+ cost_price: 17
90
90
  },
91
91
  ror_tote => {
92
- :sku => "ROR-00011",
93
- :cost_price => 17
92
+ sku: "ROR-00011",
93
+ cost_price: 17
94
94
  },
95
95
  ror_bag => {
96
- :sku => "ROR-00012",
97
- :cost_price => 21
96
+ sku: "ROR-00012",
97
+ cost_price: 21
98
98
  },
99
99
  ror_jr_spaghetti => {
100
- :sku => "ROR-00013",
101
- :cost_price => 17
100
+ sku: "ROR-00013",
101
+ cost_price: 17
102
102
  },
103
103
  ror_mug => {
104
- :sku => "ROR-00014",
105
- :cost_price => 11
104
+ sku: "ROR-00014",
105
+ cost_price: 11
106
106
  },
107
107
  ror_ringer => {
108
- :sku => "ROR-00015",
109
- :cost_price => 17
108
+ sku: "ROR-00015",
109
+ cost_price: 17
110
110
  },
111
111
  ror_stein => {
112
- :sku => "ROR-00016",
113
- :cost_price => 15
112
+ sku: "ROR-00016",
113
+ cost_price: 15
114
114
  },
115
115
  apache_baseball_jersey => {
116
- :sku => "APC-00001",
117
- :cost_price => 17
116
+ sku: "APC-00001",
117
+ cost_price: 17
118
118
  },
119
119
  ruby_baseball_jersey => {
120
- :sku => "RUB-00001",
121
- :cost_price => 17
120
+ sku: "RUB-00001",
121
+ cost_price: 17
122
122
  }
123
123
  }
124
124
 
data/lib/spree/sample.rb CHANGED
@@ -1,24 +1,27 @@
1
1
  require 'spree_core'
2
2
  module Spree
3
3
  module Sample
4
- def self.load_sample(file)
5
- # If file is exists within application it takes precendence.
6
- if File.exists?(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
7
- path = File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
8
- else
9
- # Otherwise we will use this gems default file.
10
- path = File.expand_path(samples_path + "#{file}.rb")
4
+ class << self
5
+ def load_sample(file)
6
+ # If file is exists within application it takes precendence.
7
+ if File.exist?(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
8
+ path = File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
9
+ else
10
+ # Otherwise we will use this gems default file.
11
+ path = File.expand_path(samples_path + "#{file}.rb")
12
+ end
13
+ # Check to see if the specified file has been loaded before
14
+ if !$LOADED_FEATURES.include?(path)
15
+ require path
16
+ puts "Loaded #{file.titleize} samples"
17
+ end
11
18
  end
12
- # Check to see if the specified file has been loaded before
13
- if !$LOADED_FEATURES.include?(path)
14
- require path
15
- puts "Loaded #{file.titleize} samples"
16
- end
17
- end
18
19
 
19
- private
20
- def self.samples_path
20
+ private
21
+
22
+ def samples_path
21
23
  Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples'))
22
24
  end
25
+ end
23
26
  end
24
27
  end
@@ -4,9 +4,9 @@ require 'spree/sample'
4
4
 
5
5
  namespace :spree_sample do
6
6
  desc 'Loads sample data'
7
- task :load => :environment do
7
+ task load: :environment do
8
8
  if ARGV.include?("db:migrate")
9
- puts %Q{
9
+ puts %{
10
10
  Please run db:migrate separately from spree_sample:load.
11
11
 
12
12
  Running db:migrate and spree_sample:load at the same time has been known to
@@ -20,5 +20,3 @@ Migrations have been run. Please run "rake spree_sample:load" by itself now.
20
20
  SpreeSample::Engine.load_samples
21
21
  end
22
22
  end
23
-
24
-
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.author = 'Solidus Team'
13
13
  s.email = 'contact@solidus.io'
14
14
  s.homepage = 'http://solidus.io/'
15
- s.license = %q{BSD-3}
15
+ s.license = 'BSD-3'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.require_path = 'lib'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_sample
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.3
19
+ version: 1.3.0.beta1
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: 1.2.3
26
+ version: 1.3.0.beta1
27
27
  description: Sample data (including images) for use with Solidus.
28
28
  email: contact@solidus.io
29
29
  executables: []
@@ -96,13 +96,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  version: 2.1.0
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
99
+ - - ">"
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: 1.3.1
102
102
  requirements:
103
103
  - none
104
104
  rubyforge_project:
105
- rubygems_version: 2.6.11
105
+ rubygems_version: 2.5.1
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Sample data (including images) for use with Solidus.