spree_core 3.4.0.rc1 → 3.4.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/spree/asset.rb +4 -0
- data/app/models/spree/base.rb +1 -1
- data/app/models/spree/order/checkout.rb +1 -1
- data/app/models/spree/shipment_handler.rb +1 -1
- data/app/models/spree/taxon.rb +1 -9
- data/app/models/spree/taxon_icon.rb +13 -0
- data/db/default/spree/countries.rb +9 -24
- data/lib/friendly_id/slug_rails5_patch.rb +11 -0
- data/lib/spree/core.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree_core.rb +1 -0
- data/lib/tasks/core.rake +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2197427b41a26e477f45fe4ca4440b71c7f51f31
|
4
|
+
data.tar.gz: 0cbbda0e9bd9e23d1150a903d678708fe7f8e74d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1164ec3d27a3b434187540f4105fdd7a2d924289f93433bdd4abe28c8bb6e387bc3110a4417e5422bb43343142f3ed2b4defad8b4adb36a21f52500fafa4cf8
|
7
|
+
data.tar.gz: 3fb8bd3dca97d2eb69b4d78814a1c0240314180261ec9f3f835b503ad7235438c7fd27322c01a158f8728a0e9504bc391aed4d3c45effc4158bfa224f58db0ed
|
data/app/models/spree/asset.rb
CHANGED
data/app/models/spree/base.rb
CHANGED
@@ -20,9 +20,9 @@ module Spree
|
|
20
20
|
def perform
|
21
21
|
@shipment.inventory_units.each &:ship!
|
22
22
|
@shipment.process_order_payments if Spree::Config[:auto_capture_on_dispatch]
|
23
|
-
send_shipped_email
|
24
23
|
@shipment.touch :shipped_at
|
25
24
|
update_order_shipment_state
|
25
|
+
send_shipped_email
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
data/app/models/spree/taxon.rb
CHANGED
@@ -30,15 +30,7 @@ module Spree
|
|
30
30
|
after_save :touch_ancestors_and_taxonomy
|
31
31
|
after_touch :touch_ancestors_and_taxonomy
|
32
32
|
|
33
|
-
|
34
|
-
styles: { mini: '32x32>', normal: '128x128>' },
|
35
|
-
default_style: :mini,
|
36
|
-
url: '/spree/taxons/:id/:style/:basename.:extension',
|
37
|
-
path: ':rails_root/public/spree/taxons/:id/:style/:basename.:extension',
|
38
|
-
default_url: '/assets/default_taxon.png'
|
39
|
-
|
40
|
-
validates_attachment :icon,
|
41
|
-
content_type: { content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'] }
|
33
|
+
has_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::TaxonIcon'
|
42
34
|
|
43
35
|
self.whitelisted_ransackable_associations = %w[taxonomy]
|
44
36
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Spree
|
2
|
+
class TaxonIcon < Asset
|
3
|
+
has_attached_file :attachment,
|
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'] }
|
12
|
+
end
|
13
|
+
end
|
@@ -1,31 +1,16 @@
|
|
1
1
|
require 'carmen'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
numcode = connection.quote country.numeric_code
|
13
|
-
states_required = connection.quote country.subregions?
|
14
|
-
|
15
|
-
country_inserts << [name, iso3, iso, iso_name, numcode, states_required].join(", ")
|
16
|
-
end
|
17
|
-
|
18
|
-
country_inserts.join("), (")
|
3
|
+
Carmen::Country.all.each do |country|
|
4
|
+
Spree::Country.where(
|
5
|
+
name: country.name,
|
6
|
+
iso3: country.alpha_3_code,
|
7
|
+
iso: country.alpha_2_code,
|
8
|
+
iso_name: country.name.upcase,
|
9
|
+
numcode: country.numeric_code,
|
10
|
+
states_required: country.subregions?
|
11
|
+
).first_or_create
|
19
12
|
end
|
20
13
|
|
21
|
-
columns = ["name", "iso3", "iso", "iso_name", "numcode", "states_required"]
|
22
|
-
columns = connection.adapter_name =~ /MySQL/i ? columns.join(", ") : "\"#{columns.join('", "')}\""
|
23
|
-
|
24
|
-
connection.execute <<-SQL
|
25
|
-
INSERT INTO spree_countries (#{columns})
|
26
|
-
VALUES (#{country_values.call});
|
27
|
-
SQL
|
28
|
-
|
29
14
|
Spree::Config[:default_country_id] = Spree::Country.find_by(iso: "US").id
|
30
15
|
|
31
16
|
# find countries that do not use postal codes (by iso) and set 'zipcode_required' to false for them.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Temporary fix to FriendlyId in Rails5, so that we don't
|
2
|
+
# encounter any validation errors when creating slugs via
|
3
|
+
# FriendlyId::History on a paranoid model.
|
4
|
+
# See: https://github.com/norman/friendly_id/issues/822
|
5
|
+
if Rails::VERSION::STRING >= '5.0'
|
6
|
+
module FriendlyId
|
7
|
+
class Slug < ActiveRecord::Base
|
8
|
+
belongs_to :sluggable, polymorphic: true, optional: true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/spree/core.rb
CHANGED
@@ -21,11 +21,11 @@ StateMachines::Machine.ignore_method_conflicts = true
|
|
21
21
|
module Spree
|
22
22
|
mattr_accessor :user_class
|
23
23
|
|
24
|
-
def self.user_class
|
24
|
+
def self.user_class(constantize: true)
|
25
25
|
if @@user_class.is_a?(Class)
|
26
26
|
raise 'Spree.user_class MUST be a String or Symbol object, not a Class object.'
|
27
27
|
elsif @@user_class.is_a?(String) || @@user_class.is_a?(Symbol)
|
28
|
-
@@user_class.to_s.constantize
|
28
|
+
constantize ? @@user_class.to_s.constantize : @@user_class.to_s
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree_core.rb
CHANGED
data/lib/tasks/core.rake
CHANGED
@@ -157,4 +157,14 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
157
157
|
puts 'DONE ! Your database should no longer have line items that are associated with deleted variants.'
|
158
158
|
end
|
159
159
|
end
|
160
|
+
|
161
|
+
desc 'Migrates taxon icons to spree assets after upgrading to Spree 3.4: only needed if you used taxons icons.'
|
162
|
+
task migrate_taxon_icons: :environment do |_t, _args|
|
163
|
+
Spree::Taxon.where.not(icon_file_name: nil).find_each do |taxon|
|
164
|
+
taxon.create_icon(attachment_file_name: taxon.icon_file_name,
|
165
|
+
attachment_content_type: taxon.icon_content_type,
|
166
|
+
attachment_file_size: taxon.icon_file_size,
|
167
|
+
attachment_updated_at: taxon.icon_updated_at)
|
168
|
+
end
|
169
|
+
end
|
160
170
|
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.0.
|
4
|
+
version: 3.4.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -536,6 +536,7 @@ files:
|
|
536
536
|
- app/models/spree/tax_category.rb
|
537
537
|
- app/models/spree/tax_rate.rb
|
538
538
|
- app/models/spree/taxon.rb
|
539
|
+
- app/models/spree/taxon_icon.rb
|
539
540
|
- app/models/spree/taxonomy.rb
|
540
541
|
- app/models/spree/tracker.rb
|
541
542
|
- app/models/spree/validations/db_maximum_length_validator.rb
|
@@ -835,6 +836,7 @@ files:
|
|
835
836
|
- db/migrate/20170722102643_add_analytics_kind_to_spree_trackers.rb
|
836
837
|
- db/migrate/20170727103056_rename_tracker_kind_field.rb
|
837
838
|
- db/seeds.rb
|
839
|
+
- lib/friendly_id/slug_rails5_patch.rb
|
838
840
|
- lib/generators/spree/custom_user/custom_user_generator.rb
|
839
841
|
- lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
|
840
842
|
- lib/generators/spree/custom_user/templates/initializer.rb.tt
|