spree_core 5.3.0.rc2 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4241192c0b403bb14c71969625a754c8697e3f2cdc643e2095ad87a013b11b8b
4
- data.tar.gz: 2c747e6ad0a508d22442d959c8617b7bed0fd215b2606c4f889c6bba04c87507
3
+ metadata.gz: 5d6583fe2ea61bf166c3e25d8739ea9b953b396c35acfbb4e47edde6d612d59d
4
+ data.tar.gz: 3bc0a7d98a739e16e3857eabdf23cbb25a989f17cf7186ae0632ced2bff36ac4
5
5
  SHA512:
6
- metadata.gz: 805d79f3e0e69417cd88b7304aabf4ac9b9a3df5ff04a3738c500ed6711b0ce8f3f5b1007e0ac7a90a865ec218e9ffc52d238c0ad79884316f04eba4f967cdeb
7
- data.tar.gz: 250588209094b5acf8215c85c4616880794d38d01644c011c4bee3349df39f0a3b48826918f710715dc464dff06b03c827bd28efd687303038cee2bc4ec28e21
6
+ metadata.gz: 66a7c9d1bbe53c07cf36032a2b61ebf850489a3e5b3e515c2916ad9bfa685b10e7a2bc7d8d0a5de1cb8241e7b96e0c31eb60de3351e306e6347a25f52032faf3
7
+ data.tar.gz: 9dca332fe825e8342f9b2492bbd555e3d6b2868ae1a5a9f5f99a163d86efd28fba5c0bb63df74f9b304f1b2fb65f8aa9481bbca22c6757b13c7a05851c1d456e
data/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # Spree Core
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/spree_core.svg)](https://badge.fury.io/rb/spree_core)
4
+
5
+ Spree Core is the foundation of Spree Commerce, containing all the essential models, services, and business logic that power an e-commerce application.
6
+
7
+ ## Overview
8
+
9
+ This gem provides:
10
+
11
+ - **Domain Models** - Products, Variants, Orders, Payments, Shipments, Taxons, Stores, and more
12
+ - **Services** - Cart operations, checkout flows, order management, inventory handling
13
+ - **State Machines** - Order and payment state management
14
+ - **Events System** - Publish/subscribe architecture for loose coupling
15
+ - **Dependencies Injection** - Swappable service implementations via `Spree::Dependencies`
16
+ - **Permissions** - CanCanCan-based authorization with Permission Sets
17
+
18
+ ## Installation
19
+
20
+ This gem is included in every Spree installation. No additional steps are required.
21
+
22
+ ## Key Components
23
+
24
+ ### Models
25
+
26
+ All models are namespaced under `Spree::` and include:
27
+
28
+ - `Spree::Product` / `Spree::Variant` - Product catalog
29
+ - `Spree::Order` / `Spree::LineItem` - Order management
30
+ - `Spree::Payment` / `Spree::PaymentMethod` - Payment processing
31
+ - `Spree::Shipment` / `Spree::ShippingMethod` - Shipping and fulfillment
32
+ - `Spree::Taxon` / `Spree::Taxonomy` - Product categorization
33
+ - `Spree::Store` - Multi-store support
34
+ - `Spree::Promotion` - Promotions and discounts
35
+ - `Spree::GiftCard` - Gift card functionality
36
+
37
+ ### Services
38
+
39
+ Services follow a consistent interface pattern and are located in `app/services/spree/`:
40
+
41
+ ```ruby
42
+ # Add item to cart
43
+ Spree.cart_add_item_service.call(
44
+ order: order,
45
+ variant: variant,
46
+ quantity: 1
47
+ )
48
+ ```
49
+
50
+ ### Events System
51
+
52
+ Spree uses an event-driven architecture for decoupling components:
53
+
54
+ ```ruby
55
+ # Publishing events
56
+ order.publish_event('order.completed')
57
+
58
+ # Subscribing to events
59
+ module Spree
60
+ module MySubscriber
61
+ include Spree::Event::Subscriber
62
+
63
+ event_action :order_completed
64
+
65
+ def order_completed(event)
66
+ order = event.payload[:order]
67
+ # Handle the event
68
+ end
69
+ end
70
+ end
71
+ ```
72
+
73
+ ### Dependencies
74
+
75
+ Swap out default implementations with custom services:
76
+
77
+ ```ruby
78
+ # config/initializers/spree.rb
79
+ Spree::Dependencies.cart_add_item_service = 'MyCustom::CartAddItem'
80
+ ```
81
+
82
+ ## Configuration
83
+
84
+ Configure Spree in an initializer:
85
+
86
+ ```ruby
87
+ # config/initializers/spree.rb
88
+ Spree.config do |config|
89
+ config.currency = 'USD'
90
+ config.default_country_iso = 'US'
91
+ end
92
+ ```
93
+
94
+ ## Testing
95
+
96
+ Spree Core includes testing support utilities:
97
+
98
+ ```ruby
99
+ # spec/rails_helper.rb
100
+ require 'spree/testing_support/factories'
101
+ require 'spree/testing_support/authorization_helpers'
102
+ ```
103
+
104
+ To run the test suite:
105
+
106
+ ```bash
107
+ cd core
108
+ bundle exec rake test_app # First time only
109
+ bundle exec rspec
110
+ ```
111
+
112
+ ## Documentation
113
+
114
+ - [Official Documentation](https://docs.spreecommerce.org)
115
+ - [API Reference](https://api.spreecommerce.org)
116
+ - [Guides](https://docs.spreecommerce.org/developer)
@@ -367,6 +367,14 @@ module Spree
367
367
  variant_for_images&.primary_image
368
368
  end
369
369
 
370
+ # Backward compatibility for Spree 5.2 and earlier.
371
+ # @deprecated Use Spree::Product#default_image instead.
372
+ def featured_image
373
+ Spree::Deprecation.warn('Spree::Product#featured_image is deprecated and will be removed in Spree 5.5. Please use Spree::Product#default_image instead.')
374
+
375
+ default_image
376
+ end
377
+
370
378
  # Returns secondary Image for Product (for hover effects).
371
379
  # @return [Spree::Image, nil]
372
380
  def secondary_image
@@ -56,7 +56,7 @@ module Spree
56
56
  end
57
57
 
58
58
  def get_availability(product)
59
- return 'in stock' if product.available? && product.available_on&.past?
59
+ return 'in stock' if product.available? && (product.available_on.nil? || product.available_on.past?)
60
60
  return 'backorder' if product.backorderable? && product.backordered? && product.available_on&.future?
61
61
 
62
62
  'out of stock'
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- VERSION = '5.3.0.rc2'.freeze
2
+ VERSION = '5.3.0'.freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -58,8 +58,17 @@ namespace :common do
58
58
  end
59
59
 
60
60
  # Run core Spree install generator
61
+ # The spree:install generator lives in the root spree gem. Core gems (spree_core, spree_api)
62
+ # don't have spree as a dependency, so we need to use the root Gemfile to access the generator.
63
+ # Other gems (admin, storefront, etc.) already have spree in their Gemfile.
64
+ core_gems = %w[spree/core spree/api]
65
+ root_gemfile = File.expand_path('../../../../Gemfile', __dir__)
66
+ use_root_gemfile = core_gems.include?(ENV['LIB_NAME']) &&
67
+ File.exist?(root_gemfile) &&
68
+ File.exist?(File.expand_path('../../../../spree.gemspec', __dir__))
69
+ bundle_exec = use_root_gemfile ? "bundle exec --gemfile=#{root_gemfile}" : 'bundle exec'
61
70
  puts 'Running Spree install generator...'
62
- system("bundle exec rails g spree:install --force --auto-accept --migrate=false --seed=false --sample=false --user_class=#{args[:user_class]} --admin_user_class=#{args[:admin_user_class]} --authentication=#{args[:authentication]}")
71
+ system("#{bundle_exec} rails g spree:install --force --auto-accept --migrate=false --seed=false --sample=false --user_class=#{args[:user_class]} --admin_user_class=#{args[:admin_user_class]} --authentication=#{args[:authentication]}")
63
72
 
64
73
  # Determine if we need to install admin/storefront
65
74
  # Either via explicit flag or because we're testing that gem itself
@@ -4,6 +4,6 @@ desc 'Generates a dummy app for testing an extension'
4
4
  namespace :extension do
5
5
  task :test_app, [:authentication, :user_class] do |_t, args|
6
6
  Spree::DummyGeneratorHelper.inject_extension_requirements = true
7
- Rake::Task['common:test_app'].execute(args.with_defaults(install_admin: true, install_storefront: true))
7
+ Rake::Task['common:test_app'].execute(args)
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0.rc2
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -566,6 +566,7 @@ extensions: []
566
566
  extra_rdoc_files: []
567
567
  files:
568
568
  - LICENSE.md
569
+ - README.md
569
570
  - Rakefile
570
571
  - app/assets/config/spree_core_manifest.js
571
572
  - app/assets/images/google_on_white_hdpi.png
@@ -1702,9 +1703,9 @@ licenses:
1702
1703
  - BSD-3-Clause
1703
1704
  metadata:
1704
1705
  bug_tracker_uri: https://github.com/spree/spree/issues
1705
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0.rc2
1706
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0
1706
1707
  documentation_uri: https://docs.spreecommerce.org/
1707
- source_code_uri: https://github.com/spree/spree/tree/v5.3.0.rc2
1708
+ source_code_uri: https://github.com/spree/spree/tree/v5.3.0
1708
1709
  rdoc_options: []
1709
1710
  require_paths:
1710
1711
  - lib