spree_core 3.5.0 → 3.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/helpers/spree/base_helper.rb +2 -3
- data/app/helpers/spree/products_helper.rb +1 -1
- data/app/models/concerns/spree/attachment_validation.rb +10 -0
- data/app/models/spree/adjustable/adjustments_updater.rb +5 -2
- data/app/models/spree/asset.rb +11 -2
- data/app/models/spree/asset/support/active_storage.rb +25 -0
- data/app/models/spree/image.rb +1 -43
- data/app/models/spree/image/configuration/active_storage.rb +41 -0
- data/app/models/spree/image/configuration/paperclip.rb +64 -0
- data/app/models/spree/preferences/store.rb +9 -1
- data/app/models/spree/promotion.rb +0 -1
- data/app/models/spree/promotion_handler/coupon.rb +34 -0
- data/app/models/spree/return_item/eligibility_validator/default.rb +1 -1
- data/app/models/spree/taxon_icon.rb +1 -9
- data/app/models/spree/taxon_icon/configuration/active_storage.rb +27 -0
- data/app/models/spree/taxon_icon/configuration/paperclip.rb +25 -0
- data/config/initializers/active_storage.rb +5 -0
- data/config/initializers/use_paperclip.rb +3 -0
- data/config/locales/en.yml +9 -1
- data/db/default/spree/promotions.rb +23 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +8 -0
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -1
- data/lib/spree/core.rb +1 -0
- data/lib/spree/core/engine.rb +3 -3
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/caching.rb +47 -47
- data/spec/fixtures/text-file.txt +1 -0
- data/spree_core.gemspec +3 -2
- metadata +31 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f3a62997dc364cc3ebb70bbb5ff1bffd6c663e0bce92f21ee0f8a1c6680f6c4c
|
4
|
+
data.tar.gz: 261701f37b5fd2f42ee790eb5f857be8cd23929d037d85ebd3c7251958f8c67a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7fe5bd4de04b1958a76e81c82ebb56c36fa20fa3e8b0152533aa1d19f6695269366a5e620911bf3fb06b769e5fe816a53785a664b3c68f17744b475334fbe0
|
7
|
+
data.tar.gz: 509928ad83be2095dfd50ef8d7d62fff6309801b796ce41b0b0ea2de0efd8c8832fb85d81467bcc58bb46cced38b6faab44514fae9cb8fc2ef8b22b2371b5e8c
|
@@ -92,7 +92,7 @@ module Spree
|
|
92
92
|
|
93
93
|
def create_product_image_tag(image, product, options, style)
|
94
94
|
options.reverse_merge! alt: image.alt.blank? ? product.name : image.alt
|
95
|
-
image_tag image.
|
95
|
+
image_tag main_app.url_for(image.url(style)), options
|
96
96
|
end
|
97
97
|
|
98
98
|
def define_image_method(style)
|
@@ -118,8 +118,7 @@ module Spree
|
|
118
118
|
# Returns style of image or nil
|
119
119
|
def image_style_from_method_name(method_name)
|
120
120
|
if method_name.to_s.match(/_image$/) && style = method_name.to_s.sub(/_image$/, '')
|
121
|
-
|
122
|
-
style if style.in? possible_styles.with_indifferent_access
|
121
|
+
style if style.in? Spree::Image.styles.with_indifferent_access
|
123
122
|
end
|
124
123
|
end
|
125
124
|
end
|
@@ -54,7 +54,7 @@ module Spree
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def cache_key_for_product(product = @product)
|
57
|
-
(common_product_cache_keys + [product.
|
57
|
+
(common_product_cache_keys + [product.cache_key_with_version, product.possible_promotions]).compact.join('/')
|
58
58
|
end
|
59
59
|
|
60
60
|
def available_status(product) # will return a human readable string
|
@@ -11,8 +11,7 @@ module Spree
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def update
|
14
|
-
return unless
|
15
|
-
return unless @adjustable.persisted?
|
14
|
+
return unless adjustable_still_exists?
|
16
15
|
|
17
16
|
totals = {
|
18
17
|
non_taxable_adjustment_total: 0,
|
@@ -43,6 +42,10 @@ module Spree
|
|
43
42
|
def adjusters
|
44
43
|
Rails.application.config.spree.adjusters
|
45
44
|
end
|
45
|
+
|
46
|
+
def adjustable_still_exists?
|
47
|
+
@adjustable && @adjustable.class.exists?(@adjustable.id)
|
48
|
+
end
|
46
49
|
end
|
47
50
|
end
|
48
51
|
end
|
data/app/models/spree/asset.rb
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
module Spree
|
2
|
-
|
3
|
-
|
2
|
+
if Rails.application.config.use_paperclip
|
3
|
+
ActiveSupport::Deprecation.warn(<<-EOS, caller)
|
4
|
+
Paperclip support is deprecated, and will be removed in Spree 4.0.
|
5
|
+
Please migrate to ActiveStorage, to avoid problems after update
|
6
|
+
https://github.com/thoughtbot/paperclip/blob/master/MIGRATING.md
|
7
|
+
EOS
|
8
|
+
Paperclip.interpolates :viewable_id do |attachment, _style|
|
9
|
+
attachment.instance.viewable_id
|
10
|
+
end
|
4
11
|
end
|
5
12
|
|
6
13
|
class Asset < Spree::Base
|
14
|
+
include Support::ActiveStorage unless Rails.application.config.use_paperclip
|
15
|
+
|
7
16
|
belongs_to :viewable, polymorphic: true, touch: true
|
8
17
|
acts_as_list scope: [:viewable_id, :viewable_type]
|
9
18
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Spree
|
2
|
+
class Asset < Spree::Base
|
3
|
+
module Support
|
4
|
+
module ActiveStorage
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
def url(style)
|
9
|
+
return placeholder(style) unless attachment.attached?
|
10
|
+
|
11
|
+
attachment.variant(resize: dimensions_for_style(style))
|
12
|
+
end
|
13
|
+
|
14
|
+
def placeholder(style)
|
15
|
+
"noimage/#{style}.png"
|
16
|
+
end
|
17
|
+
|
18
|
+
def dimensions_for_style(style)
|
19
|
+
self.class.styles.with_indifferent_access[style] || default_style
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/app/models/spree/image.rb
CHANGED
@@ -1,47 +1,5 @@
|
|
1
1
|
module Spree
|
2
2
|
class Image < Asset
|
3
|
-
|
4
|
-
|
5
|
-
def self.accepted_image_types
|
6
|
-
%w(image/jpeg image/jpg image/png image/gif)
|
7
|
-
end
|
8
|
-
|
9
|
-
has_attached_file :attachment,
|
10
|
-
styles: { mini: '48x48>', small: '100x100>', product: '240x240>', large: '600x600>' },
|
11
|
-
default_style: :product,
|
12
|
-
url: '/spree/products/:id/:style/:basename.:extension',
|
13
|
-
path: ':rails_root/public/spree/products/:id/:style/:basename.:extension',
|
14
|
-
convert_options: { all: '-strip -auto-orient -colorspace sRGB' }
|
15
|
-
validates_attachment :attachment,
|
16
|
-
presence: true,
|
17
|
-
content_type: { content_type: accepted_image_types }
|
18
|
-
|
19
|
-
# save the w,h of the original image (from which others can be calculated)
|
20
|
-
# we need to look at the write-queue for images which have not been saved yet
|
21
|
-
before_save :find_dimensions, if: :attachment_updated_at_changed?
|
22
|
-
|
23
|
-
# used by admin products autocomplete
|
24
|
-
def mini_url
|
25
|
-
attachment.url(:mini, false)
|
26
|
-
end
|
27
|
-
|
28
|
-
def find_dimensions
|
29
|
-
temporary = attachment.queued_for_write[:original]
|
30
|
-
filename = temporary.path unless temporary.nil?
|
31
|
-
filename = attachment.path if filename.blank?
|
32
|
-
geometry = Paperclip::Geometry.from_file(filename)
|
33
|
-
self.attachment_width = geometry.width
|
34
|
-
self.attachment_height = geometry.height
|
35
|
-
end
|
36
|
-
|
37
|
-
# if there are errors from the plugin, then add a more meaningful message
|
38
|
-
def no_attachment_errors
|
39
|
-
unless attachment.errors.empty?
|
40
|
-
# uncomment this to get rid of the less-than-useful interim messages
|
41
|
-
# errors.clear
|
42
|
-
errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
|
43
|
-
false
|
44
|
-
end
|
45
|
-
end
|
3
|
+
include Rails.application.config.use_paperclip ? Configuration::Paperclip : Configuration::ActiveStorage
|
46
4
|
end
|
47
5
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Spree
|
2
|
+
class Image < Asset
|
3
|
+
module Configuration
|
4
|
+
module ActiveStorage
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
include ::Spree::AttachmentValidation
|
7
|
+
|
8
|
+
included do
|
9
|
+
validate :check_attachment_presence
|
10
|
+
validate :check_attachment_content_type
|
11
|
+
|
12
|
+
has_one_attached :attachment
|
13
|
+
|
14
|
+
def self.styles
|
15
|
+
@styles ||= {
|
16
|
+
mini: '48x48>',
|
17
|
+
small: '100x100>',
|
18
|
+
product: '240x240>',
|
19
|
+
large: '600x600>'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_style
|
24
|
+
:product
|
25
|
+
end
|
26
|
+
|
27
|
+
def accepted_image_types
|
28
|
+
%w(image/jpeg image/jpg image/png image/gif)
|
29
|
+
end
|
30
|
+
|
31
|
+
def check_attachment_presence
|
32
|
+
unless attachment.attached?
|
33
|
+
attachment.purge
|
34
|
+
errors.add(:attachment, :attachment_must_be_present)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Spree
|
2
|
+
class Image < Asset
|
3
|
+
module Configuration
|
4
|
+
module Paperclip
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
validate :no_attachment_errors
|
9
|
+
|
10
|
+
def self.accepted_image_types
|
11
|
+
%w(image/jpeg image/jpg image/png image/gif)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.styles
|
15
|
+
attachment_definitions[:attachment][:styles]
|
16
|
+
end
|
17
|
+
|
18
|
+
has_attached_file :attachment,
|
19
|
+
styles: { mini: '48x48>', small: '100x100>', product: '240x240>', large: '600x600>' },
|
20
|
+
default_style: :product,
|
21
|
+
url: '/spree/products/:id/:style/:basename.:extension',
|
22
|
+
path: ':rails_root/public/spree/products/:id/:style/:basename.:extension',
|
23
|
+
convert_options: { all: '-strip -auto-orient -colorspace sRGB' }
|
24
|
+
|
25
|
+
validates_attachment :attachment,
|
26
|
+
presence: true,
|
27
|
+
content_type: { content_type: accepted_image_types }
|
28
|
+
|
29
|
+
# save the w,h of the original image (from which others can be calculated)
|
30
|
+
# we need to look at the write-queue for images which have not been saved yet
|
31
|
+
before_save :find_dimensions, if: :attachment_updated_at_changed?
|
32
|
+
|
33
|
+
delegate :url, to: :attachment
|
34
|
+
|
35
|
+
# used by admin products autocomplete
|
36
|
+
def mini_url
|
37
|
+
url(:mini, false)
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_dimensions
|
41
|
+
temporary = attachment.queued_for_write[:original]
|
42
|
+
filename = temporary.path unless temporary.nil?
|
43
|
+
filename = attachment.path if filename.blank?
|
44
|
+
geometry = ::Paperclip::Geometry.from_file(filename)
|
45
|
+
self.attachment_width = geometry.width
|
46
|
+
self.attachment_height = geometry.height
|
47
|
+
end
|
48
|
+
|
49
|
+
# if there are errors from the plugin, then add a more meaningful message
|
50
|
+
def no_attachment_errors
|
51
|
+
unless attachment.errors.empty?
|
52
|
+
# uncomment this to get rid of the less-than-useful interim messages
|
53
|
+
# errors.clear
|
54
|
+
errors.add :attachment,
|
55
|
+
"Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
|
56
|
+
|
57
|
+
false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -6,6 +6,14 @@
|
|
6
6
|
|
7
7
|
require 'singleton'
|
8
8
|
|
9
|
+
DB_EXCEPTIONS = if defined? PG
|
10
|
+
[PG::ConnectionBad, ActiveRecord::NoDatabaseError]
|
11
|
+
elsif defined? Mysql2
|
12
|
+
[Mysql2::Error::ConnectionError, ActiveRecord::NoDatabaseError]
|
13
|
+
else
|
14
|
+
[ActiveRecord::ConnectionNotEstablished, ActiveRecord::NoDatabaseError]
|
15
|
+
end
|
16
|
+
|
9
17
|
module Spree::Preferences
|
10
18
|
class StoreInstance
|
11
19
|
attr_accessor :persistence
|
@@ -86,7 +94,7 @@ module Spree::Preferences
|
|
86
94
|
|
87
95
|
def should_persist?
|
88
96
|
@persistence && Spree::Preference.table_exists?
|
89
|
-
rescue
|
97
|
+
rescue *DB_EXCEPTIONS # this is fix to make Deploy To Heroku button work
|
90
98
|
false
|
91
99
|
end
|
92
100
|
end
|
@@ -128,7 +128,6 @@ module Spree
|
|
128
128
|
def eligible_rules(promotable, options = {})
|
129
129
|
# Promotions without rules are eligible by default.
|
130
130
|
return [] if rules.none?
|
131
|
-
eligible = ->(r) { r.eligible?(promotable, options) }
|
132
131
|
specific_rules = rules.select { |rule| rule.applicable?(promotable) }
|
133
132
|
return [] if specific_rules.none?
|
134
133
|
|
@@ -21,6 +21,24 @@ module Spree
|
|
21
21
|
self
|
22
22
|
end
|
23
23
|
|
24
|
+
def remove(coupon_code)
|
25
|
+
promotion = order.promotions.with_coupon_code(coupon_code)
|
26
|
+
|
27
|
+
if promotion.present?
|
28
|
+
# Order promotion has to be destroyed before line item removing
|
29
|
+
order.order_promotions.find_by!(promotion_id: promotion.id).destroy
|
30
|
+
|
31
|
+
remove_promotion_adjustments(promotion)
|
32
|
+
remove_promotion_line_items(promotion)
|
33
|
+
order.update_with_updater!
|
34
|
+
|
35
|
+
set_success_code :adjustments_deleted
|
36
|
+
else
|
37
|
+
set_error_code :coupon_code_not_found
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
24
42
|
def set_success_code(c)
|
25
43
|
@status_code = c
|
26
44
|
@success = Spree.t(c)
|
@@ -43,6 +61,22 @@ module Spree
|
|
43
61
|
|
44
62
|
private
|
45
63
|
|
64
|
+
def remove_promotion_adjustments(promotion)
|
65
|
+
promotion_actions_ids = promotion.actions.pluck(:id)
|
66
|
+
order.all_adjustments.where(source_id: promotion_actions_ids,
|
67
|
+
source_type: 'Spree::PromotionAction').destroy_all
|
68
|
+
end
|
69
|
+
|
70
|
+
def remove_promotion_line_items(promotion)
|
71
|
+
create_line_item_actions_ids = promotion.actions.where(type: 'Spree::Promotion::Actions::CreateLineItems').pluck(:id)
|
72
|
+
|
73
|
+
Spree::PromotionActionLineItem.where(promotion_action: create_line_item_actions_ids).find_each do |item|
|
74
|
+
line_item = order.find_line_item_by_variant(item.variant)
|
75
|
+
next if line_item.blank?
|
76
|
+
order.contents.remove(item.variant, item.quantity)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
46
80
|
def handle_present_promotion
|
47
81
|
return promotion_usage_limit_exceeded if promotion.usage_limit_exceeded?(order)
|
48
82
|
return promotion_applied if promotion_exists_on_order?
|
@@ -6,7 +6,7 @@ module Spree
|
|
6
6
|
ReturnItem::EligibilityValidator::TimeSincePurchase,
|
7
7
|
ReturnItem::EligibilityValidator::RMARequired,
|
8
8
|
ReturnItem::EligibilityValidator::InventoryShipped,
|
9
|
-
ReturnItem::EligibilityValidator::NoReimbursements
|
9
|
+
ReturnItem::EligibilityValidator::NoReimbursements
|
10
10
|
]
|
11
11
|
|
12
12
|
def eligible_for_return?
|
@@ -1,13 +1,5 @@
|
|
1
1
|
module Spree
|
2
2
|
class TaxonIcon < Asset
|
3
|
-
|
4
|
-
styles: { mini: '32x32>', normal: '128x128>' },
|
5
|
-
default_style: :mini,
|
6
|
-
url: '/spree/taxons/:viewable_id/:style/:basename.:extension',
|
7
|
-
path: ':rails_root/public/spree/taxons/:viewable_id/:style/:basename.:extension',
|
8
|
-
default_url: '/assets/default_taxon.png'
|
9
|
-
|
10
|
-
validates_attachment :attachment,
|
11
|
-
content_type: { content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'] }
|
3
|
+
include Rails.application.config.use_paperclip ? Configuration::Paperclip : Configuration::ActiveStorage
|
12
4
|
end
|
13
5
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Spree
|
2
|
+
class TaxonIcon < Asset
|
3
|
+
module Configuration
|
4
|
+
module ActiveStorage
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
include Spree::AttachmentValidation
|
7
|
+
|
8
|
+
included do
|
9
|
+
validate :check_attachment_content_type
|
10
|
+
|
11
|
+
has_one_attached :attachment
|
12
|
+
|
13
|
+
def self.styles
|
14
|
+
@styles ||= {
|
15
|
+
mini: '32x32>',
|
16
|
+
normal: '128x128>'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def default_style
|
21
|
+
:mini
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Spree
|
2
|
+
class TaxonIcon < Asset
|
3
|
+
module Configuration
|
4
|
+
module Paperclip
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
def self.styles
|
9
|
+
attachment_definitions[:attachment][:styles]
|
10
|
+
end
|
11
|
+
|
12
|
+
has_attached_file :attachment,
|
13
|
+
styles: { mini: '32x32>', normal: '128x128>' },
|
14
|
+
default_style: :mini,
|
15
|
+
url: '/spree/taxons/:viewable_id/:style/:basename.:extension',
|
16
|
+
path: ':rails_root/public/spree/taxons/:viewable_id/:style/:basename.:extension',
|
17
|
+
default_url: '/assets/default_taxon.png'
|
18
|
+
|
19
|
+
validates_attachment :attachment,
|
20
|
+
content_type: { content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'] }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/config/locales/en.yml
CHANGED
@@ -361,7 +361,11 @@ en:
|
|
361
361
|
cannot_destroy_if_attached_to_line_items: Cannot delete variants once they are attached to line items.
|
362
362
|
no_master_variant_found_to_infer_price: No master variant found to infer price
|
363
363
|
must_supply_price_for_variant_or_master: Must supply price for variant or master price for product.
|
364
|
-
|
364
|
+
spree/image:
|
365
|
+
attributes:
|
366
|
+
attachment:
|
367
|
+
not_allowed_content_type: has not allowed content type
|
368
|
+
attachment_must_be_present: must be present
|
365
369
|
devise:
|
366
370
|
confirmations:
|
367
371
|
confirmed: Your account was successfully confirmed. You are now signed in.
|
@@ -502,6 +506,7 @@ en:
|
|
502
506
|
order_num: "Order #"
|
503
507
|
orders: Orders
|
504
508
|
user_information: User Information
|
509
|
+
stores: Stores
|
505
510
|
store_credits: Store Credits
|
506
511
|
no_store_credit: User has no Store Credit available.
|
507
512
|
available_store_credit: User has %{amount} in Store Credit available.
|
@@ -1363,6 +1368,8 @@ en:
|
|
1363
1368
|
stock_transfers: Stock Transfers
|
1364
1369
|
stop: Stop
|
1365
1370
|
store: Store
|
1371
|
+
stores: Stores
|
1372
|
+
add_store: New Store
|
1366
1373
|
store_credit_name: Store Credit
|
1367
1374
|
store_credit:
|
1368
1375
|
credit: "Credit"
|
@@ -1475,6 +1482,7 @@ en:
|
|
1475
1482
|
unshippable_items: Unshippable Items
|
1476
1483
|
update: Update
|
1477
1484
|
updating: Updating
|
1485
|
+
url: URL
|
1478
1486
|
usage_limit: Usage Limit
|
1479
1487
|
use_app_default: Use App Default
|
1480
1488
|
use_billing_address: Use Billing Address
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Spree::Sample.load_sample('option_values')
|
2
|
+
Spree::Sample.load_sample('products')
|
3
|
+
|
4
|
+
product = Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey')
|
5
|
+
size = Spree::OptionValue.find_by(name: 'Small')
|
6
|
+
color = Spree::OptionValue.find_by(name: 'Red')
|
7
|
+
eligible_values = "#{size.id},#{color.id}"
|
8
|
+
|
9
|
+
promotion = Spree::Promotion.where(
|
10
|
+
name: 'free shipping',
|
11
|
+
usage_limit: nil,
|
12
|
+
path: nil,
|
13
|
+
match_policy: 'any',
|
14
|
+
description: ''
|
15
|
+
).first_or_create
|
16
|
+
|
17
|
+
Spree::PromotionRule.where(
|
18
|
+
promotion_id: promotion.id,
|
19
|
+
type: 'Spree::Promotion::Rules::OptionValue',
|
20
|
+
preferences: { match_policy: 'any', eligible_values: { product.id.to_s => eligible_values } }
|
21
|
+
).first_or_create
|
22
|
+
|
23
|
+
Spree::Promotion::Actions::FreeShipping.where(promotion_id: promotion.id).first_or_create
|
@@ -86,6 +86,14 @@ module Spree
|
|
86
86
|
|
87
87
|
end
|
88
88
|
|
89
|
+
def inject_content_security_policy
|
90
|
+
inside dummy_path do
|
91
|
+
inject_into_file 'config/initializers/content_security_policy.rb', %Q[
|
92
|
+
p.script_src :self, :https, :unsafe_inline, :http, :unsafe_eval
|
93
|
+
], before: /^end/, verbose: true
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
89
97
|
attr :lib_name
|
90
98
|
attr :database
|
91
99
|
|
@@ -28,7 +28,8 @@ Dummy::Application.configure do
|
|
28
28
|
# ActionMailer::Base.deliveries array.
|
29
29
|
config.action_mailer.delivery_method = :test
|
30
30
|
ActionMailer::Base.default from: "spree@example.com"
|
31
|
-
|
31
|
+
# Store uploaded files on the local file system in a temporary directory
|
32
|
+
config.active_storage.service = :test
|
32
33
|
|
33
34
|
# Print deprecation notices to the stderr
|
34
35
|
config.active_support.deprecation = :stderr
|
data/lib/spree/core.rb
CHANGED
data/lib/spree/core/engine.rb
CHANGED
@@ -116,12 +116,12 @@ module Spree
|
|
116
116
|
end
|
117
117
|
|
118
118
|
config.to_prepare do
|
119
|
-
#
|
120
|
-
I18n.load_path
|
119
|
+
# Load spree locales before decorators
|
120
|
+
I18n.load_path += Dir.glob(
|
121
121
|
File.join(
|
122
122
|
File.dirname(__FILE__), '../../../config/locales', '*.{rb,yml}'
|
123
123
|
)
|
124
|
-
)
|
124
|
+
)
|
125
125
|
|
126
126
|
# Load application's model / class decorators
|
127
127
|
Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
|
data/lib/spree/core/version.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
module Spree
|
2
|
-
|
3
|
-
|
4
|
-
def cache_writes
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def assert_written_to_cache(key)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Cache writes:
|
13
|
-
#{@cache_write_events.join("\n")}
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def clear_cache_events
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
RSpec.configure do |config|
|
27
|
-
config.include Spree::TestingSupport::Caching, caching: true
|
28
|
-
|
29
|
-
config.before(:each, caching: true) do
|
30
|
-
ActionController::Base.perform_caching = true
|
31
|
-
|
32
|
-
ActiveSupport::Notifications.subscribe('read_fragment.action_controller') do |_event, _start_time, _finish_time, _, details|
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
ActiveSupport::Notifications.subscribe('write_fragment.action_controller') do |_event, _start_time, _finish_time, _, details|
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
config.after(:each, caching: true) do
|
44
|
-
ActionController::Base.perform_caching = false
|
45
|
-
Rails.cache.clear
|
46
|
-
end
|
47
|
-
end
|
1
|
+
# module Spree
|
2
|
+
# module TestingSupport
|
3
|
+
# module Caching
|
4
|
+
# def cache_writes
|
5
|
+
# @cache_write_events
|
6
|
+
# end
|
7
|
+
|
8
|
+
# def assert_written_to_cache(key)
|
9
|
+
# unless @cache_write_events.detect { |event| event[:key].starts_with?(key) }
|
10
|
+
# raise %Q{Expected to find #{key} in the cache, but didn't.
|
11
|
+
|
12
|
+
# Cache writes:
|
13
|
+
# #{@cache_write_events.join("\n")}
|
14
|
+
# }
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
|
18
|
+
# def clear_cache_events
|
19
|
+
# @cache_read_events = []
|
20
|
+
# @cache_write_events = []
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
# RSpec.configure do |config|
|
27
|
+
# config.include Spree::TestingSupport::Caching, caching: true
|
28
|
+
|
29
|
+
# config.before(:each, caching: true) do
|
30
|
+
# ActionController::Base.perform_caching = true
|
31
|
+
|
32
|
+
# ActiveSupport::Notifications.subscribe('read_fragment.action_controller') do |_event, _start_time, _finish_time, _, details|
|
33
|
+
# @cache_read_events ||= []
|
34
|
+
# @cache_read_events << details
|
35
|
+
# end
|
36
|
+
|
37
|
+
# ActiveSupport::Notifications.subscribe('write_fragment.action_controller') do |_event, _start_time, _finish_time, _, details|
|
38
|
+
# @cache_write_events ||= []
|
39
|
+
# @cache_write_events << details
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# config.after(:each, caching: true) do
|
44
|
+
# ActionController::Base.perform_caching = false
|
45
|
+
# Rails.cache.clear
|
46
|
+
# end
|
47
|
+
# end
|
@@ -0,0 +1 @@
|
|
1
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
data/spree_core.gemspec
CHANGED
@@ -31,17 +31,18 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_dependency 'highline', '~> 1.6.18' # Necessary for the install generator
|
32
32
|
s.add_dependency 'kaminari', '~> 1.0.1'
|
33
33
|
s.add_dependency 'monetize', '~> 1.1'
|
34
|
-
s.add_dependency 'paperclip', '~>
|
34
|
+
s.add_dependency 'paperclip', '~> 5.2.0'
|
35
35
|
s.add_dependency 'paranoia', '~> 2.4.1'
|
36
36
|
s.add_dependency 'premailer-rails'
|
37
37
|
s.add_dependency 'acts-as-taggable-on', '~> 5.0'
|
38
|
-
s.add_dependency 'rails', '~> 5.
|
38
|
+
s.add_dependency 'rails', '~> 5.2.0'
|
39
39
|
s.add_dependency 'ransack', '~> 1.8.0'
|
40
40
|
s.add_dependency 'responders'
|
41
41
|
s.add_dependency 'state_machines-activerecord', '~> 0.5'
|
42
42
|
s.add_dependency 'stringex'
|
43
43
|
s.add_dependency 'twitter_cldr', '~> 4.3'
|
44
44
|
s.add_dependency 'sprockets-rails'
|
45
|
+
s.add_dependency 'mini_magick', '~> 4.8.0'
|
45
46
|
|
46
47
|
s.add_development_dependency 'email_spec', '~> 1.6'
|
47
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 5.2.0
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 5.2.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: paranoia
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 5.
|
229
|
+
version: 5.2.0
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 5.
|
236
|
+
version: 5.2.0
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: ransack
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,6 +318,20 @@ dependencies:
|
|
318
318
|
- - ">="
|
319
319
|
- !ruby/object:Gem::Version
|
320
320
|
version: '0'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: mini_magick
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - "~>"
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: 4.8.0
|
328
|
+
type: :runtime
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - "~>"
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: 4.8.0
|
321
335
|
- !ruby/object:Gem::Dependency
|
322
336
|
name: email_spec
|
323
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,6 +371,7 @@ files:
|
|
357
371
|
- app/mailers/spree/test_mailer.rb
|
358
372
|
- app/models/concerns/spree/acts_as_taggable.rb
|
359
373
|
- app/models/concerns/spree/adjustment_source.rb
|
374
|
+
- app/models/concerns/spree/attachment_validation.rb
|
360
375
|
- app/models/concerns/spree/calculated_adjustments.rb
|
361
376
|
- app/models/concerns/spree/default_price.rb
|
362
377
|
- app/models/concerns/spree/display_money.rb
|
@@ -379,6 +394,7 @@ files:
|
|
379
394
|
- app/models/spree/adjustment.rb
|
380
395
|
- app/models/spree/app_configuration.rb
|
381
396
|
- app/models/spree/asset.rb
|
397
|
+
- app/models/spree/asset/support/active_storage.rb
|
382
398
|
- app/models/spree/base.rb
|
383
399
|
- app/models/spree/calculator.rb
|
384
400
|
- app/models/spree/calculator/default_tax.rb
|
@@ -404,6 +420,8 @@ files:
|
|
404
420
|
- app/models/spree/gateway/bogus.rb
|
405
421
|
- app/models/spree/gateway/bogus_simple.rb
|
406
422
|
- app/models/spree/image.rb
|
423
|
+
- app/models/spree/image/configuration/active_storage.rb
|
424
|
+
- app/models/spree/image/configuration/paperclip.rb
|
407
425
|
- app/models/spree/inventory_unit.rb
|
408
426
|
- app/models/spree/legacy_user.rb
|
409
427
|
- app/models/spree/line_item.rb
|
@@ -538,6 +556,8 @@ files:
|
|
538
556
|
- app/models/spree/tax_rate.rb
|
539
557
|
- app/models/spree/taxon.rb
|
540
558
|
- app/models/spree/taxon_icon.rb
|
559
|
+
- app/models/spree/taxon_icon/configuration/active_storage.rb
|
560
|
+
- app/models/spree/taxon_icon/configuration/paperclip.rb
|
541
561
|
- app/models/spree/taxonomy.rb
|
542
562
|
- app/models/spree/validations/db_maximum_length_validator.rb
|
543
563
|
- app/models/spree/variant.rb
|
@@ -565,15 +585,18 @@ files:
|
|
565
585
|
- app/views/spree/shipment_mailer/shipped_email.text.erb
|
566
586
|
- app/views/spree/test_mailer/test_email.html.erb
|
567
587
|
- app/views/spree/test_mailer/test_email.text.erb
|
588
|
+
- config/initializers/active_storage.rb
|
568
589
|
- config/initializers/acts_as_taggable_on.rb
|
569
590
|
- config/initializers/assets.rb
|
570
591
|
- config/initializers/friendly_id.rb
|
571
592
|
- config/initializers/premailer_assets.rb
|
572
593
|
- config/initializers/premailer_rails.rb
|
594
|
+
- config/initializers/use_paperclip.rb
|
573
595
|
- config/locales/en.yml
|
574
596
|
- config/routes.rb
|
575
597
|
- db/default/spree/countries.rb
|
576
598
|
- db/default/spree/default_reimbursement_type.rb
|
599
|
+
- db/default/spree/promotions.rb
|
577
600
|
- db/default/spree/roles.rb
|
578
601
|
- db/default/spree/states.rb
|
579
602
|
- db/default/spree/stores.rb
|
@@ -966,6 +989,7 @@ files:
|
|
966
989
|
- lib/tasks/email.rake
|
967
990
|
- lib/tasks/exchanges.rake
|
968
991
|
- script/rails
|
992
|
+
- spec/fixtures/text-file.txt
|
969
993
|
- spec/fixtures/thinking-cat.jpg
|
970
994
|
- spree_core.gemspec
|
971
995
|
- vendor/assets/javascripts/jquery.payment.js
|
@@ -990,7 +1014,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
990
1014
|
version: 1.8.23
|
991
1015
|
requirements: []
|
992
1016
|
rubyforge_project:
|
993
|
-
rubygems_version: 2.6
|
1017
|
+
rubygems_version: 2.7.6
|
994
1018
|
signing_key:
|
995
1019
|
specification_version: 4
|
996
1020
|
summary: The bare bones necessary for Spree.
|