tienda 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +35 -0
  4. data/app/assets/images/tienda/chosen-sprite.png +0 -0
  5. data/app/assets/images/tienda/chosen-sprite@2x.png +0 -0
  6. data/app/assets/images/tienda/document.svg +1 -0
  7. data/app/assets/images/tienda/icons/bag.svg +1 -0
  8. data/app/assets/images/tienda/icons/balance.svg +1 -0
  9. data/app/assets/images/tienda/icons/box.svg +1 -0
  10. data/app/assets/images/tienda/icons/building.svg +1 -0
  11. data/app/assets/images/tienda/icons/chart.svg +1 -0
  12. data/app/assets/images/tienda/icons/chat.svg +1 -0
  13. data/app/assets/images/tienda/icons/checkbox.svg +1 -0
  14. data/app/assets/images/tienda/icons/checkbox2.svg +1 -0
  15. data/app/assets/images/tienda/icons/cloud.svg +1 -0
  16. data/app/assets/images/tienda/icons/cone.svg +1 -0
  17. data/app/assets/images/tienda/icons/credit_card.svg +1 -0
  18. data/app/assets/images/tienda/icons/currency.svg +1 -0
  19. data/app/assets/images/tienda/icons/edit.svg +14 -0
  20. data/app/assets/images/tienda/icons/flowchart.svg +1 -0
  21. data/app/assets/images/tienda/icons/gift.svg +1 -0
  22. data/app/assets/images/tienda/icons/globe.svg +1 -0
  23. data/app/assets/images/tienda/icons/id.svg +1 -0
  24. data/app/assets/images/tienda/icons/id2.svg +1 -0
  25. data/app/assets/images/tienda/icons/locked.svg +1 -0
  26. data/app/assets/images/tienda/icons/report.svg +1 -0
  27. data/app/assets/images/tienda/icons/search.svg +1 -0
  28. data/app/assets/images/tienda/icons/support.svg +1 -0
  29. data/app/assets/images/tienda/icons/tags.svg +1 -0
  30. data/app/assets/images/tienda/icons/toolbox.svg +1 -0
  31. data/app/assets/images/tienda/icons/unlocked.svg +1 -0
  32. data/app/assets/images/tienda/icons/wallet.svg +1 -0
  33. data/app/assets/images/tienda/logo.svg +47 -0
  34. data/app/assets/images/tienda/move.svg +1 -0
  35. data/app/assets/images/tienda/shoppe.svg +25 -0
  36. data/app/assets/images/tienda/square.svg +9 -0
  37. data/app/assets/images/tienda/statuses/accepted.svg +14 -0
  38. data/app/assets/images/tienda/statuses/paid.svg +16 -0
  39. data/app/assets/images/tienda/statuses/received.svg +15 -0
  40. data/app/assets/images/tienda/statuses/rejected.svg +14 -0
  41. data/app/assets/images/tienda/statuses/shipped.svg +14 -0
  42. data/app/assets/images/tienda/table-tear-off.png +0 -0
  43. data/app/assets/javascripts/tienda/application.coffee +119 -0
  44. data/app/assets/javascripts/tienda/chosen.jquery.js +1166 -0
  45. data/app/assets/javascripts/tienda/jquery_ui.js +6 -0
  46. data/app/assets/javascripts/tienda/mousetrap.js +9 -0
  47. data/app/assets/javascripts/tienda/order_form.coffee +47 -0
  48. data/app/assets/stylesheets/tienda/application.scss +585 -0
  49. data/app/assets/stylesheets/tienda/chosen.scss +424 -0
  50. data/app/assets/stylesheets/tienda/dialog.scss +25 -0
  51. data/app/assets/stylesheets/tienda/elements.scss +79 -0
  52. data/app/assets/stylesheets/tienda/printable.scss +67 -0
  53. data/app/assets/stylesheets/tienda/reset.scss +93 -0
  54. data/app/assets/stylesheets/tienda/sub.scss +106 -0
  55. data/app/assets/stylesheets/tienda/variables.scss +1 -0
  56. data/app/controllers/tienda/application_controller.rb +46 -0
  57. data/app/controllers/tienda/attachments_controller.rb +14 -0
  58. data/app/controllers/tienda/countries_controller.rb +47 -0
  59. data/app/controllers/tienda/dashboard_controller.rb +9 -0
  60. data/app/controllers/tienda/delivery_service_prices_controller.rb +45 -0
  61. data/app/controllers/tienda/delivery_services_controller.rb +47 -0
  62. data/app/controllers/tienda/orders_controller.rb +90 -0
  63. data/app/controllers/tienda/payments_controller.rb +33 -0
  64. data/app/controllers/tienda/product_categories_controller.rb +47 -0
  65. data/app/controllers/tienda/products_controller.rb +58 -0
  66. data/app/controllers/tienda/sessions_controller.rb +34 -0
  67. data/app/controllers/tienda/settings_controller.rb +16 -0
  68. data/app/controllers/tienda/stock_level_adjustments_controller.rb +40 -0
  69. data/app/controllers/tienda/tax_rates_controller.rb +49 -0
  70. data/app/controllers/tienda/users_controller.rb +53 -0
  71. data/app/controllers/tienda/variants_controller.rb +50 -0
  72. data/app/helpers/tienda/application_helper.rb +60 -0
  73. data/app/mailers/tienda/order_mailer.rb +25 -0
  74. data/app/mailers/tienda/user_mailer.rb +10 -0
  75. data/app/models/tienda/country.rb +27 -0
  76. data/app/models/tienda/delivery_service.rb +33 -0
  77. data/app/models/tienda/delivery_service_price.rb +31 -0
  78. data/app/models/tienda/order/actions.rb +98 -0
  79. data/app/models/tienda/order/billing.rb +105 -0
  80. data/app/models/tienda/order/delivery.rb +229 -0
  81. data/app/models/tienda/order/states.rb +69 -0
  82. data/app/models/tienda/order.rb +93 -0
  83. data/app/models/tienda/order_item.rb +239 -0
  84. data/app/models/tienda/payment.rb +80 -0
  85. data/app/models/tienda/product/product_attributes.rb +20 -0
  86. data/app/models/tienda/product/variants.rb +51 -0
  87. data/app/models/tienda/product.rb +169 -0
  88. data/app/models/tienda/product_attribute.rb +66 -0
  89. data/app/models/tienda/product_category.rb +23 -0
  90. data/app/models/tienda/setting.rb +68 -0
  91. data/app/models/tienda/stock_level_adjustment.rb +19 -0
  92. data/app/models/tienda/tax_rate.rb +46 -0
  93. data/app/models/tienda/user.rb +49 -0
  94. data/app/validators/permalink_validator.rb +7 -0
  95. data/app/views/layouts/tienda/application.html.haml +34 -0
  96. data/app/views/layouts/tienda/printable.html.haml +11 -0
  97. data/app/views/layouts/tienda/sub.html.haml +10 -0
  98. data/app/views/tienda/countries/_form.html.haml +35 -0
  99. data/app/views/tienda/countries/edit.html.haml +6 -0
  100. data/app/views/tienda/countries/index.html.haml +25 -0
  101. data/app/views/tienda/countries/new.html.haml +7 -0
  102. data/app/views/tienda/delivery_service_prices/_form.html.haml +44 -0
  103. data/app/views/tienda/delivery_service_prices/edit.html.haml +6 -0
  104. data/app/views/tienda/delivery_service_prices/index.html.haml +23 -0
  105. data/app/views/tienda/delivery_service_prices/new.html.haml +6 -0
  106. data/app/views/tienda/delivery_services/_form.html.haml +38 -0
  107. data/app/views/tienda/delivery_services/edit.html.haml +9 -0
  108. data/app/views/tienda/delivery_services/index.html.haml +27 -0
  109. data/app/views/tienda/delivery_services/new.html.haml +6 -0
  110. data/app/views/tienda/order_mailer/accepted.text.erb +12 -0
  111. data/app/views/tienda/order_mailer/received.text.erb +12 -0
  112. data/app/views/tienda/order_mailer/rejected.text.erb +10 -0
  113. data/app/views/tienda/order_mailer/shipped.text.erb +16 -0
  114. data/app/views/tienda/orders/_form.html.haml +55 -0
  115. data/app/views/tienda/orders/_order_details.html.haml +57 -0
  116. data/app/views/tienda/orders/_order_items.html.haml +38 -0
  117. data/app/views/tienda/orders/_order_items_form.html.haml +61 -0
  118. data/app/views/tienda/orders/_payments_form.html.haml +15 -0
  119. data/app/views/tienda/orders/_payments_table.html.haml +37 -0
  120. data/app/views/tienda/orders/_search_form.html.haml +24 -0
  121. data/app/views/tienda/orders/_status_bar.html.haml +35 -0
  122. data/app/views/tienda/orders/despatch_note.html.haml +45 -0
  123. data/app/views/tienda/orders/edit.html.haml +21 -0
  124. data/app/views/tienda/orders/index.html.haml +39 -0
  125. data/app/views/tienda/orders/new.html.haml +14 -0
  126. data/app/views/tienda/orders/show.html.haml +25 -0
  127. data/app/views/tienda/payments/refund.html.haml +13 -0
  128. data/app/views/tienda/product_categories/_form.html.haml +26 -0
  129. data/app/views/tienda/product_categories/edit.html.haml +6 -0
  130. data/app/views/tienda/product_categories/index.html.haml +19 -0
  131. data/app/views/tienda/product_categories/new.html.haml +6 -0
  132. data/app/views/tienda/products/_form.html.haml +118 -0
  133. data/app/views/tienda/products/_table.html.haml +42 -0
  134. data/app/views/tienda/products/edit.html.haml +8 -0
  135. data/app/views/tienda/products/import.html.haml +63 -0
  136. data/app/views/tienda/products/index.html.haml +9 -0
  137. data/app/views/tienda/products/new.html.haml +7 -0
  138. data/app/views/tienda/sessions/new.html.haml +12 -0
  139. data/app/views/tienda/sessions/reset.html.haml +12 -0
  140. data/app/views/tienda/settings/edit.html.haml +19 -0
  141. data/app/views/tienda/shared/error.html.haml +6 -0
  142. data/app/views/tienda/stock_level_adjustments/index.html.haml +40 -0
  143. data/app/views/tienda/tax_rates/form.html.haml +28 -0
  144. data/app/views/tienda/tax_rates/index.html.haml +17 -0
  145. data/app/views/tienda/user_mailer/new_password.text.erb +9 -0
  146. data/app/views/tienda/users/_form.html.haml +27 -0
  147. data/app/views/tienda/users/edit.html.haml +5 -0
  148. data/app/views/tienda/users/index.html.haml +17 -0
  149. data/app/views/tienda/users/new.html.haml +7 -0
  150. data/app/views/tienda/variants/form.html.haml +66 -0
  151. data/app/views/tienda/variants/index.html.haml +33 -0
  152. data/config/locales/en.yml +650 -0
  153. data/config/locales/pl.yml +650 -0
  154. data/config/locales/pt-BR.yml +643 -0
  155. data/config/routes.rb +42 -0
  156. data/db/countries.txt +252 -0
  157. data/db/migrate/20150124094549_create_tienda_initial_schema.rb +184 -0
  158. data/db/seeds.rb +128 -0
  159. data/db/seeds_data/poe400.jpg +0 -0
  160. data/db/seeds_data/snom-870-blk.jpg +0 -0
  161. data/db/seeds_data/snom-870-grey.jpg +0 -0
  162. data/db/seeds_data/snom-mm2.jpg +0 -0
  163. data/db/seeds_data/spa303.jpg +0 -0
  164. data/db/seeds_data/t18p.jpg +0 -0
  165. data/db/seeds_data/t20p.jpg +0 -0
  166. data/db/seeds_data/t22p.jpg +0 -0
  167. data/db/seeds_data/t26p.jpg +0 -0
  168. data/db/seeds_data/t41pn.jpg +0 -0
  169. data/db/seeds_data/t46gn.jpg +0 -0
  170. data/db/seeds_data/w52p.jpg +0 -0
  171. data/db/seeds_data/yhs32.jpg +0 -0
  172. data/lib/tasks/tienda.rake +29 -0
  173. data/lib/tienda/associated_countries.rb +20 -0
  174. data/lib/tienda/country_importer.rb +14 -0
  175. data/lib/tienda/default_navigation.rb +20 -0
  176. data/lib/tienda/engine.rb +48 -0
  177. data/lib/tienda/error.rb +21 -0
  178. data/lib/tienda/errors/inappropriate_delivery_service.rb +6 -0
  179. data/lib/tienda/errors/insufficient_stock_to_fulfil.rb +15 -0
  180. data/lib/tienda/errors/invalid_configuration.rb +6 -0
  181. data/lib/tienda/errors/not_enough_stock.rb +15 -0
  182. data/lib/tienda/errors/payment_declined.rb +6 -0
  183. data/lib/tienda/errors/refund_failed.rb +6 -0
  184. data/lib/tienda/errors/unorderable_item.rb +6 -0
  185. data/lib/tienda/navigation_manager.rb +81 -0
  186. data/lib/tienda/orderable_item.rb +39 -0
  187. data/lib/tienda/settings.rb +26 -0
  188. data/lib/tienda/settings_loader.rb +16 -0
  189. data/lib/tienda/setup_generator.rb +10 -0
  190. data/lib/tienda/version.rb +3 -0
  191. data/lib/tienda/view_helpers.rb +16 -0
  192. data/lib/tienda.rb +59 -0
  193. metadata +604 -0
data/db/countries.txt ADDED
@@ -0,0 +1,252 @@
1
+ AD AND Andorra EU .ad EUR
2
+ AE ARE United Arab Emirates AS .ae AED
3
+ AF AFG Afghanistan AS .af AFN
4
+ AG ATG Antigua and Barbuda NA .ag XCD
5
+ AI AIA Anguilla NA .ai XCD
6
+ AL ALB Albania EU .al ALL
7
+ AM ARM Armenia AS .am AMD
8
+ AO AGO Angola AF .ao AOA
9
+ AQ ATA Antarctica AN .aq
10
+ AR ARG Argentina SA .ar ARS
11
+ AS ASM American Samoa OC .as USD
12
+ AT AUT Austria EU .at EUR
13
+ AU AUS Australia OC .au AUD
14
+ AW ABW Aruba NA .aw AWG
15
+ AX ALA Aland Islands EU .ax EUR
16
+ AZ AZE Azerbaijan AS .az AZN
17
+ BA BIH Bosnia and Herzegovina EU .ba BAM
18
+ BB BRB Barbados NA .bb BBD
19
+ BD BGD Bangladesh AS .bd BDT
20
+ BE BEL Belgium EU .be EUR
21
+ BF BFA Burkina Faso AF .bf XOF
22
+ BG BGR Bulgaria EU .bg BGN
23
+ BH BHR Bahrain AS .bh BHD
24
+ BI BDI Burundi AF .bi BIF
25
+ BJ BEN Benin AF .bj XOF
26
+ BL BLM Saint Barthelemy NA .gp EUR
27
+ BM BMU Bermuda NA .bm BMD
28
+ BN BRN Brunei AS .bn BND
29
+ BO BOL Bolivia SA .bo BOB
30
+ BQ BES Bonaire, Saint Eustatius and Saba NA .bq USD
31
+ BR BRA Brazil SA .br BRL
32
+ BS BHS Bahamas NA .bs BSD
33
+ BT BTN Bhutan AS .bt BTN
34
+ BV BVT Bouvet Island AN .bv NOK
35
+ BW BWA Botswana AF .bw BWP
36
+ BY BLR Belarus EU .by BYR
37
+ BZ BLZ Belize NA .bz BZD
38
+ CA CAN Canada NA .ca CAD
39
+ CC CCK Cocos Islands AS .cc AUD
40
+ CD COD Democratic Republic of the Congo AF .cd CDF
41
+ CF CAF Central African Republic AF .cf XAF
42
+ CG COG Republic of the Congo AF .cg XAF
43
+ CH CHE Switzerland EU .ch CHF
44
+ CI CIV Ivory Coast AF .ci XOF
45
+ CK COK Cook Islands OC .ck NZD
46
+ CL CHL Chile SA .cl CLP
47
+ CM CMR Cameroon AF .cm XAF
48
+ CN CHN China AS .cn CNY
49
+ CO COL Colombia SA .co COP
50
+ CR CRI Costa Rica NA .cr CRC
51
+ CU CUB Cuba NA .cu CUP
52
+ CV CPV Cape Verde AF .cv CVE
53
+ CW CUW Curacao NA .cw ANG
54
+ CX CXR Christmas Island AS .cx AUD
55
+ CY CYP Cyprus EU .cy EUR
56
+ CZ CZE Czech Republic EU .cz CZK
57
+ DE DEU Germany EU .de EUR
58
+ DJ DJI Djibouti AF .dj DJF
59
+ DK DNK Denmark EU .dk DKK
60
+ DM DMA Dominica NA .dm XCD
61
+ DO DOM Dominican Republic NA .do DOP
62
+ DZ DZA Algeria AF .dz DZD
63
+ EC ECU Ecuador SA .ec USD
64
+ EE EST Estonia EU .ee EUR
65
+ EG EGY Egypt AF .eg EGP
66
+ EH ESH Western Sahara AF .eh MAD
67
+ ER ERI Eritrea AF .er ERN
68
+ ES ESP Spain EU .es EUR
69
+ ET ETH Ethiopia AF .et ETB
70
+ FI FIN Finland EU .fi EUR
71
+ FJ FJI Fiji OC .fj FJD
72
+ FK FLK Falkland Islands SA .fk FKP
73
+ FM FSM Micronesia OC .fm USD
74
+ FO FRO Faroe Islands EU .fo DKK
75
+ FR FRA France EU .fr EUR
76
+ GA GAB Gabon AF .ga XAF
77
+ GB GBR United Kingdom EU .uk GBP
78
+ GD GRD Grenada NA .gd XCD
79
+ GE GEO Georgia AS .ge GEL
80
+ GF GUF French Guiana SA .gf EUR
81
+ GG GGY Guernsey EU .gg GBP
82
+ GH GHA Ghana AF .gh GHS
83
+ GI GIB Gibraltar EU .gi GIP
84
+ GL GRL Greenland NA .gl DKK
85
+ GM GMB Gambia AF .gm GMD
86
+ GN GIN Guinea AF .gn GNF
87
+ GP GLP Guadeloupe NA .gp EUR
88
+ GQ GNQ Equatorial Guinea AF .gq XAF
89
+ GR GRC Greece EU .gr EUR
90
+ GS SGS South Georgia and the South Sandwich Islands AN .gs GBP
91
+ GT GTM Guatemala NA .gt GTQ
92
+ GU GUM Guam OC .gu USD
93
+ GW GNB Guinea-Bissau AF .gw XOF
94
+ GY GUY Guyana SA .gy GYD
95
+ HK HKG Hong Kong AS .hk HKD
96
+ HM HMD Heard Island and McDonald Islands AN .hm AUD
97
+ HN HND Honduras NA .hn HNL
98
+ HR HRV Croatia EU .hr HRK
99
+ HT HTI Haiti NA .ht HTG
100
+ HU HUN Hungary EU .hu HUF
101
+ ID IDN Indonesia AS .id IDR
102
+ IE IRL Ireland EU .ie EUR
103
+ IL ISR Israel AS .il ILS
104
+ IM IMN Isle of Man EU .im GBP
105
+ IN IND India AS .in INR
106
+ IO IOT British Indian Ocean Territory AS .io USD
107
+ IQ IRQ Iraq AS .iq IQD
108
+ IR IRN Iran AS .ir IRR
109
+ IS ISL Iceland EU .is ISK
110
+ IT ITA Italy EU .it EUR
111
+ JE JEY Jersey EU .je GBP
112
+ JM JAM Jamaica NA .jm JMD
113
+ JO JOR Jordan AS .jo JOD
114
+ JP JPN Japan AS .jp JPY
115
+ KE KEN Kenya AF .ke KES
116
+ KG KGZ Kyrgyzstan AS .kg KGS
117
+ KH KHM Cambodia AS .kh KHR
118
+ KI KIR Kiribati OC .ki AUD
119
+ KM COM Comoros AF .km KMF
120
+ KN KNA Saint Kitts and Nevis NA .kn XCD
121
+ KP PRK North Korea AS .kp KPW
122
+ KR KOR South Korea AS .kr KRW
123
+ XK XKX Kosovo EU EUR
124
+ KW KWT Kuwait AS .kw KWD
125
+ KY CYM Cayman Islands NA .ky KYD
126
+ KZ KAZ Kazakhstan AS .kz KZT
127
+ LA LAO Laos AS .la LAK
128
+ LB LBN Lebanon AS .lb LBP
129
+ LC LCA Saint Lucia NA .lc XCD
130
+ LI LIE Liechtenstein EU .li CHF
131
+ LK LKA Sri Lanka AS .lk LKR
132
+ LR LBR Liberia AF .lr LRD
133
+ LS LSO Lesotho AF .ls LSL
134
+ LT LTU Lithuania EU .lt LTL
135
+ LU LUX Luxembourg EU .lu EUR
136
+ LV LVA Latvia EU .lv LVL
137
+ LY LBY Libya AF .ly LYD
138
+ MA MAR Morocco AF .ma MAD
139
+ MC MCO Monaco EU .mc EUR
140
+ MD MDA Moldova EU .md MDL
141
+ ME MNE Montenegro EU .me EUR
142
+ MF MAF Saint Martin NA .gp EUR
143
+ MG MDG Madagascar AF .mg MGA
144
+ MH MHL Marshall Islands OC .mh USD
145
+ MK MKD Macedonia EU .mk MKD
146
+ ML MLI Mali AF .ml XOF
147
+ MM MMR Myanmar AS .mm MMK
148
+ MN MNG Mongolia AS .mn MNT
149
+ MO MAC Macao AS .mo MOP
150
+ MP MNP Northern Mariana Islands OC .mp USD
151
+ MQ MTQ Martinique NA .mq EUR
152
+ MR MRT Mauritania AF .mr MRO
153
+ MS MSR Montserrat NA .ms XCD
154
+ MT MLT Malta EU .mt EUR
155
+ MU MUS Mauritius AF .mu MUR
156
+ MV MDV Maldives AS .mv MVR
157
+ MW MWI Malawi AF .mw MWK
158
+ MX MEX Mexico NA .mx MXN
159
+ MY MYS Malaysia AS .my MYR
160
+ MZ MOZ Mozambique AF .mz MZN
161
+ NA NAM Namibia AF .na NAD
162
+ NC NCL New Caledonia OC .nc XPF
163
+ NE NER Niger AF .ne XOF
164
+ NF NFK Norfolk Island OC .nf AUD
165
+ NG NGA Nigeria AF .ng NGN
166
+ NI NIC Nicaragua NA .ni NIO
167
+ NL NLD Netherlands EU .nl EUR
168
+ NO NOR Norway EU .no NOK
169
+ NP NPL Nepal AS .np NPR
170
+ NR NRU Nauru OC .nr AUD
171
+ NU NIU Niue OC .nu NZD
172
+ NZ NZL New Zealand OC .nz NZD
173
+ OM OMN Oman AS .om OMR
174
+ PA PAN Panama NA .pa PAB
175
+ PE PER Peru SA .pe PEN
176
+ PF PYF French Polynesia OC .pf XPF
177
+ PG PNG Papua New Guinea OC .pg PGK
178
+ PH PHL Philippines AS .ph PHP
179
+ PK PAK Pakistan AS .pk PKR
180
+ PL POL Poland EU .pl PLN
181
+ PM SPM Saint Pierre and Miquelon NA .pm EUR
182
+ PN PCN Pitcairn OC .pn NZD
183
+ PR PRI Puerto Rico NA .pr USD
184
+ PS PSE Palestinian Territory AS .ps ILS
185
+ PT PRT Portugal EU .pt EUR
186
+ PW PLW Palau OC .pw USD
187
+ PY PRY Paraguay SA .py PYG
188
+ QA QAT Qatar AS .qa QAR
189
+ RE REU Reunion AF .re EUR
190
+ RO ROU Romania EU .ro RON
191
+ RS SRB Serbia EU .rs RSD
192
+ RU RUS Russia EU .ru RUB
193
+ RW RWA Rwanda AF .rw RWF
194
+ SA SAU Saudi Arabia AS .sa SAR
195
+ SB SLB Solomon Islands OC .sb SBD
196
+ SC SYC Seychelles AF .sc SCR
197
+ SD SDN Sudan AF .sd SDG
198
+ SS SSD South Sudan AF SSP
199
+ SE SWE Sweden EU .se SEK
200
+ SG SGP Singapore AS .sg SGD
201
+ SH SHN Saint Helena AF .sh SHP
202
+ SI SVN Slovenia EU .si EUR
203
+ SJ SJM Svalbard and Jan Mayen EU .sj NOK
204
+ SK SVK Slovakia EU .sk EUR
205
+ SL SLE Sierra Leone AF .sl SLL
206
+ SM SMR San Marino EU .sm EUR
207
+ SN SEN Senegal AF .sn XOF
208
+ SO SOM Somalia AF .so SOS
209
+ SR SUR Suriname SA .sr SRD
210
+ ST STP Sao Tome and Principe AF .st STD
211
+ SV SLV El Salvador NA .sv USD
212
+ SX SXM Sint Maarten NA .sx ANG
213
+ SY SYR Syria AS .sy SYP
214
+ SZ SWZ Swaziland AF .sz SZL
215
+ TC TCA Turks and Caicos Islands NA .tc USD
216
+ TD TCD Chad AF .td XAF
217
+ TF ATF French Southern Territories AN .tf EUR
218
+ TG TGO Togo AF .tg XOF
219
+ TH THA Thailand AS .th THB
220
+ TJ TJK Tajikistan AS .tj TJS
221
+ TK TKL Tokelau OC .tk NZD
222
+ TL TLS East Timor OC .tl USD
223
+ TM TKM Turkmenistan AS .tm TMT
224
+ TN TUN Tunisia AF .tn TND
225
+ TO TON Tonga OC .to TOP
226
+ TR TUR Turkey AS .tr TRY
227
+ TT TTO Trinidad and Tobago NA .tt TTD
228
+ TV TUV Tuvalu OC .tv AUD
229
+ TW TWN Taiwan AS .tw TWD
230
+ TZ TZA Tanzania AF .tz TZS
231
+ UA UKR Ukraine EU .ua UAH
232
+ UG UGA Uganda AF .ug UGX
233
+ UM UMI United States Minor Outlying Islands OC .um USD
234
+ US USA United States NA .us USD
235
+ UY URY Uruguay SA .uy UYU
236
+ UZ UZB Uzbekistan AS .uz UZS
237
+ VA VAT Vatican EU .va EUR
238
+ VC VCT Saint Vincent and the Grenadines NA .vc XCD
239
+ VE VEN Venezuela SA .ve VEF
240
+ VG VGB British Virgin Islands NA .vg USD
241
+ VI VIR U.S. Virgin Islands NA .vi USD
242
+ VN VNM Vietnam AS .vn VND
243
+ VU VUT Vanuatu OC .vu VUV
244
+ WF WLF Wallis and Futuna OC .wf XPF
245
+ WS WSM Samoa OC .ws WST
246
+ YE YEM Yemen AS .ye YER
247
+ YT MYT Mayotte AF .yt EUR
248
+ ZA ZAF South Africa AF .za ZAR
249
+ ZM ZMB Zambia AF .zm ZMK
250
+ ZW ZWE Zimbabwe AF .zw ZWL
251
+ CS SCG Serbia and Montenegro EU .cs RSD
252
+ AN ANT Netherlands Antilles NA .an ANG
@@ -0,0 +1,184 @@
1
+ class CreateTiendaInitialSchema < ActiveRecord::Migration
2
+ def up
3
+ create_table :tienda_countries do |t|
4
+ t.string :name
5
+ t.string :code2
6
+ t.string :code3
7
+ t.string :continent
8
+ t.string :tld
9
+ t.string :currency
10
+ t.boolean :eu_member, default: false
11
+ end
12
+
13
+ create_table :tienda_delivery_service_prices do |t|
14
+ t.integer :delivery_service_id, index: true
15
+ t.string :code
16
+ t.decimal :price, precision: 8, scale: 2, index: true
17
+ t.decimal :cost_price, precision: 8, scale: 2
18
+ t.integer :tax_rate_id, index: true
19
+ t.decimal :min_weight, precision: 8, scale: 2, index: true
20
+ t.decimal :max_weight, precision: 8, scale: 2, index: true
21
+ t.text :country_ids
22
+ t.timestamps
23
+ end
24
+
25
+ create_table :tienda_delivery_services do |t|
26
+ t.string :name
27
+ t.string :code
28
+ t.boolean :default, default: false
29
+ t.boolean :active, default: true, index: true
30
+ t.string :courier
31
+ t.string :tracking_url
32
+ t.timestamps
33
+ end
34
+
35
+ create_table :tienda_order_items do |t|
36
+ t.integer :order_id, index: true
37
+ t.integer :ordered_item_id
38
+ t.string :ordered_item_type
39
+ t.integer :quantity, default: 1
40
+ t.decimal :unit_price, precision: 8, scale: 2
41
+ t.decimal :unit_cost_price, precision: 8, scale: 2
42
+ t.decimal :tax_amount, precision: 8, scale: 2
43
+ t.decimal :tax_rate, precision: 8, scale: 2
44
+ t.decimal :weight, precision: 8, scale: 3, default: nil
45
+ t.timestamps
46
+ end
47
+
48
+ create_table :tienda_orders do |t|
49
+ t.string :token, index: true
50
+ t.string :first_name
51
+ t.string :last_name
52
+ t.string :company
53
+ t.string :billing_address1
54
+ t.string :billing_address2
55
+ t.string :billing_address3
56
+ t.string :billing_address4
57
+ t.string :billing_postcode
58
+ t.integer :billing_country_id, index: true
59
+ t.string :email_address
60
+ t.string :phone_number
61
+ t.string :status
62
+ t.datetime :received_at, index: true
63
+ t.datetime :accepted_at
64
+ t.datetime :shipped_at
65
+ t.integer :delivery_service_id, index: true
66
+ t.decimal :delivery_price, precision: 8, scale: 2
67
+ t.decimal :delivery_cost_price, precision: 8, scale: 2
68
+ t.decimal :delivery_tax_rate, precision: 8, scale: 2
69
+ t.decimal :delivery_tax_amount, precision: 8, scale: 2
70
+ t.integer :accepted_by
71
+ t.integer :shipped_by
72
+ t.string :consignment_number
73
+ t.datetime :rejected_at
74
+ t.integer :rejected_by
75
+ t.string :ip_address
76
+ t.text :notes
77
+ t.boolean :separate_delivery_address, default: false
78
+ t.string :delivery_name
79
+ t.string :delivery_address1
80
+ t.string :delivery_address2
81
+ t.string :delivery_address3
82
+ t.string :delivery_address4
83
+ t.string :delivery_postcode
84
+ t.integer :delivery_country_id, index: true
85
+ t.decimal :amount_paid, precision: 8, scale: 2, default: 0.0
86
+ t.boolean :exported, default: false
87
+ t.string :invoice_number
88
+ t.timestamps
89
+ end
90
+
91
+ create_table :tienda_payments do |t|
92
+ t.integer :order_id, index: true
93
+ t.decimal :amount, precision: 8, scale: 2, default: 0.0
94
+ t.string :reference, :method
95
+ t.boolean :confirmed, default: true
96
+ t.boolean :refundable, default: false
97
+ t.decimal :amount_refunded, precision: 8, scale: 2, default: 0.0
98
+ t.integer :parent_payment_id, index: true
99
+ t.boolean :exported, default: false
100
+ t.timestamps
101
+ end
102
+
103
+ create_table :tienda_product_attributes do |t|
104
+ t.integer :product_id, index: true
105
+ t.string :key, index: true
106
+ t.string :value
107
+ t.integer :position, default: 1, index: true
108
+ t.boolean :searchable, default: true
109
+ t.boolean :public, default: true
110
+ t.timestamps
111
+ end
112
+
113
+ create_table :tienda_product_categories do |t|
114
+ t.string :name
115
+ t.string :permalink, index: true
116
+ t.text :description
117
+ t.timestamps
118
+ end
119
+
120
+ create_table :tienda_products do |t|
121
+ t.integer :parent_id, index: true
122
+ t.integer :product_category_id, index: true
123
+ t.string :name
124
+ t.string :sku, index: true
125
+ t.string :permalink,
126
+ t.text :description
127
+ t.text :short_description
128
+ t.boolean :active, default: true
129
+ t.decimal :weight, precision: 8, scale: 3, default: 0.0
130
+ t.decimal :price, precision: 8, scale: 2, default: 0.0
131
+ t.decimal :cost_price, precision: 8, scale: 2, default: 0.0
132
+ t.integer :tax_rate_id, index: true
133
+ t.boolean :featured, default: false
134
+ t.text :in_the_box
135
+ t.boolean :stock_control, default: true
136
+ t.boolean :default, default: false
137
+ t.timestamps
138
+ end
139
+
140
+ create_table :tienda_settings do |t|
141
+ t.string :key, index: true
142
+ t.string :value
143
+ t.string :value_type
144
+ end
145
+
146
+ create_table :tienda_stock_level_adjustments do |t|
147
+ t.integer :item_id
148
+ t.string :item_type
149
+ t.string :description
150
+ t.integer :adjustment, default: 0
151
+ t.string :parent_type
152
+ t.integer :parent_id
153
+ t.timestamps
154
+ end
155
+
156
+ create_table :tienda_tax_rates do |t|
157
+ t.string :name
158
+ t.decimal :rate, precision: 8, scale: 2
159
+ t.string :address_type
160
+ t.text :country_ids
161
+ t.timestamps
162
+ end
163
+
164
+ create_table :tienda_users do |t|
165
+ t.string :first_name
166
+ t.string :last_name
167
+ t.string :email_address, index: true
168
+ t.string :password_digest
169
+ t.timestamps
170
+ end
171
+
172
+ #Add indexes
173
+ add_index :tienda_order_items, [:ordered_item_id, :ordered_item_type], name: 'index_tienda_order_items_ordered_item'
174
+
175
+ add_index :tienda_stock_level_adjustments, [:item_id, :item_type], name: 'index_tienda_stock_level_adjustments_items'
176
+ add_index :tienda_stock_level_adjustments, [:parent_id, :parent_type], name: 'index_tienda_stock_level_adjustments_parent'
177
+ end
178
+
179
+ def down
180
+ [:users, :tax_rates, :stock_level_adjustments, :settings, :products, :product_categories, :product_attributes, :orders, :order_items, :delivery_services, :delivery_service_prices, :countries].each do |table|
181
+ drop_table "tienda_#{table}"
182
+ end
183
+ end
184
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,128 @@
1
+ # encoding: UTF-8
2
+
3
+ # tax rates
4
+ tax_rate = Tienda::TaxRate.create!(:name => "Standard VAT", :rate => 20.0)
5
+ exempt_tax = Tienda::TaxRate.create!(:name => "Exempt VAT", :rate => 0.0)
6
+
7
+ # delivery services
8
+
9
+ ds = Tienda::DeliveryService.create!(:name => "Next Day Delivery", :code => 'ND16', :courier => 'AnyCourier', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
10
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 5.0, :cost_price => 4.50, :tax_rate => tax_rate)
11
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 8.0, :cost_price => 7.5, :tax_rate => tax_rate)
12
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 10.0, :cost_price => 9.50, :tax_rate => tax_rate)
13
+
14
+ ds = Tienda::DeliveryService.create!(:name => "Saturday Delivery", :code => 'NDSA16', :courier => 'AnyCourier', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
15
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 27.0, :cost_price => 24.00, :tax_rate => tax_rate)
16
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 29.0, :cost_price => 20.00, :tax_rate => tax_rate)
17
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 37.0, :cost_price => 32.00,:tax_rate => tax_rate)
18
+
19
+ # categories
20
+ cat1 = Tienda::ProductCategory.create!(:name => 'VoIP Phones')
21
+ cat2 = Tienda::ProductCategory.create!(:name => 'VoIP Accessories')
22
+ cat3 = Tienda::ProductCategory.create!(:name => 'Network Eqipment')
23
+
24
+ def get_file(name, content_type = 'image/jpeg')
25
+ file = ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(File.join(Tienda.root, 'db', 'seeds_data', name), 'rb'))
26
+ file.original_filename = name
27
+ file.content_type = content_type
28
+ file
29
+ end
30
+
31
+ lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
32
+
33
+ pro = cat1.products.create!(:name => 'Yealink T20P', :sku => 'YL-SIP-T20P', :description => lorem, :short_description => 'If cheap & cheerful is what you’re after, the Yealink T20P is what you’re looking for.', :weight => 1.119, :price => 54.99, :cost_price => 44.99, :tax_rate => tax_rate, :featured => true)
34
+ pro.default_image_file = get_file('t20p.jpg')
35
+ pro.save!
36
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 17)
37
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
38
+ pro.product_attributes.create!(:key => 'Model', :value => 'T20P', :position => 1)
39
+ pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
40
+ pro.product_attributes.create!(:key => 'Lines', :value => '3', :position => 1)
41
+ pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'No', :position => 1)
42
+ pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
43
+
44
+ pro = cat1.products.create!(:name => 'Yealink T22P', :sku => 'YL-SIP-T22P', :description => lorem, :short_description => lorem, :weight => 1.419, :price => 64.99, :cost_price => 56.99, :tax_rate => tax_rate)
45
+ pro.default_image_file = get_file('t22p.jpg')
46
+ pro.save!
47
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 200)
48
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
49
+ pro.product_attributes.create!(:key => 'Model', :value => 'T22P', :position => 1)
50
+ pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
51
+ pro.product_attributes.create!(:key => 'Lines', :value => '4', :position => 1)
52
+ pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'No', :position => 1)
53
+ pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
54
+
55
+
56
+ pro = cat1.products.create!(:name => 'Yealink T26P', :sku => 'YL-SIP-T26P', :description => lorem, :short_description => lorem, :weight => 2.23, :price => 88.99, :cost_price => 78.99, :tax_rate => tax_rate)
57
+ pro.default_image_file = get_file('t26p.jpg')
58
+ pro.save!
59
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 100)
60
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
61
+ pro.product_attributes.create!(:key => 'Model', :value => 'T26P', :position => 1)
62
+ pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
63
+ pro.product_attributes.create!(:key => 'Lines', :value => '6', :position => 1)
64
+ pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'No', :position => 1)
65
+ pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
66
+
67
+ pro = cat1.products.create!(:name => 'Yealink T46GN', :sku => 'YL-SIP-T46GN', :description => lorem, :short_description => 'Colourful, sharp, fast & down right sexy. The Yealink T46P will make your scream!', :weight => 2.23, :price => 149.99, :cost_price => 139.99, :tax_rate => tax_rate, :featured => true)
68
+ pro.default_image_file = get_file('t46gn.jpg')
69
+ pro.save!
70
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 10)
71
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
72
+ pro.product_attributes.create!(:key => 'Model', :value => 'T46GN', :position => 1)
73
+ pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
74
+ pro.product_attributes.create!(:key => 'Lines', :value => '4', :position => 1)
75
+ pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
76
+ pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
77
+
78
+ pro = cat1.products.create!(:name => 'Snom 870', :sku => 'SM-870', :description => lorem, :short_description => 'The perfect & beautiful VoIP phone for the discerning professional desk.', :featured => true)
79
+ pro.default_image_file = get_file('snom-870-grey.jpg')
80
+ pro.save!
81
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
82
+ pro.product_attributes.create!(:key => 'Model', :value => '870', :position => 1)
83
+ pro.product_attributes.create!(:key => 'Colour', :value => 'Grey', :position => 1)
84
+ pro.product_attributes.create!(:key => 'Lines', :value => '10', :position => 1)
85
+ pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
86
+ pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
87
+
88
+ v1 = pro.variants.create(:name => "White/Grey", :sku => "SM-870-GREY", :price => 230.00, :cost_price => 220, :tax_rate => tax_rate, :weight => 1.35, :default => true)
89
+ v1.default_image_file = get_file('snom-870-grey.jpg')
90
+ v1.save!
91
+ v1.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 4)
92
+
93
+
94
+ v2 = pro.variants.create(:name => "Black", :sku => "SM-870-BLK", :price => 230.00, :cost_price => 220, :tax_rate => tax_rate, :weight => 1.35)
95
+ v2.default_image_file = get_file('snom-870-blk.jpg')
96
+ v2.save!
97
+ v2.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 2)
98
+
99
+
100
+ pro = cat2.products.create!(:name => 'Yealink Mono Headset', :sku => 'YL-YHS32', :description => lorem, :short_description => 'If you\'re often on the phone, this headset will make your life 100x easier. Guaranteed*.', :weight => 0.890, :price => 34.99, :cost_price => 24.99, :tax_rate => tax_rate, :featured => true)
101
+ pro.default_image_file = get_file('yhs32.jpg')
102
+ pro.save!
103
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
104
+ pro.product_attributes.create!(:key => 'Model', :value => 'YHS32', :position => 1)
105
+
106
+ pro = cat2.products.create!(:name => 'Snom Wired Headset (MM2)', :sku => 'SM-MM2', :description => lorem, :short_description => lorem, :weight => 0.780, :price => 38.00, :cost_price => 30, :tax_rate => tax_rate)
107
+ pro.default_image_file = get_file('snom-mm2.jpg')
108
+ pro.save!
109
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 7)
110
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
111
+ pro.product_attributes.create!(:key => 'Model', :value => 'MM2', :position => 1)
112
+
113
+ pro = cat2.products.create!(:name => 'Snom Wired Headset (MM3)', :sku => 'SM-MM3', :description => lorem, :short_description => lorem, :weight => 0.780, :price => 38.00, :cost_price => 30, :tax_rate => tax_rate)
114
+ pro.default_image_file = get_file('snom-mm2.jpg')
115
+ pro.save!
116
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 5)
117
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
118
+ pro.product_attributes.create!(:key => 'Model', :value => 'MM3', :position => 1)
119
+
120
+ pro = cat1.products.create!(:name => 'Yealink W52P', :sku => 'TL-SIP-W52P', :description => lorem, :short_description => 'Wireless SIP phones are hard to come by but this beauty from Yealink is fab.', :weight => 1.280, :price => 99.99, :cost_price => 89.99, :tax_rate => tax_rate, :featured => true)
121
+ pro.default_image_file = get_file('w52p.jpg')
122
+ pro.save!
123
+ pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 10)
124
+ pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
125
+ pro.product_attributes.create!(:key => 'Model', :value => 'W52P', :position => 1)
126
+ pro.product_attributes.create!(:key => 'Lines', :value => '3', :position => 1)
127
+ pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
128
+ pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'No', :position => 1)
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,29 @@
1
+ namespace :tienda do
2
+ desc "Load seed data for the Tienda"
3
+ task :seed => :environment do
4
+ require File.join(Tienda.root, 'db', 'seeds')
5
+ end
6
+
7
+ desc "Create a default admin user"
8
+ task :create_default_user => :environment do
9
+ Tienda::User.create(:email_address => 'admin@example.com', :password => 'password', :password_confirmation => 'password', :first_name => 'Default', :last_name => 'Admin')
10
+ puts
11
+ puts " New user has been created successfully."
12
+ puts
13
+ puts " E-Mail Address..: admin@example.com"
14
+ puts " Password........: password"
15
+ puts
16
+ end
17
+
18
+ desc "Import default set of countries"
19
+ task :import_countries => :environment do
20
+ Tienda::CountryImporter.import
21
+ end
22
+
23
+ desc "Run the key setup tasks for a new application"
24
+ task :setup => :environment do
25
+ Rake::Task["tienda:import_countries"].invoke if Tienda::Country.all.empty?
26
+ Rake::Task["tienda:create_default_user"].invoke if Tienda::User.all.empty?
27
+ end
28
+
29
+ end
@@ -0,0 +1,20 @@
1
+ module Tienda
2
+ module AssociatedCountries
3
+
4
+ def self.included(base)
5
+ base.serialize :country_ids, Array
6
+ base.before_validation { self.country_ids = self.country_ids.map(&:to_i).select { |i| i > 0} if self.country_ids.is_a?(Array) }
7
+ end
8
+
9
+ def country?(id)
10
+ id = id.id if id.is_a?(Tienda::Country)
11
+ self.country_ids.is_a?(Array) && self.country_ids.include?(id.to_i)
12
+ end
13
+
14
+ def countries
15
+ return [] unless self.country_ids.is_a?(Array) && !self.country_ids.empty?
16
+ Tienda::Country.where(:id => self.country_ids)
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ module Tienda
2
+ module CountryImporter
3
+ def self.import
4
+ eu_members = ['Austria', 'Belgium', 'Bulgaria', 'Croatia','Cyprus','Czech Republic','Denmark','Estonia','Finland','France','Germany','Greece','Hungary','Ireland','Italy','Latvia','Lithuania','Luxembourg','Malta','Netherlands','Poland','Portugal','Romania','Slovakia','Slovenia','Spain','Sweden','United Kingdom']
5
+ countries = File.read(File.join(Tienda.root, 'db', 'countries.txt')).gsub(/\r/, "\n").split("\n").map { |c| c.split(/\t/) }
6
+ countries.each do |code2, code3, name, continent, tld, currency|
7
+ country = Country.new(:name => name, :code2 => code2, :code3 => code3, :continent => continent, :tld => tld.gsub('.', ''), :currency => currency)
8
+ country.eu_member = true if eu_members.map(&:upcase).include?(name.upcase)
9
+ country.save
10
+ end
11
+
12
+ end
13
+ end
14
+ end