spree_core 0.70.0.rc2 → 0.70.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/LICENSE +1 -1
  2. data/app/assets/javascripts/admin/taxonomy.js +1 -1
  3. data/app/controllers/admin/tax_rates_controller.rb +2 -2
  4. data/app/helpers/admin/base_helper.rb +1 -1
  5. data/app/helpers/spree/base_helper.rb +1 -1
  6. data/app/mailers/order_mailer.rb +5 -5
  7. data/app/mailers/shipment_mailer.rb +3 -3
  8. data/app/mailers/test_mailer.rb +1 -1
  9. data/app/models/calculator.rb +7 -9
  10. data/app/models/calculator/flat_percent_item_total.rb +0 -5
  11. data/app/models/calculator/flat_rate.rb +0 -5
  12. data/app/models/calculator/flexi_rate.rb +0 -5
  13. data/app/models/calculator/per_item.rb +0 -5
  14. data/app/models/calculator/price_bucket.rb +0 -6
  15. data/app/models/calculator/sales_tax.rb +1 -6
  16. data/app/models/calculator/vat.rb +6 -11
  17. data/app/models/creditcard.rb +12 -10
  18. data/app/models/order.rb +1 -1
  19. data/app/models/payment.rb +1 -1
  20. data/app/models/payment_method.rb +1 -7
  21. data/app/views/admin/adjustments/_adjustments_table.html.erb +3 -3
  22. data/app/views/admin/adjustments/_form.html.erb +4 -4
  23. data/app/views/admin/adjustments/edit.html.erb +7 -7
  24. data/app/views/admin/adjustments/index.html.erb +2 -2
  25. data/app/views/admin/adjustments/new.html.erb +6 -6
  26. data/app/views/admin/configurations/index.html.erb +29 -29
  27. data/app/views/admin/general_settings/edit.html.erb +5 -5
  28. data/app/views/admin/general_settings/show.html.erb +4 -5
  29. data/app/views/admin/images/_form.html.erb +2 -2
  30. data/app/views/admin/images/edit.html.erb +8 -8
  31. data/app/views/admin/images/index.html.erb +11 -11
  32. data/app/views/admin/images/new.html.erb +1 -1
  33. data/app/views/admin/inventory_settings/edit.html.erb +7 -7
  34. data/app/views/admin/inventory_settings/show.html.erb +4 -4
  35. data/app/views/admin/inventory_units/adjust.html.erb +11 -11
  36. data/app/views/admin/mail_methods/_form.html.erb +23 -26
  37. data/app/views/admin/mail_methods/edit.html.erb +4 -4
  38. data/app/views/admin/mail_methods/index.html.erb +6 -6
  39. data/app/views/admin/mail_methods/new.html.erb +4 -4
  40. data/app/views/admin/option_types/_available.html.erb +9 -9
  41. data/app/views/admin/option_types/_form.html.erb +2 -2
  42. data/app/views/admin/option_types/_option_value_fields.html.erb +3 -3
  43. data/app/views/admin/option_types/_selected.html.erb +4 -4
  44. data/app/views/admin/option_types/available.js.erb +1 -1
  45. data/app/views/admin/option_types/edit.html.erb +10 -10
  46. data/app/views/admin/option_types/index.html.erb +7 -7
  47. data/app/views/admin/option_types/new.html.erb +4 -4
  48. data/app/views/admin/option_types/selected.html.erb +1 -1
  49. data/app/views/admin/orders/_add_product.html.erb +6 -6
  50. data/app/views/admin/orders/_form.html.erb +15 -15
  51. data/app/views/admin/orders/_line_item.html.erb +4 -4
  52. data/app/views/admin/orders/_user_form.html.erb +11 -11
  53. data/app/views/admin/orders/edit.html.erb +8 -8
  54. data/app/views/admin/orders/history.html.erb +8 -8
  55. data/app/views/admin/orders/index.html.erb +28 -29
  56. data/app/views/admin/orders/new.html.erb +5 -5
  57. data/app/views/admin/orders/show.html.erb +7 -7
  58. data/app/views/admin/orders/user.html.erb +6 -6
  59. data/app/views/admin/payment_methods/_form.html.erb +15 -15
  60. data/app/views/admin/payment_methods/edit.html.erb +5 -5
  61. data/app/views/admin/payment_methods/index.html.erb +9 -10
  62. data/app/views/admin/payment_methods/new.html.erb +4 -4
  63. data/app/views/admin/payments/_bill_address_form.html.erb +1 -1
  64. data/app/views/admin/payments/_form.html.erb +5 -5
  65. data/app/views/admin/payments/_list.html.erb +5 -5
  66. data/app/views/admin/payments/_transaction_list.html.erb +6 -6
  67. data/app/views/admin/payments/credit.html.erb +5 -5
  68. data/app/views/admin/payments/index.html.erb +8 -8
  69. data/app/views/admin/payments/new.html.erb +6 -6
  70. data/app/views/admin/payments/show.html.erb +2 -2
  71. data/app/views/admin/payments/source_forms/_gateway.html.erb +8 -8
  72. data/app/views/admin/payments/source_views/_gateway.html.erb +7 -7
  73. data/app/views/admin/product_groups/_preview.html.erb +2 -2
  74. data/app/views/admin/product_groups/_product_scope.html.erb +3 -3
  75. data/app/views/admin/product_groups/edit.html.erb +9 -9
  76. data/app/views/admin/product_groups/index.html.erb +8 -8
  77. data/app/views/admin/product_groups/new.html.erb +3 -3
  78. data/app/views/admin/product_groups/show.html.erb +1 -1
  79. data/app/views/admin/product_groups/update.js.erb +3 -3
  80. data/app/views/admin/product_properties/_product_property_fields.html.erb +3 -3
  81. data/app/views/admin/product_properties/index.html.erb +15 -15
  82. data/app/views/admin/product_scopes/create.js.erb +3 -3
  83. data/app/views/admin/product_scopes/destroy.js.erb +3 -3
  84. data/app/views/admin/products/_form.html.erb +25 -25
  85. data/app/views/admin/products/_option_types.html.erb +14 -14
  86. data/app/views/admin/products/_properties_form.erb +1 -1
  87. data/app/views/admin/products/edit.html.erb +3 -3
  88. data/app/views/admin/products/index.html.erb +12 -12
  89. data/app/views/admin/products/new.html.erb +14 -14
  90. data/app/views/admin/products/show.html.erb +1 -1
  91. data/app/views/admin/properties/_form.html.erb +2 -2
  92. data/app/views/admin/properties/edit.html.erb +3 -3
  93. data/app/views/admin/properties/index.html.erb +6 -6
  94. data/app/views/admin/properties/new.html.erb +3 -3
  95. data/app/views/admin/prototypes/_form.html.erb +6 -6
  96. data/app/views/admin/prototypes/_prototypes.html.erb +3 -4
  97. data/app/views/admin/prototypes/edit.html.erb +4 -4
  98. data/app/views/admin/prototypes/index.html.erb +6 -6
  99. data/app/views/admin/prototypes/new.html.erb +3 -3
  100. data/app/views/admin/reports/index.html.erb +3 -3
  101. data/app/views/admin/reports/sales_total.html.erb +7 -7
  102. data/app/views/admin/return_authorizations/_form.html.erb +13 -14
  103. data/app/views/admin/return_authorizations/edit.html.erb +10 -10
  104. data/app/views/admin/return_authorizations/index.html.erb +9 -9
  105. data/app/views/admin/return_authorizations/new.html.erb +7 -7
  106. data/app/views/admin/shared/_additional_field.html.erb +1 -1
  107. data/app/views/admin/shared/_address_form.html.erb +24 -24
  108. data/app/views/admin/shared/_calculator_fields.html.erb +4 -4
  109. data/app/views/admin/shared/_configuration_menu.html.erb +12 -12
  110. data/app/views/admin/shared/_destroy.js.erb +1 -1
  111. data/app/views/admin/shared/_edit_resource_links.html.erb +2 -2
  112. data/app/views/admin/shared/_group_from_products_form.html.erb +6 -6
  113. data/app/views/admin/shared/_head.html.erb +5 -5
  114. data/app/views/admin/shared/_new_adjustment_button.html.erb +2 -2
  115. data/app/views/admin/shared/_new_resource_links.html.erb +2 -2
  116. data/app/views/admin/shared/_order_tabs.html.erb +25 -25
  117. data/app/views/admin/shared/_product_tabs.html.erb +14 -14
  118. data/app/views/admin/shared/_report_criteria.html.erb +4 -4
  119. data/app/views/admin/shared/_show_resource_links.html.erb +3 -3
  120. data/app/views/admin/shared/_update_order_state.js +4 -4
  121. data/app/views/admin/shipments/_form.html.erb +15 -15
  122. data/app/views/admin/shipments/edit.html.erb +11 -11
  123. data/app/views/admin/shipments/index.html.erb +11 -11
  124. data/app/views/admin/shipments/new.html.erb +6 -6
  125. data/app/views/admin/shipping_categories/_form.html.erb +2 -2
  126. data/app/views/admin/shipping_categories/edit.html.erb +4 -4
  127. data/app/views/admin/shipping_categories/index.html.erb +8 -8
  128. data/app/views/admin/shipping_categories/new.html.erb +4 -4
  129. data/app/views/admin/shipping_methods/_form.html.erb +5 -5
  130. data/app/views/admin/shipping_methods/edit.html.erb +5 -5
  131. data/app/views/admin/shipping_methods/index.html.erb +9 -10
  132. data/app/views/admin/shipping_methods/new.html.erb +4 -4
  133. data/app/views/admin/states/_form.html.erb +3 -3
  134. data/app/views/admin/states/_state_list.html.erb +6 -8
  135. data/app/views/admin/states/edit.html.erb +4 -4
  136. data/app/views/admin/states/index.html.erb +4 -4
  137. data/app/views/admin/states/new.html.erb +3 -3
  138. data/app/views/admin/states/new.js.erb +1 -1
  139. data/app/views/admin/tax_categories/_form.html.erb +6 -6
  140. data/app/views/admin/tax_categories/edit.html.erb +4 -4
  141. data/app/views/admin/tax_categories/index.html.erb +8 -9
  142. data/app/views/admin/tax_categories/new.html.erb +4 -4
  143. data/app/views/admin/tax_rates/_form.html.erb +5 -5
  144. data/app/views/admin/tax_rates/edit.html.erb +5 -5
  145. data/app/views/admin/tax_rates/index.html.erb +10 -10
  146. data/app/views/admin/tax_rates/new.html.erb +4 -4
  147. data/app/views/admin/tax_settings/edit.html.erb +10 -10
  148. data/app/views/admin/tax_settings/show.html.erb +6 -6
  149. data/app/views/admin/taxonomies/_form.html.erb +1 -1
  150. data/app/views/admin/taxonomies/_js_head.html.erb +4 -4
  151. data/app/views/admin/taxonomies/_list.html.erb +4 -4
  152. data/app/views/admin/taxonomies/_taxon.html.erb +2 -2
  153. data/app/views/admin/taxonomies/edit.erb +31 -32
  154. data/app/views/admin/taxonomies/get_children.json.erb +7 -7
  155. data/app/views/admin/taxonomies/index.html.erb +4 -4
  156. data/app/views/admin/taxonomies/new.html.erb +5 -5
  157. data/app/views/admin/taxons/_form.html.erb +3 -3
  158. data/app/views/admin/taxons/_taxon_table.html.erb +4 -4
  159. data/app/views/admin/taxons/edit.html.erb +3 -3
  160. data/app/views/admin/taxons/remove.html.erb +1 -1
  161. data/app/views/admin/taxons/select.js.erb +1 -1
  162. data/app/views/admin/taxons/selected.html.erb +5 -5
  163. data/app/views/admin/trackers/_form.html.erb +10 -10
  164. data/app/views/admin/trackers/edit.html.erb +5 -5
  165. data/app/views/admin/trackers/index.html.erb +8 -8
  166. data/app/views/admin/trackers/new.html.erb +4 -4
  167. data/app/views/admin/users/_form.html.erb +6 -6
  168. data/app/views/admin/users/edit.html.erb +4 -4
  169. data/app/views/admin/users/index.html.erb +8 -8
  170. data/app/views/admin/users/new.html.erb +4 -4
  171. data/app/views/admin/users/show.html.erb +5 -5
  172. data/app/views/admin/variants/_form.html.erb +5 -5
  173. data/app/views/admin/variants/edit.html.erb +3 -3
  174. data/app/views/admin/variants/index.html.erb +14 -18
  175. data/app/views/admin/variants/new.html.erb +3 -3
  176. data/app/views/admin/variants/new.js.erb +1 -1
  177. data/app/views/admin/zones/_country_member.html.erb +1 -1
  178. data/app/views/admin/zones/_form.html.erb +14 -14
  179. data/app/views/admin/zones/_state_member.html.erb +1 -1
  180. data/app/views/admin/zones/edit.html.erb +5 -5
  181. data/app/views/admin/zones/index.html.erb +5 -5
  182. data/app/views/admin/zones/new.html.erb +5 -5
  183. data/app/views/checkout/_address.html.erb +25 -25
  184. data/app/views/checkout/_confirm.html.erb +1 -1
  185. data/app/views/checkout/_delivery.html.erb +7 -7
  186. data/app/views/checkout/_payment.html.erb +3 -3
  187. data/app/views/checkout/_summary.html.erb +2 -2
  188. data/app/views/checkout/edit.html.erb +3 -3
  189. data/app/views/checkout/payment/_gateway.html.erb +9 -9
  190. data/app/views/checkout/registration.html.erb +6 -6
  191. data/app/views/content/cvv.html.erb +6 -6
  192. data/app/views/home/index.html.erb +2 -2
  193. data/app/views/layouts/admin.html.erb +9 -11
  194. data/app/views/layouts/spree_application.html.erb +3 -3
  195. data/app/views/order_mailer/cancel_email.text.erb +2 -2
  196. data/app/views/orders/_form.html.erb +5 -5
  197. data/app/views/orders/_line_item.html.erb +3 -3
  198. data/app/views/orders/edit.html.erb +11 -11
  199. data/app/views/orders/new.html.erb +3 -3
  200. data/app/views/orders/show.html.erb +3 -3
  201. data/app/views/products/_cart_form.html.erb +8 -8
  202. data/app/views/products/_taxons.html.erb +1 -1
  203. data/app/views/products/_thumbnails.html.erb +2 -2
  204. data/app/views/products/index.html.erb +4 -4
  205. data/app/views/products/show.html.erb +1 -1
  206. data/app/views/shared/_filters.html.erb +2 -3
  207. data/app/views/shared/_google_analytics.html.erb +6 -6
  208. data/app/views/shared/_head.html.erb +3 -3
  209. data/app/views/shared/_order_details.html.erb +12 -12
  210. data/app/views/shared/_store_menu.html.erb +1 -1
  211. data/app/views/shared/_taxonomies.html.erb +1 -1
  212. data/app/views/shipment_mailer/shipped_email.text.erb +2 -2
  213. data/app/views/taxons/_taxon.html.erb +1 -1
  214. data/app/views/taxons/show.html.erb +4 -4
  215. data/app/views/test_mailer/test_email.text.erb +2 -2
  216. data/config/locales/en.yml +4 -2
  217. data/lib/environment_extension.rb +26 -0
  218. data/lib/generators/spree/site/site_generator.rb +8 -0
  219. data/lib/product_filters.rb +8 -0
  220. data/lib/spree/calculated_adjustments.rb +8 -8
  221. data/lib/spree/environment.rb +12 -0
  222. data/lib/spree/environment/calculators.rb +10 -0
  223. data/lib/spree_core.rb +1 -1
  224. data/lib/spree_core/railtie.rb +36 -46
  225. data/lib/spree_core/ssl_requirement.rb +1 -1
  226. data/lib/spree_core/version.rb +1 -1
  227. metadata +13 -18
  228. data/config/initializers/sprockets_precompile_patch.rb +0 -16
  229. data/lib/subclass_registration.rb +0 -21
@@ -1,24 +1,24 @@
1
1
  <table class="index" data-hook="order_details">
2
- <tbody id='line-items' data-hook>
2
+ <tbody id="line-items" data-hook>
3
3
  <tr data-hook="order_details_line_items_headers">
4
- <th><%= t('item_description') %></th>
5
- <th class="price"><%= t('price') %></th>
6
- <th class="qty"><%= t('qty') %></th>
7
- <th class="total"><span><%= t('total') %></span></th>
4
+ <th><%= t(:item_description) %></th>
5
+ <th class="price"><%= t(:price) %></th>
6
+ <th class="qty"><%= t(:qty) %></th>
7
+ <th class="total"><span><%= t(:total) %></span></th>
8
8
  </tr>
9
9
 
10
10
  <% @order.line_items.each do |item| %>
11
11
  <tr data-hook="order_details_line_item_row">
12
- <td width="300"><%=item.variant.product.name%> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %></td>
12
+ <td width="300"><%= item.variant.product.name %> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %></td>
13
13
  <td class="price"><%= number_to_currency item.price %></td>
14
- <td class="qty"><%=item.quantity%></td>
15
- <td class="total"><span><%= number_to_currency (item.price * item.quantity)%></span></td>
14
+ <td class="qty"><%= item.quantity %></td>
15
+ <td class="total"><span><%= number_to_currency (item.price * item.quantity) %></span></td>
16
16
  </tr>
17
17
  <% end %>
18
18
  </tbody>
19
- <tbody id='subtotal' data-hook="order_details_subtotal">
19
+ <tbody id="subtotal" data-hook="order_details_subtotal">
20
20
  <tr class="total" id="subtotal-row">
21
- <td colspan="3"><b><%= t('subtotal') %>:</b></td>
21
+ <td colspan="3"><b><%= t(:subtotal) %>:</b></td>
22
22
  <td class="total"><span><%= number_to_currency @order.item_total %></span></td>
23
23
  </tr>
24
24
  </tbody>
@@ -31,9 +31,9 @@
31
31
  </tr>
32
32
  <% end %>
33
33
  </tbody>
34
- <tbody id='order-total' data-hook="order_details_total">
34
+ <tbody id="order-total" data-hook="order_details_total">
35
35
  <tr class="total">
36
- <td colspan="3"><b><%= t('order_total') %>:</b></td>
36
+ <td colspan="3"><b><%= t(:order_total) %>:</b></td>
37
37
  <td class="total"><span id="order_total"><%= number_to_currency @order.total %></span></td>
38
38
  </tr>
39
39
  </tbody>
@@ -1,3 +1,3 @@
1
- <li id="home-link" data-hook><%= link_to t("home") , root_path %></li>
1
+ <li id="home-link" data-hook><%= link_to t(:home), root_path %></li>
2
2
  <li id="link-to-cart" data-hook><%= link_to_cart %></li>
3
3
 
@@ -1,6 +1,6 @@
1
1
  <div id="taxonomies" class="sidebar-item" data-hook>
2
2
  <% get_taxonomies.each do |taxonomy| %>
3
- <h3 class='taxonomy-root'><%= t("shop_by_taxonomy", :taxonomy => taxonomy.name.singularize) %></h3>
3
+ <h3 class='taxonomy-root'><%= t(:shop_by_taxonomy, :taxonomy => taxonomy.name.singularize) %></h3>
4
4
  <%= taxons_tree(taxonomy.root, @taxon, Spree::Config[:max_level_in_taxons_menu] || 1) %>
5
5
  <% end %>
6
6
  </div>
@@ -5,8 +5,8 @@ Your order has been shipped
5
5
  ============================================================
6
6
  Shipment Summary
7
7
  ============================================================
8
- <% for item in @shipment.line_items %>
9
- <%=item.variant.sku %> <%=item.variant.product.name%> <%= variant_options(item.variant) %> (<%=item.quantity%>)
8
+ <% @shipment.line_items.each do |item| %>
9
+ <%= item.variant.sku %> <%= item.variant.product.name %> <%= variant_options(item.variant) %> (<%= item.quantity %>)
10
10
  <% end %>
11
11
  ============================================================
12
12
 
@@ -1,4 +1,4 @@
1
1
  <div class="taxon" data-hook="taxon">
2
2
  <h2><%= link_to taxon.name, seo_url(taxon), :class => 'breadcrumbs' %></h2>
3
- <%= render :partial => "shared/products", :locals => {:products => taxon_preview(taxon), :taxon => taxon} %>
3
+ <%= render :partial => 'shared/products', :locals => {:products => taxon_preview(taxon), :taxon => taxon} %>
4
4
  </div>
@@ -2,18 +2,18 @@
2
2
 
3
3
  <% content_for :sidebar do %>
4
4
  <div data-hook="taxon_sidebar_navigation">
5
- <%= render :partial => "shared/taxonomies" %>
6
- <%= render(:partial => "shared/filters") if @taxon.children.empty? %>
5
+ <%= render :partial => 'shared/taxonomies' %>
6
+ <%= render :partial => 'shared/filters' if @taxon.children.empty? %>
7
7
  </div>
8
8
  <% end %>
9
9
 
10
10
  <% if @taxon.children.empty? || !params[:keywords].blank? %>
11
11
  <div data-hook="taxon_products">
12
- <%= render :partial => "shared/products", :locals => {:products => @products, :taxon => @taxon } %>
12
+ <%= render :partial => 'shared/products', :locals => {:products => @products, :taxon => @taxon } %>
13
13
  </div>
14
14
  <% else %>
15
15
  <div data-hook="taxon_children">
16
- <%= render :partial => "taxon", :collection => @taxon.children %>
16
+ <%= render :partial => 'taxon', :collection => @taxon.children %>
17
17
  </div>
18
18
  <% end %>
19
19
 
@@ -1,4 +1,4 @@
1
- <%= t('greeting', :scope => 'test_mailer.test_email') %>
1
+ <%= t('test_mailer.test_email.greeting') %>
2
2
  ================
3
3
 
4
- <%= t('message', :scope => 'test_mailer.test_email') %>
4
+ <%= t('test_mailer.test_email.message') %>
@@ -387,7 +387,7 @@ en:
387
387
  enable_login_via_openid: "Use OpenID instead"
388
388
  enable_mail_delivery: Enable Mail Delivery
389
389
  enter_exactly_as_shown_on_card: Please enter exactly as shown on the card
390
- enter_atleast_five_letters: Enter at least five letters of customer name
390
+ enter_at_least_five_letters: Enter at least five letters of customer name
391
391
  enter_password_to_confirm: "(we need your current password to confirm your changes)"
392
392
  environment: "Environment"
393
393
  error: error
@@ -533,6 +533,7 @@ en:
533
533
  new_billing_integration: New Billing Integration
534
534
  new_category: "New category"
535
535
  new_customer: "New Customer"
536
+ new_group: New Group
536
537
  new_image: "New Image"
537
538
  new_mail_method: New Mail Method
538
539
  new_option_type: "New Option Type"
@@ -628,7 +629,7 @@ en:
628
629
  out_of_stock_products: "Out of Stock Products"
629
630
  over_paid: "Over Paid"
630
631
  overview: Overview
631
- overview_welcome: "Welcome to your store overview, currently we do not have enough data to display the Overview Dashboard.<br/><br/> The dashboard will display automatically once the system has sufficent orders to allow generation of the statistics."
632
+ overview_welcome: "Welcome to your store overview, currently we do not have enough data to display the Overview Dashboard.<br /><br /> The dashboard will display automatically once the system has sufficent orders to allow generation of the statistics."
632
633
  page_only_viewable_when_logged_in: You attempted to visit a page which can only be viewed when you are logged in
633
634
  page_only_viewable_when_logged_out: You attempted to visit a page which can only be viewed when you are logged out
634
635
  paid: Paid
@@ -1025,6 +1026,7 @@ en:
1025
1026
  must_be_int: "must be an integer"
1026
1027
  must_be_non_negative: "must be a non-negative value"
1027
1028
  value: Value
1029
+ variant: Variant
1028
1030
  variants: Variants
1029
1031
  vat: "VAT"
1030
1032
  version: Version
@@ -0,0 +1,26 @@
1
+ module EnvironmentExtension
2
+ extend ActiveSupport::Concern
3
+
4
+ module InstanceMethods
5
+
6
+ def add_class(name)
7
+ self.instance_variable_set "@#{name}", Set.new
8
+ create_method( "#{name}=".to_sym ) { |val|
9
+ instance_variable_set( "@" + name, val)
10
+ }
11
+
12
+ create_method( name.to_sym ) {
13
+ instance_variable_get( "@" + name )
14
+ }
15
+ end
16
+
17
+ private
18
+
19
+ def create_method( name, &block )
20
+ self.class.send( :define_method, name, &block )
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
@@ -11,6 +11,14 @@ module Spree
11
11
  [File.expand_path('../templates', __FILE__)]
12
12
  end
13
13
 
14
+ def config_spree_yml
15
+ create_file "config/spree.yml" do
16
+ settings = { 'version' => Spree.version }
17
+
18
+ settings.to_yaml
19
+ end
20
+ end
21
+
14
22
  def remove_unneeded_files
15
23
  remove_file "public/index.html"
16
24
  end
@@ -2,6 +2,14 @@
2
2
  # the exact code probably won't be useful, though you're welcome to modify and reuse
3
3
  # the current contents are mainly for testing and documentation
4
4
 
5
+ # To override this file...
6
+ # 1) Make a copy of it in your sites local /lib folder
7
+ # 2) Add it to the config load path, or require it in an initializer, e.g...
8
+ #
9
+ # # config/initializers/spree.rb
10
+ # require 'product_filters'
11
+ #
12
+
5
13
  # set up some basic filters for use with products
6
14
  #
7
15
  # Each filter has two parts
@@ -5,15 +5,9 @@ module Spree::CalculatedAdjustments
5
5
  accepts_nested_attributes_for :calculator
6
6
  validates :calculator, :presence => true if options[:require]
7
7
 
8
- class_attribute :calculators
9
- self.calculators = Set.new
10
- # @available_calculators = []
11
- def register_calculator(calculator)
12
- self.calculators.add(calculator)
8
+ def self.calculators
9
+ Rails.application.config.spree.calculators.send(self.to_s.tableize.gsub("/", "_"))
13
10
  end
14
- # def calculators
15
- # @available_calculators
16
- # end
17
11
 
18
12
  if options[:default]
19
13
  default_calculator_class = options[:default]
@@ -31,6 +25,11 @@ module Spree::CalculatedAdjustments
31
25
  end
32
26
  end
33
27
 
28
+ #Remove in 0.80.0
29
+ def self.register(*args)
30
+ ActiveSupport::Deprecation.warn("Calculator registration has changed, add your calculator to the relevant Rails.application.config.spree.calculators collection.", caller)
31
+ end
32
+
34
33
  include InstanceMethods
35
34
  end
36
35
  end
@@ -72,3 +71,4 @@ module Spree::CalculatedAdjustments
72
71
  receiver.extend Spree::CalculatedAdjustments::ClassMethods
73
72
  end
74
73
  end
74
+
@@ -0,0 +1,12 @@
1
+ module Spree
2
+
3
+ class Environment
4
+ include EnvironmentExtension
5
+
6
+ attr_accessor :calculators, :payment_methods
7
+
8
+ def initialize
9
+ @calculators = Calculators.new
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module Spree
2
+ class Environment
3
+ class Calculators
4
+ include EnvironmentExtension
5
+
6
+ attr_accessor :shipping_methods, :tax_rates
7
+ end
8
+ end
9
+ end
10
+
data/lib/spree_core.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #++
2
- # Copyright (c) 2007-2010, Rails Dog LLC and other contributors
2
+ # Copyright (c) 2007-2011, Rails Dog LLC and other contributors
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -3,53 +3,8 @@ module SpreeCore
3
3
  engine_name 'spree_core'
4
4
 
5
5
  config.autoload_paths += %W(#{config.root}/lib)
6
- # TODO - register state monitor observer?
7
6
 
8
-
9
- # TODO: Is there a better way to make sure something within 'self.activate' only runs once in development?
10
7
  def self.activate
11
-
12
-
13
- #register all payment methods (unless we're in middle of rake task since migrations cannot be run for this first time without this check)
14
- if File.basename( $0 ) != "rake"
15
- [
16
- Gateway::Bogus,
17
- Gateway::AuthorizeNet,
18
- Gateway::AuthorizeNetCim,
19
- Gateway::Eway,
20
- Gateway::Linkpoint,
21
- Gateway::PayPal,
22
- Gateway::SagePay,
23
- Gateway::Beanstream,
24
- Gateway::Braintree,
25
- PaymentMethod::Check
26
- ].each{|gw|
27
- begin
28
- gw.register
29
- rescue Exception => e
30
- $stderr.puts "Error registering gateway #{gw}: #{e}"
31
- end
32
- }
33
-
34
- #register all calculators
35
- [
36
- Calculator::FlatPercentItemTotal,
37
- Calculator::FlatRate,
38
- Calculator::FlexiRate,
39
- Calculator::PerItem,
40
- Calculator::SalesTax,
41
- Calculator::Vat,
42
- Calculator::PriceBucket
43
- ].each{|c_model|
44
- begin
45
- c_model.register if c_model.table_exists?
46
- rescue Exception => e
47
- $stderr.puts "Error registering calculator #{c_model}"
48
- end
49
- }
50
-
51
- end
52
-
53
8
  end
54
9
 
55
10
  config.to_prepare &method(:activate).to_proc
@@ -63,14 +18,49 @@ module SpreeCore
63
18
  end
64
19
  end
65
20
 
21
+ initializer "spree.environment" do |app|
22
+ app.config.spree = Spree::Environment.new
23
+ end
24
+
25
+ initializer "spree.register.calculators" do |app|
26
+ app.config.spree.calculators.shipping_methods = [
27
+ Calculator::FlatPercentItemTotal,
28
+ Calculator::FlatRate,
29
+ Calculator::FlexiRate,
30
+ Calculator::PerItem,
31
+ Calculator::PriceBucket]
32
+
33
+ app.config.spree.calculators.tax_rates = [
34
+ Calculator::SalesTax,
35
+ Calculator::Vat]
36
+ end
37
+
38
+ initializer "spree.register.payment_methods" do |app|
39
+ app.config.spree.payment_methods = [
40
+ Gateway::Bogus,
41
+ Gateway::AuthorizeNet,
42
+ Gateway::AuthorizeNetCim,
43
+ Gateway::Eway,
44
+ Gateway::Linkpoint,
45
+ Gateway::PayPal,
46
+ Gateway::SagePay,
47
+ Gateway::Beanstream,
48
+ Gateway::Braintree,
49
+ PaymentMethod::Check ]
50
+ end
51
+
66
52
  # filter sensitive information during logging
67
53
  initializer "spree.params.filter" do |app|
68
54
  app.config.filter_parameters += [:password, :password_confirmation, :number]
69
55
  end
70
56
 
71
57
  # sets the manifests / assets to be precompiled
72
- initializer "spree.assets.precompile" do |app|
58
+ initializer "spree.assets.precompile", :group => :assets do |app|
73
59
  app.config.assets.precompile += ['store/all.*', 'admin/all.*', 'admin/spree_dash.*', 'admin/orders/edit_form.js', 'jqPlot/excanvas.min.js', 'admin/images/new.js']
60
+ end
61
+
62
+ # turn off asset debugging since that kills performance in development mode
63
+ initializer "spree.asset.pipeline" do |app|
74
64
  app.config.assets.debug = false
75
65
  end
76
66
 
@@ -1,5 +1,5 @@
1
1
  # ++
2
- # Copyright (c) 2007-2010, Rails Dog LLC and other contributors
2
+ # Copyright (c) 2007-2011, Rails Dog LLC and other contributors
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "0.70.0.rc2"
3
+ "0.70.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15425137
5
- prerelease: 7
4
+ hash: 263
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 70
9
9
  - 0
10
- - rc
11
- - 2
12
- version: 0.70.0.rc2
10
+ version: 0.70.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Sean Schofield
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2011-09-30 00:00:00 Z
18
+ date: 2011-10-07 00:00:00 Z
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
23
21
  type: :runtime
@@ -217,14 +215,12 @@ dependencies:
217
215
  requirements:
218
216
  - - "="
219
217
  - !ruby/object:Gem::Version
220
- hash: 15424105
218
+ hash: 1
221
219
  segments:
222
220
  - 3
223
221
  - 1
224
222
  - 1
225
- - rc
226
- - 2
227
- version: 3.1.1.rc2
223
+ version: 3.1.1
228
224
  version_requirements: *id013
229
225
  name: rails
230
226
  - !ruby/object:Gem::Dependency
@@ -755,11 +751,11 @@ files:
755
751
  - config/initializers/form_builder.rb
756
752
  - config/initializers/rails_3_1.rb
757
753
  - config/initializers/spree.rb
758
- - config/initializers/sprockets_precompile_patch.rb
759
754
  - config/initializers/workarounds_for_ruby19.rb
760
755
  - config/locales/en.yml
761
756
  - config/routes.rb
762
757
  - lib/custom_fixtures.rb
758
+ - lib/environment_extension.rb
763
759
  - lib/generators/spree/dummy/dummy_generator.rb
764
760
  - lib/generators/spree/dummy/templates/cucumber/cucumber.rb
765
761
  - lib/generators/spree/dummy/templates/rails/application.rb
@@ -782,6 +778,8 @@ files:
782
778
  - lib/spree/calculated_adjustments.rb
783
779
  - lib/spree/config.rb
784
780
  - lib/spree/current_order.rb
781
+ - lib/spree/environment/calculators.rb
782
+ - lib/spree/environment.rb
785
783
  - lib/spree/file_utilz.rb
786
784
  - lib/spree/gateway_error.rb
787
785
  - lib/spree/mail_interceptor.rb
@@ -845,7 +843,6 @@ files:
845
843
  - lib/spree_core/version.rb
846
844
  - lib/spree_core.rb
847
845
  - lib/store_helpers.rb
848
- - lib/subclass_registration.rb
849
846
  - lib/tasks/assets.rake
850
847
  - lib/tasks/core.rake
851
848
  - lib/tasks/install.rake
@@ -1037,14 +1034,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
1037
1034
  required_rubygems_version: !ruby/object:Gem::Requirement
1038
1035
  none: false
1039
1036
  requirements:
1040
- - - ">"
1037
+ - - ">="
1041
1038
  - !ruby/object:Gem::Version
1042
- hash: 25
1039
+ hash: 3
1043
1040
  segments:
1044
- - 1
1045
- - 3
1046
- - 1
1047
- version: 1.3.1
1041
+ - 0
1042
+ version: "0"
1048
1043
  requirements:
1049
1044
  - none
1050
1045
  rubyforge_project: spree_core