alchemy_cms 5.1.9 → 5.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/alchemy_cms.gemspec +1 -1
- data/app/controllers/alchemy/admin/base_controller.rb +9 -3
- data/app/models/alchemy/picture/transformations.rb +3 -3
- data/config/initializers/dragonfly.rb +8 -0
- data/lib/alchemy/dragonfly/processors/crop_resize.rb +35 -0
- data/lib/alchemy/engine.rb +7 -0
- data/lib/alchemy/error_tracking/airbrake_handler.rb +13 -0
- data/lib/alchemy/error_tracking.rb +14 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -0
- data/package.json +1 -1
- metadata +7 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22e0baf2c4ddddb60434bca77764c2d8b7a885cf164a17e5c1ef67f6e0f4a4ba
|
4
|
+
data.tar.gz: e74e655f91a8966bfe636504976c06df51675c24343b3fa606c37ae3f7019741
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60e262f8c6f3683ba502ffb9cf07031216021d04c5db3c8743748dea49a499e310f0ee0d98a2bb5c06896510fe7c913a526e791ee82637def10012611706aad3
|
7
|
+
data.tar.gz: 05515f3c002cbaa8a797e156d3e83d296e3fff58e4a01d1c47bd7c61ca9487b34f12c29149e9616c33ef5200e1b491e15bafb101477b361457c6e93603969046
|
data/CHANGELOG.md
CHANGED
data/alchemy_cms.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.1']
|
24
24
|
gem.add_runtime_dependency 'cancancan', ['>= 2.1', '< 4.0']
|
25
25
|
gem.add_runtime_dependency 'coffee-rails', ['>= 4.0', '< 6.0']
|
26
|
-
gem.add_runtime_dependency 'dragonfly', ['~> 1.
|
26
|
+
gem.add_runtime_dependency 'dragonfly', ['~> 1.4']
|
27
27
|
gem.add_runtime_dependency 'dragonfly_svg', ['~> 0.0.4']
|
28
28
|
gem.add_runtime_dependency 'gutentag', ['~> 2.2', '>= 2.2.1']
|
29
29
|
gem.add_runtime_dependency 'handlebars_assets', ['~> 0.23']
|
@@ -40,9 +40,7 @@ module Alchemy
|
|
40
40
|
def exception_handler(error)
|
41
41
|
exception_logger(error)
|
42
42
|
show_error_notice(error)
|
43
|
-
|
44
|
-
notify_airbrake(error) unless Rails.env.development? || Rails.env.test?
|
45
|
-
end
|
43
|
+
notify_error_tracker(error)
|
46
44
|
end
|
47
45
|
|
48
46
|
# Displays an error notice in the Alchemy backend.
|
@@ -147,6 +145,14 @@ module Alchemy
|
|
147
145
|
site
|
148
146
|
end
|
149
147
|
end
|
148
|
+
|
149
|
+
def notify_error_tracker(exception)
|
150
|
+
if ::Alchemy::ErrorTracking.notification_handler.respond_to?(:call)
|
151
|
+
::Alchemy::ErrorTracking.notification_handler.call(exception)
|
152
|
+
else
|
153
|
+
Rails.logger.warn("To use the Alchemy::ErrorTracking.notification_handler, it must respond to #call.")
|
154
|
+
end
|
155
|
+
end
|
150
156
|
end
|
151
157
|
end
|
152
158
|
end
|
@@ -197,12 +197,12 @@ module Alchemy
|
|
197
197
|
# Use imagemagick to custom crop an image. Uses -thumbnail for better performance when resizing.
|
198
198
|
#
|
199
199
|
def xy_crop_resize(dimensions, top_left, crop_dimensions, upsample)
|
200
|
-
crop_argument =
|
200
|
+
crop_argument = dimensions_to_string(crop_dimensions)
|
201
201
|
crop_argument += "+#{top_left[:x]}+#{top_left[:y]}"
|
202
202
|
|
203
|
-
resize_argument =
|
203
|
+
resize_argument = dimensions_to_string(dimensions)
|
204
204
|
resize_argument += ">" unless upsample
|
205
|
-
image_file.
|
205
|
+
image_file.crop_resize(crop_argument, resize_argument)
|
206
206
|
end
|
207
207
|
|
208
208
|
# Used when centercropping.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "dragonfly_svg"
|
3
|
+
require "alchemy/dragonfly/processors/crop_resize"
|
3
4
|
|
4
5
|
# Logger
|
5
6
|
Dragonfly.logger = Rails.logger
|
@@ -9,3 +10,10 @@ if defined?(ActiveRecord::Base)
|
|
9
10
|
ActiveRecord::Base.extend Dragonfly::Model
|
10
11
|
ActiveRecord::Base.extend Dragonfly::Model::Validations
|
11
12
|
end
|
13
|
+
|
14
|
+
# Dragonfly 1.4.0 only allows `quality` as argument to `encode`
|
15
|
+
Dragonfly::ImageMagick::Processors::Encode::WHITELISTED_ARGS << "flatten"
|
16
|
+
|
17
|
+
Rails.application.config.after_initialize do
|
18
|
+
Dragonfly.app(:alchemy_pictures).add_processor(:crop_resize, Alchemy::Dragonfly::Processors::CropResize.new)
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dragonfly/image_magick/commands"
|
4
|
+
|
5
|
+
module Alchemy
|
6
|
+
module Dragonfly
|
7
|
+
module Processors
|
8
|
+
class CropResize
|
9
|
+
include ::Dragonfly::ParamValidators
|
10
|
+
|
11
|
+
IS_CROP_ARGUMENT = ->(args_string) {
|
12
|
+
args_string.match?(::Dragonfly::ImageMagick::Processors::Thumb::CROP_GEOMETRY)
|
13
|
+
}
|
14
|
+
|
15
|
+
IS_RESIZE_ARGUMENT = ->(args_string) {
|
16
|
+
args_string.match?(::Dragonfly::ImageMagick::Processors::Thumb::RESIZE_GEOMETRY)
|
17
|
+
}
|
18
|
+
|
19
|
+
def call(content, crop_argument, resize_argument)
|
20
|
+
validate!(crop_argument, &IS_CROP_ARGUMENT)
|
21
|
+
validate!(resize_argument, &IS_RESIZE_ARGUMENT)
|
22
|
+
::Dragonfly::ImageMagick::Commands.convert(
|
23
|
+
content,
|
24
|
+
"-crop #{crop_argument} -resize #{resize_argument}"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update_url(attrs, _args = "", opts = {})
|
29
|
+
format = opts["format"]
|
30
|
+
attrs.ext = format if format
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/alchemy/engine.rb
CHANGED
@@ -44,5 +44,12 @@ module Alchemy
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
initializer "alchemy.error_tracking" do
|
49
|
+
if defined?(Airbrake)
|
50
|
+
require_relative "error_tracking/airbrake_handler"
|
51
|
+
Alchemy::ErrorTracking.notification_handler = Alchemy::ErrorTracking::AirbrakeHandler
|
52
|
+
end
|
53
|
+
end
|
47
54
|
end
|
48
55
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
module ErrorTracking
|
5
|
+
class BaseHandler
|
6
|
+
def self.call(exception)
|
7
|
+
# implement your own notification method
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
mattr_accessor :notification_handler
|
12
|
+
@@notification_handler = BaseHandler
|
13
|
+
end
|
14
|
+
end
|
data/lib/alchemy/version.rb
CHANGED
data/lib/alchemy_cms.rb
CHANGED
@@ -36,6 +36,7 @@ require_relative "alchemy/configuration_methods"
|
|
36
36
|
require_relative "alchemy/controller_actions"
|
37
37
|
require_relative "alchemy/deprecation"
|
38
38
|
require_relative "alchemy/elements_finder"
|
39
|
+
require_relative "alchemy/error_tracking"
|
39
40
|
require_relative "alchemy/errors"
|
40
41
|
require_relative "alchemy/essence"
|
41
42
|
require_relative "alchemy/filetypes"
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active_model_serializers
|
@@ -109,26 +109,14 @@ dependencies:
|
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '1.
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: 1.0.7
|
116
|
-
- - "<"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 1.4.0
|
112
|
+
version: '1.4'
|
119
113
|
type: :runtime
|
120
114
|
prerelease: false
|
121
115
|
version_requirements: !ruby/object:Gem::Requirement
|
122
116
|
requirements:
|
123
117
|
- - "~>"
|
124
118
|
- !ruby/object:Gem::Version
|
125
|
-
version: '1.
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: 1.0.7
|
129
|
-
- - "<"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 1.4.0
|
119
|
+
version: '1.4'
|
132
120
|
- !ruby/object:Gem::Dependency
|
133
121
|
name: dragonfly_svg
|
134
122
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1092,8 +1080,11 @@ files:
|
|
1092
1080
|
- lib/alchemy/configuration_methods.rb
|
1093
1081
|
- lib/alchemy/controller_actions.rb
|
1094
1082
|
- lib/alchemy/deprecation.rb
|
1083
|
+
- lib/alchemy/dragonfly/processors/crop_resize.rb
|
1095
1084
|
- lib/alchemy/elements_finder.rb
|
1096
1085
|
- lib/alchemy/engine.rb
|
1086
|
+
- lib/alchemy/error_tracking.rb
|
1087
|
+
- lib/alchemy/error_tracking/airbrake_handler.rb
|
1097
1088
|
- lib/alchemy/errors.rb
|
1098
1089
|
- lib/alchemy/essence.rb
|
1099
1090
|
- lib/alchemy/filetypes.rb
|