spree_core 2.1.12 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/base_helper.rb +4 -7
  3. data/app/helpers/spree/products_helper.rb +11 -9
  4. data/app/helpers/spree/store_helper.rb +5 -0
  5. data/app/models/spree/ability.rb +4 -0
  6. data/app/models/spree/address.rb +6 -6
  7. data/app/models/spree/adjustment.rb +40 -61
  8. data/app/models/spree/app_configuration.rb +1 -14
  9. data/app/models/spree/calculator.rb +12 -4
  10. data/app/models/spree/calculator/default_tax.rb +42 -38
  11. data/app/models/spree/calculator/flat_percent_item_total.rb +2 -4
  12. data/app/models/spree/calculator/free_shipping.rb +5 -2
  13. data/app/models/spree/calculator/percent_on_line_item.rb +15 -0
  14. data/app/models/spree/calculator/percent_per_item.rb +3 -0
  15. data/app/models/spree/classification.rb +3 -2
  16. data/app/models/spree/credit_card.rb +7 -25
  17. data/app/models/spree/gateway/bogus.rb +5 -5
  18. data/app/models/spree/gateway/bogus_simple.rb +0 -8
  19. data/app/models/spree/image.rb +0 -9
  20. data/app/models/spree/inventory_unit.rb +10 -4
  21. data/app/models/spree/item_adjustments.rb +65 -0
  22. data/app/models/spree/legacy_user.rb +1 -0
  23. data/app/models/spree/line_item.rb +33 -13
  24. data/app/models/spree/option_type.rb +2 -2
  25. data/app/models/spree/option_value.rb +1 -1
  26. data/app/models/spree/order.rb +109 -89
  27. data/app/models/spree/order/checkout.rb +48 -0
  28. data/app/models/spree/order_contents.rb +72 -37
  29. data/app/models/spree/order_inventory.rb +65 -68
  30. data/app/models/spree/order_populator.rb +3 -17
  31. data/app/models/spree/order_updater.rb +63 -44
  32. data/app/models/spree/payment.rb +20 -5
  33. data/app/models/spree/payment/processing.rb +19 -25
  34. data/app/models/spree/payment_capture_event.rb +9 -0
  35. data/app/models/spree/payment_method/check.rb +0 -2
  36. data/app/models/spree/price.rb +1 -1
  37. data/app/models/spree/product.rb +14 -16
  38. data/app/models/spree/product/scopes.rb +4 -6
  39. data/app/models/spree/product_option_type.rb +2 -2
  40. data/app/models/spree/product_property.rb +2 -2
  41. data/app/models/spree/promotion.rb +71 -50
  42. data/app/models/spree/promotion/actions/create_adjustment.rb +31 -32
  43. data/app/models/spree/promotion/actions/create_item_adjustments.rb +83 -0
  44. data/app/models/spree/promotion/actions/free_shipping.rb +36 -0
  45. data/app/models/spree/promotion/rules/first_order.rb +4 -0
  46. data/app/models/spree/promotion/rules/item_total.rb +5 -1
  47. data/app/models/spree/promotion/rules/product.rb +4 -0
  48. data/app/models/spree/promotion/rules/user.rb +5 -6
  49. data/app/models/spree/promotion/rules/user_logged_in.rb +4 -0
  50. data/app/models/spree/promotion_action.rb +1 -5
  51. data/app/models/spree/promotion_handler/cart.rb +38 -0
  52. data/app/models/spree/promotion_handler/coupon.rb +76 -0
  53. data/app/models/spree/promotion_handler/free_shipping.rb +31 -0
  54. data/app/models/spree/promotion_handler/page.rb +24 -0
  55. data/app/models/spree/promotion_rule.rb +15 -7
  56. data/app/models/spree/property.rb +1 -1
  57. data/app/models/spree/return_authorization.rb +7 -1
  58. data/app/models/spree/shipment.rb +113 -49
  59. data/app/models/spree/shipping_calculator.rb +4 -5
  60. data/app/models/spree/shipping_category.rb +2 -2
  61. data/app/models/spree/shipping_method.rb +12 -6
  62. data/app/models/spree/shipping_rate.rb +27 -7
  63. data/app/models/spree/stock/availability_validator.rb +1 -1
  64. data/app/models/spree/stock/estimator.rb +13 -1
  65. data/app/models/spree/stock/package.rb +11 -7
  66. data/app/models/spree/stock/packer.rb +3 -3
  67. data/app/models/spree/stock/quantifier.rb +9 -1
  68. data/app/models/spree/stock_item.rb +11 -6
  69. data/app/models/spree/stock_movement.rb +1 -2
  70. data/app/models/spree/tax_category.rb +6 -1
  71. data/app/models/spree/tax_rate.rb +57 -49
  72. data/app/models/spree/taxon.rb +10 -5
  73. data/app/models/spree/taxonomy.rb +5 -2
  74. data/app/models/spree/variant.rb +33 -16
  75. data/app/models/spree/zone.rb +24 -24
  76. data/app/views/spree/shared/_routes.html.erb +3 -0
  77. data/config/locales/en.yml +42 -26
  78. data/db/migrate/20130213191427_create_default_stock.rb +3 -3
  79. data/db/migrate/20130413230529_add_name_to_spree_credit_cards.rb +5 -0
  80. data/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb +13 -0
  81. data/db/migrate/20130417120035_update_adjustment_states.rb +2 -2
  82. data/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +1 -1
  83. data/db/migrate/20130509115210_add_number_to_stock_transfer.rb +1 -1
  84. data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +0 -5
  85. data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +7 -5
  86. data/db/migrate/20130807024301_upgrade_adjustments.rb +39 -0
  87. data/db/migrate/20130807024302_rename_adjustment_fields.rb +17 -0
  88. data/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb +5 -0
  89. data/db/migrate/20130813232134_rename_activators_to_promotions.rb +5 -0
  90. data/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb +5 -0
  91. data/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb +5 -0
  92. data/db/migrate/20130828234942_add_tax_total_to_line_items_shipments_and_orders.rb +8 -0
  93. data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +1 -1
  94. data/db/migrate/20130903183026_add_code_to_spree_promotion_rules.rb +5 -0
  95. data/db/migrate/20130917024658_remove_promotions_event_name_field.rb +5 -0
  96. data/db/migrate/20130924040529_add_promo_total_to_line_items_and_shipments_and_orders.rb +7 -0
  97. data/db/migrate/20131001013410_remove_unused_credit_card_fields.rb +7 -3
  98. data/db/migrate/20131107132123_add_tax_category_to_variants.rb +6 -0
  99. data/db/migrate/20131118043959_add_included_to_adjustments.rb +5 -0
  100. data/db/migrate/20131118050234_rename_tax_total_fields.rb +11 -0
  101. data/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb +21 -0
  102. data/db/migrate/20131127001002_add_position_to_classifications.rb +5 -0
  103. data/db/migrate/20131211112807_create_spree_orders_promotions.rb +8 -0
  104. data/db/migrate/20131218054603_add_item_count_to_spree_orders.rb +5 -0
  105. data/db/migrate/20140106224208_rename_permalink_to_slug_for_products.rb +5 -0
  106. data/db/migrate/20140124023232_rename_activator_id_in_rules_and_actions_to_promotion_id.rb +6 -0
  107. data/db/migrate/20140203161722_add_approver_id_and_approved_at_to_orders.rb +6 -0
  108. data/db/migrate/20140204115338_add_confirmation_delivered_to_spree_orders.rb +5 -0
  109. data/db/migrate/20140205120320_create_spree_payment_capture_events.rb +12 -0
  110. data/db/migrate/20140205144710_add_uncaptured_amount_to_payments.rb +5 -0
  111. data/db/migrate/20140207085910_add_tax_category_id_to_shipping_methods.rb +5 -0
  112. data/db/migrate/20140207093021_add_tax_rate_id_to_shipping_rates.rb +5 -0
  113. data/db/migrate/20140211040159_add_pre_tax_amount_to_line_items_and_shipments.rb +6 -0
  114. data/db/migrate/20140213184916_add_more_indexes.rb +13 -0
  115. data/db/migrate/20140219060952_add_considered_risky_to_orders.rb +5 -0
  116. data/lib/generators/spree/dummy/dummy_generator.rb +1 -6
  117. data/lib/generators/spree/install/install_generator.rb +6 -6
  118. data/lib/generators/spree/install/templates/{app/assets/javascripts/admin → vendor/assets/javascripts/spree/backend}/all.js +3 -3
  119. data/lib/generators/spree/install/templates/{app/assets/javascripts/store → vendor/assets/javascripts/spree/frontend}/all.js +3 -3
  120. data/lib/generators/spree/install/templates/{app/assets/stylesheets/store → vendor/assets/stylesheets/spree/backend}/all.css +3 -3
  121. data/lib/generators/spree/install/templates/{app/assets/stylesheets/admin → vendor/assets/stylesheets/spree/frontend}/all.css +3 -3
  122. data/lib/spree/core.rb +21 -8
  123. data/lib/spree/core/calculated_adjustments.rb +0 -40
  124. data/lib/spree/core/controller_helpers.rb +5 -0
  125. data/lib/spree/core/controller_helpers/auth.rb +2 -2
  126. data/lib/spree/core/controller_helpers/common.rb +0 -5
  127. data/lib/spree/core/controller_helpers/order.rb +8 -9
  128. data/lib/spree/core/engine.rb +10 -17
  129. data/lib/spree/core/permalinks.rb +1 -1
  130. data/lib/spree/core/product_duplicator.rb +3 -8
  131. data/lib/spree/core/user_address.rb +1 -1
  132. data/lib/spree/core/validators/email.rb +23 -1
  133. data/lib/spree/core/version.rb +1 -1
  134. data/lib/spree/money.rb +1 -1
  135. data/lib/spree/permitted_attributes.rb +2 -2
  136. data/lib/spree/testing_support/caching.rb +47 -0
  137. data/lib/spree/testing_support/factories/adjustment_factory.rb +11 -2
  138. data/lib/spree/testing_support/factories/credit_card_factory.rb +2 -1
  139. data/lib/spree/testing_support/factories/order_factory.rb +10 -5
  140. data/lib/spree/testing_support/factories/payment_factory.rb +2 -2
  141. data/lib/spree/testing_support/factories/payment_method_factory.rb +3 -3
  142. data/lib/spree/testing_support/factories/promotion_factory.rb +16 -1
  143. data/lib/spree/testing_support/factories/shipment_factory.rb +8 -4
  144. data/lib/spree/testing_support/factories/shipping_method_factory.rb +1 -3
  145. data/lib/spree/testing_support/factories/stock_factory.rb +1 -1
  146. data/lib/spree/testing_support/factories/tax_rate_factory.rb +2 -2
  147. data/lib/spree/testing_support/order_walkthrough.rb +1 -1
  148. data/lib/tasks/core.rake +2 -2
  149. data/vendor/assets/fonts/FontAwesome.otf +0 -0
  150. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  151. data/vendor/assets/fonts/fontawesome-webfont.svg +399 -0
  152. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  153. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  154. data/vendor/assets/stylesheets/font-awesome.scss +1475 -0
  155. metadata +73 -44
  156. data/app/assets/javascripts/admin/handlebar_extensions.js +0 -9
  157. data/app/helpers/spree/admin/adjustments_helper.rb +0 -26
  158. data/app/helpers/spree/admin/images_helper.rb +0 -18
  159. data/app/helpers/spree/promotion_rules_helper.rb +0 -13
  160. data/app/models/spree/activator.rb +0 -29
  161. data/app/models/spree/calculator/per_item.rb +0 -41
  162. data/app/models/spree/stock/remaining_packer.rb +0 -22
  163. data/app/views/spree/payments/_payment.html.erb +0 -18
  164. data/db/migrate/20131118041203_add_tax_total_to_spree_orders.rb +0 -5
  165. data/db/migrate/20131118043021_add_order_id_to_spree_adjustments.rb +0 -6
  166. data/db/migrate/20131118074808_add_included_to_spree_adjustments.rb +0 -5
  167. data/db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb +0 -5
  168. data/lib/spree/core/gateway_error.rb +0 -5
  169. data/lib/spree/core/preference_rescue.rb +0 -25
  170. data/lib/spree/core/s3_support.rb +0 -25
  171. data/lib/spree/promo/coupon_applicator.rb +0 -71
  172. data/lib/spree/testing_support/factories/activator_factory.rb +0 -8
@@ -1,10 +1,12 @@
1
1
  class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration
2
2
  def change
3
- Spree::LineItem.find_each do |line_item|
4
- next if line_item.variant.nil?
5
- next if line_item.variant.product.nil?
6
- next if line_item.product.nil?
7
- line_item.update_column(:tax_category_id, line_item.product.tax_category_id)
3
+ Spree::LineItem.includes(:variant => { :product => :tax_category }).find_in_batches do |line_items|
4
+ line_items.each do |line_item|
5
+ next if line_item.variant.nil?
6
+ next if line_item.variant.product.nil?
7
+ next if line_item.product.nil?
8
+ line_item.update_column(:tax_category_id, line_item.product.tax_category_id)
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -0,0 +1,39 @@
1
+ class UpgradeAdjustments < ActiveRecord::Migration
2
+ def up
3
+ # Temporarily make originator association available
4
+ Spree::Adjustment.class_eval do
5
+ belongs_to :originator, polymorphic: true
6
+ end
7
+ # Shipping adjustments are now tracked as fields on the object
8
+ Spree::Adjustment.where(:source_type => "Spree::Shipment").find_each do |adjustment|
9
+ # Account for possible invalid data
10
+ next if adjustment.source.nil?
11
+ adjustment.source.update_column(:cost, adjustment.amount)
12
+ adjustment.destroy
13
+ end
14
+
15
+ # Tax adjustments have their sources altered
16
+ Spree::Adjustment.where(:originator_type => "Spree::TaxRate").find_each do |adjustment|
17
+ adjustment.source = adjustment.originator
18
+ adjustment.save
19
+ end
20
+
21
+ # Promotion adjustments have their source altered also
22
+ Spree::Adjustment.where(:originator_type => "Spree::PromotionAction").find_each do |adjustment|
23
+ next if adjustment.originator.nil?
24
+ adjustment.source = adjustment.originator
25
+ begin
26
+ if adjustment.source.calculator_type == "Spree::Calculator::FreeShipping"
27
+ # Previously this was a Spree::Promotion::Actions::CreateAdjustment
28
+ # And it had a calculator to work out FreeShipping
29
+ # In Spree 2.2, the "calculator" is now the action itself.
30
+ adjustment.source.becomes(Spree::Promotion::Actions::FreeShipping)
31
+ end
32
+ rescue
33
+ # Fail silently. This is primarily in instances where the calculator no longer exists
34
+ end
35
+
36
+ adjustment.save
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,17 @@
1
+ class RenameAdjustmentFields < ActiveRecord::Migration
2
+ def up
3
+ remove_column :spree_adjustments, :originator_id
4
+ remove_column :spree_adjustments, :originator_type
5
+
6
+ add_column :spree_adjustments, :order_id, :integer unless column_exists?(:spree_adjustments, :order_id)
7
+
8
+ # This enables the Spree::Order#all_adjustments association to work correctly
9
+ Spree::Adjustment.reset_column_information
10
+ Spree::Adjustment.find_each do |adjustment|
11
+ if adjustment.adjustable.is_a?(Spree::Order)
12
+ adjustment.order = adjustment.adjustable
13
+ adjustment.save
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class AddShipmentTotalToSpreeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :shipment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RenameActivatorsToPromotions < ActiveRecord::Migration
2
+ def change
3
+ rename_table :spree_activators, :spree_promotions
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddAdjustmentTotalToLineItems < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_line_items, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddAdjustmentTotalToShipments < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_shipments, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class AddTaxTotalToLineItemsShipmentsAndOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_line_items, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0
4
+ add_column :spree_shipments, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0
5
+ # This column may already be here from a 2.1.x migration
6
+ add_column :spree_orders, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 unless Spree::Order.column_names.include?("tax_total")
7
+ end
8
+ end
@@ -3,7 +3,7 @@ class MigrateOldShippingCalculators < ActiveRecord::Migration
3
3
  Spree::ShippingMethod.all.each do |shipping_method|
4
4
  old_calculator = shipping_method.calculator
5
5
  next if old_calculator.class < Spree::ShippingCalculator # We don't want to mess with new shipping calculators
6
- new_calculator = eval(old_calculator.class.name.sub("::Calculator::", "::Calculator::Shipping::")).new
6
+ new_calculator = eval("Spree::Calculator::Shipping::#{old_calculator.class.name.demodulize}").new
7
7
  new_calculator.preferences.keys.each do |pref|
8
8
  # Preferences can't be read/set by name, you have to prefix preferred_
9
9
  pref_method = "preferred_#{pref}"
@@ -0,0 +1,5 @@
1
+ class AddCodeToSpreePromotionRules < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_promotion_rules, :code, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RemovePromotionsEventNameField < ActiveRecord::Migration
2
+ def change
3
+ remove_column :spree_promotions, :event_name
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class AddPromoTotalToLineItemsAndShipmentsAndOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_line_items, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0
4
+ add_column :spree_shipments, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0
5
+ add_column :spree_orders, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0
6
+ end
7
+ end
@@ -1,12 +1,16 @@
1
1
  class RemoveUnusedCreditCardFields < ActiveRecord::Migration
2
2
  def up
3
- remove_column :spree_credit_cards, :start_month
4
- remove_column :spree_credit_cards, :start_year
5
- remove_column :spree_credit_cards, :issue_number
3
+ remove_column :spree_credit_cards, :start_month if column_exists?(:spree_credit_cards, :start_month)
4
+ remove_column :spree_credit_cards, :start_year if column_exists?(:spree_credit_cards, :start_year)
5
+ remove_column :spree_credit_cards, :issue_number if column_exists?(:spree_credit_cards, :issue_number)
6
6
  end
7
7
  def down
8
8
  add_column :spree_credit_cards, :start_month, :string
9
9
  add_column :spree_credit_cards, :start_year, :string
10
10
  add_column :spree_credit_cards, :issue_number, :string
11
11
  end
12
+
13
+ def column_exists?(table, column)
14
+ ActiveRecord::Base.connection.column_exists?(table, column)
15
+ end
12
16
  end
@@ -0,0 +1,6 @@
1
+ class AddTaxCategoryToVariants < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_variants, :tax_category_id, :integer
4
+ add_index :spree_variants, :tax_category_id
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddIncludedToAdjustments < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_adjustments, :included, :boolean, :default => false unless Spree::Adjustment.column_names.include?("included")
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class RenameTaxTotalFields < ActiveRecord::Migration
2
+ def change
3
+ rename_column :spree_line_items, :tax_total, :additional_tax_total
4
+ rename_column :spree_shipments, :tax_total, :additional_tax_total
5
+ rename_column :spree_orders, :tax_total, :additional_tax_total
6
+
7
+ add_column :spree_line_items, :included_tax_total, :decimal, precision: 10, scale: 2, null: false, default: 0.0
8
+ add_column :spree_shipments, :included_tax_total, :decimal, precision: 10, scale: 2, null: false, default: 0.0
9
+ add_column :spree_orders, :included_tax_total, :decimal, precision: 10, scale: 2, null: false, default: 0.0
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ class AddLineItemIdToSpreeInventoryUnits < ActiveRecord::Migration
2
+ def change
3
+ # Stores running the product-assembly extension already have a line_item_id column
4
+ unless column_exists? Spree::InventoryUnit.table_name, :line_item_id
5
+ add_column :spree_inventory_units, :line_item_id, :integer
6
+ add_index :spree_inventory_units, :line_item_id
7
+
8
+ shipments = Spree::Shipment.includes(:inventory_units, :order)
9
+
10
+ shipments.find_each do |shipment|
11
+ shipment.inventory_units.group_by(&:variant).each do |variant, units|
12
+
13
+ line_item = shipment.order.find_line_item_by_variant(variant)
14
+ next unless line_item
15
+
16
+ Spree::InventoryUnit.where(id: units.map(&:id)).update_all(line_item_id: line_item.id)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ class AddPositionToClassifications < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_products_taxons, :position, :integer
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class CreateSpreeOrdersPromotions < ActiveRecord::Migration
2
+ def change
3
+ create_table :spree_orders_promotions, :id => false do |t|
4
+ t.references :order
5
+ t.references :promotion
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddItemCountToSpreeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :item_count, :integer, :default => 0
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RenamePermalinkToSlugForProducts < ActiveRecord::Migration
2
+ def change
3
+ rename_column :spree_products, :permalink, :slug
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class RenameActivatorIdInRulesAndActionsToPromotionId < ActiveRecord::Migration
2
+ def change
3
+ rename_column :spree_promotion_rules, :activator_id, :promotion_id
4
+ rename_column :spree_promotion_actions, :activator_id, :promotion_id
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class AddApproverIdAndApprovedAtToOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :approver_id, :integer
4
+ add_column :spree_orders, :approved_at, :datetime
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddConfirmationDeliveredToSpreeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :confirmation_delivered, :boolean, default: false
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSpreePaymentCaptureEvents < ActiveRecord::Migration
2
+ def change
3
+ create_table :spree_payment_capture_events do |t|
4
+ t.decimal :amount, precision: 10, scale: 2, default: 0.0
5
+ t.integer :payment_id
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ add_index :spree_payment_capture_events, :payment_id
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class AddUncapturedAmountToPayments < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_payments, :uncaptured_amount, :decimal, precision: 10, scale: 2, default: 0.0
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddTaxCategoryIdToShippingMethods < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_shipping_methods, :tax_category_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddTaxRateIdToShippingRates < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_shipping_rates, :tax_rate_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddPreTaxAmountToLineItemsAndShipments < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_line_items, :pre_tax_amount, :decimal, precision: 8, scale: 2
4
+ add_column :spree_shipments, :pre_tax_amount, :decimal, precision: 8, scale: 2
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ class AddMoreIndexes < ActiveRecord::Migration
2
+ def change
3
+ add_index :spree_payment_methods, [:id, :type]
4
+ add_index :spree_calculators, [:id, :type]
5
+ add_index :spree_calculators, [:calculable_id, :calculable_type]
6
+ add_index :spree_payments, :payment_method_id
7
+ add_index :spree_promotion_actions, [:id, :type]
8
+ add_index :spree_promotion_actions, :promotion_id
9
+ add_index :spree_promotions, [:id, :type]
10
+ add_index :spree_option_values, :option_type_id
11
+ add_index :spree_shipments, :stock_location_id
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddConsideredRiskyToOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :considered_risky, :boolean, :default => false
4
+ end
5
+ end
@@ -122,12 +122,7 @@ end
122
122
  end
123
123
 
124
124
  def gemfile_path
125
- version_file = File.expand_path("../../Versionfile", Dir.pwd)
126
- if File.exist?(version_file)
127
- '../../../../Gemfile'
128
- else
129
- '../../../../../Gemfile'
130
- end
125
+ '../../../../../Gemfile'
131
126
  end
132
127
  end
133
128
  end
@@ -70,18 +70,18 @@ Disallow: /account
70
70
  def setup_assets
71
71
  @lib_name = 'spree'
72
72
  %w{javascripts stylesheets images}.each do |path|
73
- empty_directory "app/assets/#{path}/store" if defined? Spree::Frontend || Rails.env.test?
74
- empty_directory "app/assets/#{path}/admin" if defined? Spree::Backend || Rails.env.test?
73
+ empty_directory "vendor/assets/#{path}/spree/frontend" if defined? Spree::Frontend || Rails.env.test?
74
+ empty_directory "vendor/assets/#{path}/spree/backend" if defined? Spree::Backend || Rails.env.test?
75
75
  end
76
76
 
77
77
  if defined? Spree::Frontend || Rails.env.test?
78
- template "app/assets/javascripts/store/all.js"
79
- template "app/assets/stylesheets/store/all.css"
78
+ template "vendor/assets/javascripts/spree/frontend/all.js"
79
+ template "vendor/assets/stylesheets/spree/frontend/all.css"
80
80
  end
81
81
 
82
82
  if defined? Spree::Backend || Rails.env.test?
83
- template "app/assets/javascripts/admin/all.js"
84
- template "app/assets/stylesheets/admin/all.css"
83
+ template "vendor/assets/javascripts/spree/backend/all.js"
84
+ template "vendor/assets/stylesheets/spree/backend/all.css"
85
85
  end
86
86
  end
87
87
 
@@ -6,9 +6,9 @@
6
6
  //
7
7
  //= require jquery
8
8
  //= require jquery_ujs
9
- <% if options[:lib_name] == 'spree' %>
10
- //= require admin/spree_backend
9
+ <% if options[:lib_name] == 'spree' || options[:lib_name] == 'spree/backend' %>
10
+ //= require spree/backend
11
11
  <% else %>
12
- //= require admin/<%= options[:lib_name].gsub("/", "_") %>
12
+ //= require spree/backend/<%= options[:lib_name].gsub("/", "_") %>
13
13
  <% end %>
14
14
  //= require_tree .
@@ -6,9 +6,9 @@
6
6
  //
7
7
  //= require jquery
8
8
  //= require jquery_ujs
9
- <% if options[:lib_name] == 'spree' %>
10
- //= require store/spree_frontend
9
+ <% if options[:lib_name] == 'spree' || options[:lib_name] == 'spree/frontend' %>
10
+ //= require spree/frontend
11
11
  <% else %>
12
- //= require store/<%= options[:lib_name].gsub("/", "_") %>
12
+ //= require spree/frontend/<%= options[:lib_name].gsub("/", "_") %>
13
13
  <% end %>
14
14
  //= require_tree .
@@ -3,10 +3,10 @@
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *
6
- <% if options[:lib_name] == 'spree' %>
7
- *= require store/spree_frontend
6
+ <% if options[:lib_name] == 'spree' || options[:lib_name] == 'spree/backend' %>
7
+ *= require spree/backend
8
8
  <% else %>
9
- *= require store/<%= options[:lib_name].gsub("/", "_") %>
9
+ *= require spree/backend/<%= options[:lib_name].gsub("/", "_") %>
10
10
  <% end %>
11
11
  *= require_self
12
12
  *= require_tree .
@@ -3,10 +3,10 @@
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *
6
- <% if options[:lib_name] == 'spree' %>
7
- *= require admin/spree_backend
6
+ <% if options[:lib_name] == 'spree' || options[:lib_name] == 'spree/frontend' %>
7
+ *= require spree/frontend
8
8
  <% else %>
9
- *= require admin/<%= options[:lib_name].gsub("/", "_") %>
9
+ *= require spree/frontend/<%= options[:lib_name].gsub("/", "_") %>
10
10
  <% end %>
11
11
  *= require_self
12
12
  *= require_tree .
@@ -5,11 +5,11 @@ require 'awesome_nested_set'
5
5
  require 'cancan'
6
6
  require 'kaminari'
7
7
  require 'mail'
8
- require 'monetize'
9
8
  require 'paperclip'
10
9
  require 'paranoia'
11
10
  require 'ransack'
12
11
  require 'state_machine'
12
+ require 'friendly_id'
13
13
 
14
14
  module Spree
15
15
 
@@ -36,24 +36,37 @@ module Spree
36
36
  def self.config(&block)
37
37
  yield(Spree::Config)
38
38
  end
39
+
40
+ module Core
41
+ autoload :ProductFilters, "spree/core/product_filters"
42
+
43
+ class GatewayError < RuntimeError; end
44
+ end
39
45
  end
40
46
 
41
47
  require 'spree/core/version'
48
+
49
+ require 'spree/core/mail_interceptor'
50
+ require 'spree/core/mail_method'
51
+ require 'spree/core/mail_settings'
52
+ require 'spree/core/environment_extension'
53
+ require 'spree/core/environment/calculators'
54
+ require 'spree/core/environment'
55
+ require 'spree/promo/environment'
42
56
  require 'spree/migrations'
43
57
  require 'spree/core/engine'
44
58
 
45
59
  require 'spree/i18n'
46
60
  require 'spree/money'
47
- require 'spree/promo/coupon_applicator'
48
61
 
62
+ require 'spree/permitted_attributes'
63
+ require 'spree/core/user_address'
49
64
  require 'spree/core/delegate_belongs_to'
50
65
  require 'spree/core/permalinks'
51
66
  require 'spree/core/token_resource'
52
67
  require 'spree/core/calculated_adjustments'
53
68
  require 'spree/core/product_duplicator'
54
- require 'spree/core/mail_method'
55
- require 'spree/core/mail_settings'
56
-
57
- ActiveRecord::Base.class_eval do
58
- include CollectiveIdea::Acts::NestedSet
59
- end
69
+ require 'spree/core/controller_helpers'
70
+ require 'spree/core/controller_helpers/strong_parameters'
71
+ require 'spree/core/controller_helpers/ssl'
72
+ require 'spree/core/controller_helpers/search'