spree_china_sample 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +26 -0
- data/db/samples/addresses.rb +26 -0
- data/db/samples/adjustments.rb +20 -0
- data/db/samples/assets.rb +159 -0
- data/db/samples/images/apache_baseball.png +0 -0
- data/db/samples/images/ror_bag.jpeg +0 -0
- data/db/samples/images/ror_baseball.jpeg +0 -0
- data/db/samples/images/ror_baseball_back.jpeg +0 -0
- data/db/samples/images/ror_baseball_jersey_back_blue.png +0 -0
- data/db/samples/images/ror_baseball_jersey_back_green.png +0 -0
- data/db/samples/images/ror_baseball_jersey_back_red.png +0 -0
- data/db/samples/images/ror_baseball_jersey_blue.png +0 -0
- data/db/samples/images/ror_baseball_jersey_green.png +0 -0
- data/db/samples/images/ror_baseball_jersey_red.png +0 -0
- data/db/samples/images/ror_jr_spaghetti.jpeg +0 -0
- data/db/samples/images/ror_mug.jpeg +0 -0
- data/db/samples/images/ror_mug_back.jpeg +0 -0
- data/db/samples/images/ror_ringer.jpeg +0 -0
- data/db/samples/images/ror_ringer_back.jpeg +0 -0
- data/db/samples/images/ror_stein.jpeg +0 -0
- data/db/samples/images/ror_stein_back.jpeg +0 -0
- data/db/samples/images/ror_tote.jpeg +0 -0
- data/db/samples/images/ror_tote_back.jpeg +0 -0
- data/db/samples/images/ruby_baseball.png +0 -0
- data/db/samples/images/spree_bag.jpeg +0 -0
- data/db/samples/images/spree_jersey.jpeg +0 -0
- data/db/samples/images/spree_jersey_back.jpeg +0 -0
- data/db/samples/images/spree_mug.jpeg +0 -0
- data/db/samples/images/spree_mug_back.jpeg +0 -0
- data/db/samples/images/spree_ringer_t.jpeg +0 -0
- data/db/samples/images/spree_ringer_t_back.jpeg +0 -0
- data/db/samples/images/spree_spaghetti.jpeg +0 -0
- data/db/samples/images/spree_stein.jpeg +0 -0
- data/db/samples/images/spree_stein_back.jpeg +0 -0
- data/db/samples/images/spree_tote_back.jpeg +0 -0
- data/db/samples/images/spree_tote_front.jpeg +0 -0
- data/db/samples/option_types.rb +12 -0
- data/db/samples/option_values.rb +49 -0
- data/db/samples/orders.rb +38 -0
- data/db/samples/payment_methods.rb +15 -0
- data/db/samples/payments.rb +22 -0
- data/db/samples/product_option_types.rb +12 -0
- data/db/samples/product_properties.rb +118 -0
- data/db/samples/products.rb +137 -0
- data/db/samples/prototypes.rb +21 -0
- data/db/samples/shipping_categories.rb +1 -0
- data/db/samples/shipping_methods.rb +60 -0
- data/db/samples/stock.rb +12 -0
- data/db/samples/tax_categories.rb +2 -0
- data/db/samples/tax_rates.rb +9 -0
- data/db/samples/taxonomies.rb +8 -0
- data/db/samples/taxons.rb +145 -0
- data/db/samples/variants.rb +164 -0
- data/db/samples.rb +2 -0
- data/lib/spree/sample.rb +23 -0
- data/lib/spree_sample.rb +31 -0
- data/lib/tasks/sample.rake +24 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8fe1070c26700ff9fb0ff81aafe43d0daa90376e
|
4
|
+
data.tar.gz: 13456f2bc446c952175134adbda531a1f08cb1dd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2aaee69588cd8d301391bfaf507310e1a8c8f69084460f612751f164aacf3ac7e9f984f726818f8ee95d255516e9c65a1d5303d0028011bc64b858c95a60fe0a
|
7
|
+
data.tar.gz: ed0432ec96c811299acb9117440054e0f9fa192efd64754d6af170f1de7b538b4a0e1bc5463dc613b338d2597ffb2151219edcf2453e35eb71ab9bd6114ce215
|
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2007-2015, Spree Commerce, Inc. and other contributors
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name Spree nor the names of its contributors may be used to
|
13
|
+
endorse or promote products derived from this software without specific
|
14
|
+
prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
united_states = Spree::Country.find_by_iso!("US")
|
2
|
+
new_york = Spree::State.find_by_name!("New York")
|
3
|
+
|
4
|
+
# Billing address
|
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)
|
15
|
+
|
16
|
+
#Shipping address
|
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)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Spree::Sample.load_sample("orders")
|
2
|
+
|
3
|
+
first_order = Spree::Order.find_by_number!("R123456789")
|
4
|
+
last_order = Spree::Order.find_by_number!("R987654321")
|
5
|
+
|
6
|
+
first_order.adjustments.create!(
|
7
|
+
:amount => 0,
|
8
|
+
:source => Spree::TaxRate.find_by_name!("North America"),
|
9
|
+
:order => first_order,
|
10
|
+
:label => "Tax",
|
11
|
+
:state => "open",
|
12
|
+
:mandatory => true)
|
13
|
+
|
14
|
+
last_order.adjustments.create!(
|
15
|
+
:amount => 0,
|
16
|
+
:source => Spree::TaxRate.find_by_name!("North America"),
|
17
|
+
:order => last_order,
|
18
|
+
:label => "Tax",
|
19
|
+
:state => "open",
|
20
|
+
:mandatory => true)
|
@@ -0,0 +1,159 @@
|
|
1
|
+
Spree::Sample.load_sample("products")
|
2
|
+
Spree::Sample.load_sample("variants")
|
3
|
+
|
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
|
+
|
23
|
+
def image(name, type="jpeg")
|
24
|
+
images_path = Pathname.new(File.dirname(__FILE__)) + "images"
|
25
|
+
path = images_path + "#{name}.#{type}"
|
26
|
+
return false if !File.exist?(path)
|
27
|
+
File.open(path)
|
28
|
+
end
|
29
|
+
|
30
|
+
images = {
|
31
|
+
products[:ror_tote].master => [
|
32
|
+
{
|
33
|
+
:attachment => image("ror_tote")
|
34
|
+
},
|
35
|
+
{
|
36
|
+
:attachment => image("ror_tote_back")
|
37
|
+
}
|
38
|
+
],
|
39
|
+
products[:ror_bag].master => [
|
40
|
+
{
|
41
|
+
:attachment => image("ror_bag")
|
42
|
+
}
|
43
|
+
],
|
44
|
+
products[:ror_baseball_jersey].master => [
|
45
|
+
{
|
46
|
+
:attachment => image("ror_baseball")
|
47
|
+
},
|
48
|
+
{
|
49
|
+
:attachment => image("ror_baseball_back")
|
50
|
+
}
|
51
|
+
],
|
52
|
+
products[:ror_jr_spaghetti].master => [
|
53
|
+
{
|
54
|
+
:attachment => image("ror_jr_spaghetti")
|
55
|
+
}
|
56
|
+
],
|
57
|
+
products[:ror_mug].master => [
|
58
|
+
{
|
59
|
+
:attachment => image("ror_mug")
|
60
|
+
},
|
61
|
+
{
|
62
|
+
:attachment => image("ror_mug_back")
|
63
|
+
}
|
64
|
+
],
|
65
|
+
products[:ror_ringer].master => [
|
66
|
+
{
|
67
|
+
:attachment => image("ror_ringer")
|
68
|
+
},
|
69
|
+
{
|
70
|
+
:attachment => image("ror_ringer_back")
|
71
|
+
}
|
72
|
+
],
|
73
|
+
products[:ror_stein].master => [
|
74
|
+
{
|
75
|
+
:attachment => image("ror_stein")
|
76
|
+
},
|
77
|
+
{
|
78
|
+
:attachment => image("ror_stein_back")
|
79
|
+
}
|
80
|
+
],
|
81
|
+
products[:apache_baseball_jersey].master => [
|
82
|
+
{
|
83
|
+
:attachment => image("apache_baseball", "png")
|
84
|
+
},
|
85
|
+
],
|
86
|
+
products[:ruby_baseball_jersey].master => [
|
87
|
+
{
|
88
|
+
:attachment => image("ruby_baseball", "png")
|
89
|
+
},
|
90
|
+
],
|
91
|
+
products[:spree_bag].master => [
|
92
|
+
{
|
93
|
+
:attachment => image("spree_bag")
|
94
|
+
},
|
95
|
+
],
|
96
|
+
products[:spree_tote].master => [
|
97
|
+
{
|
98
|
+
:attachment => image("spree_tote_front")
|
99
|
+
},
|
100
|
+
{
|
101
|
+
:attachment => image("spree_tote_back")
|
102
|
+
}
|
103
|
+
],
|
104
|
+
products[:spree_ringer].master => [
|
105
|
+
{
|
106
|
+
:attachment => image("spree_ringer_t")
|
107
|
+
},
|
108
|
+
{
|
109
|
+
:attachment => image("spree_ringer_t_back")
|
110
|
+
}
|
111
|
+
],
|
112
|
+
products[:spree_jr_spaghetti].master => [
|
113
|
+
{
|
114
|
+
:attachment => image("spree_spaghetti")
|
115
|
+
}
|
116
|
+
],
|
117
|
+
products[:spree_baseball_jersey].master => [
|
118
|
+
{
|
119
|
+
:attachment => image("spree_jersey")
|
120
|
+
},
|
121
|
+
{
|
122
|
+
:attachment => image("spree_jersey_back")
|
123
|
+
}
|
124
|
+
],
|
125
|
+
products[:spree_stein].master => [
|
126
|
+
{
|
127
|
+
:attachment => image("spree_stein")
|
128
|
+
},
|
129
|
+
{
|
130
|
+
:attachment => image("spree_stein_back")
|
131
|
+
}
|
132
|
+
],
|
133
|
+
products[:spree_mug].master => [
|
134
|
+
{
|
135
|
+
:attachment => image("spree_mug")
|
136
|
+
},
|
137
|
+
{
|
138
|
+
:attachment => image("spree_mug_back")
|
139
|
+
}
|
140
|
+
],
|
141
|
+
}
|
142
|
+
|
143
|
+
products[:ror_baseball_jersey].variants.each do |variant|
|
144
|
+
color = variant.option_value("tshirt-color").downcase
|
145
|
+
main_image = image("ror_baseball_jersey_#{color}", "png")
|
146
|
+
variant.images.create!(:attachment => main_image)
|
147
|
+
back_image = image("ror_baseball_jersey_back_#{color}", "png")
|
148
|
+
if back_image
|
149
|
+
variant.images.create!(:attachment => back_image)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
images.each do |variant, attachments|
|
154
|
+
puts "Loading images for #{variant.product.name}"
|
155
|
+
attachments.each do |attachment|
|
156
|
+
variant.images.create!(attachment)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Spree::Sample.load_sample("option_types")
|
2
|
+
|
3
|
+
size = Spree::OptionType.find_by_presentation!("Size")
|
4
|
+
color = Spree::OptionType.find_by_presentation!("Color")
|
5
|
+
|
6
|
+
Spree::OptionValue.create!([
|
7
|
+
{
|
8
|
+
:name => "Small",
|
9
|
+
:presentation => "S",
|
10
|
+
:position => 1,
|
11
|
+
:option_type => size
|
12
|
+
},
|
13
|
+
{
|
14
|
+
:name => "Medium",
|
15
|
+
:presentation => "M",
|
16
|
+
:position => 2,
|
17
|
+
:option_type => size
|
18
|
+
},
|
19
|
+
{
|
20
|
+
:name => "Large",
|
21
|
+
:presentation => "L",
|
22
|
+
:position => 3,
|
23
|
+
:option_type => size
|
24
|
+
},
|
25
|
+
{
|
26
|
+
:name => "Extra Large",
|
27
|
+
:presentation => "XL",
|
28
|
+
:position => 4,
|
29
|
+
:option_type => size
|
30
|
+
},
|
31
|
+
{
|
32
|
+
:name => "Red",
|
33
|
+
:presentation => "Red",
|
34
|
+
:position => 1,
|
35
|
+
:option_type => color,
|
36
|
+
},
|
37
|
+
{
|
38
|
+
:name => "Green",
|
39
|
+
:presentation => "Green",
|
40
|
+
:position => 2,
|
41
|
+
:option_type => color,
|
42
|
+
},
|
43
|
+
{
|
44
|
+
:name => "Blue",
|
45
|
+
:presentation => "Blue",
|
46
|
+
:position => 3,
|
47
|
+
:option_type => color
|
48
|
+
}
|
49
|
+
])
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Spree::Sample.load_sample("addresses")
|
2
|
+
|
3
|
+
orders = []
|
4
|
+
orders << Spree::Order.create!(
|
5
|
+
:number => "R123456789",
|
6
|
+
:email => "spree@example.com",
|
7
|
+
:item_total => 150.95,
|
8
|
+
:adjustment_total => 150.95,
|
9
|
+
:total => 301.90,
|
10
|
+
:shipping_address => Spree::Address.first,
|
11
|
+
:billing_address => Spree::Address.last)
|
12
|
+
|
13
|
+
orders << Spree::Order.create!(
|
14
|
+
:number => "R987654321",
|
15
|
+
:email => "spree@example.com",
|
16
|
+
:item_total => 15.95,
|
17
|
+
:adjustment_total => 15.95,
|
18
|
+
:total => 31.90,
|
19
|
+
:shipping_address => Spree::Address.first,
|
20
|
+
:billing_address => Spree::Address.last)
|
21
|
+
|
22
|
+
orders[0].line_items.create!(
|
23
|
+
:variant => Spree::Product.find_by_name!("Ruby on Rails Tote").master,
|
24
|
+
:quantity => 1,
|
25
|
+
:price => 15.99)
|
26
|
+
|
27
|
+
orders[1].line_items.create!(
|
28
|
+
:variant => Spree::Product.find_by_name!("Ruby on Rails Bag").master,
|
29
|
+
:quantity => 1,
|
30
|
+
:price => 22.99)
|
31
|
+
|
32
|
+
orders.each(&:create_proposed_shipments)
|
33
|
+
|
34
|
+
orders.each do |order|
|
35
|
+
order.state = "complete"
|
36
|
+
order.completed_at = Time.now - 1.day
|
37
|
+
order.save!
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
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
|
10
|
+
|
11
|
+
# This table was previously called spree_creditcards, and older migrations
|
12
|
+
# reference it as such. Make it explicit here that this table has been renamed.
|
13
|
+
Spree::CreditCard.table_name = 'spree_credit_cards'
|
14
|
+
|
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')
|
17
|
+
|
18
|
+
Spree::Order.all.each_with_index do |order, index|
|
19
|
+
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')
|
22
|
+
end
|