alchemy_cms 5.0.9 → 5.0.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: af554839b7abeaeb5b0bc5a7d7bacc1aaa44973b0e1c44460f984d46447c6316
|
4
|
+
data.tar.gz: aae5090361517ba5b64436977841afcd9c7f111fc4c4be224a6c01e13e73cf8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0efe007dba193d3637552279f109ec785e038a557c3ec022415a9057ae0cc0723e054cdc82c12e0b352026442306974fe8fbcc36d3cf8fd0b0be5896b610016d
|
7
|
+
data.tar.gz: 38d0439955c53b1f5eddbf7230d8eb23d730e7a4fd2cd2645132e239ab284a5987633359d7b89060a8cf5d30577822421e682610e503641a5c10702df5780f77
|
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', '< 5.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
|
@@ -241,12 +241,12 @@ module Alchemy
|
|
241
241
|
# Use imagemagick to custom crop an image. Uses -thumbnail for better performance when resizing.
|
242
242
|
#
|
243
243
|
def xy_crop_resize(dimensions, top_left, crop_dimensions, upsample)
|
244
|
-
crop_argument =
|
244
|
+
crop_argument = dimensions_to_string(crop_dimensions)
|
245
245
|
crop_argument += "+#{top_left[:x]}+#{top_left[:y]}"
|
246
246
|
|
247
|
-
resize_argument =
|
247
|
+
resize_argument = dimensions_to_string(dimensions)
|
248
248
|
resize_argument += ">" unless upsample
|
249
|
-
image_file.
|
249
|
+
image_file.crop_resize(crop_argument, resize_argument)
|
250
250
|
end
|
251
251
|
|
252
252
|
# 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
@@ -43,5 +43,12 @@ module Alchemy
|
|
43
43
|
config.after_initialize do
|
44
44
|
require_relative "./userstamp"
|
45
45
|
end
|
46
|
+
|
47
|
+
initializer "alchemy.error_tracking" do
|
48
|
+
if defined?(Airbrake)
|
49
|
+
require_relative "error_tracking/airbrake_handler"
|
50
|
+
Alchemy::ErrorTracking.notification_handler = Alchemy::ErrorTracking::AirbrakeHandler
|
51
|
+
end
|
52
|
+
end
|
46
53
|
end
|
47
54
|
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
@@ -38,6 +38,7 @@ require_relative "alchemy/configuration_methods"
|
|
38
38
|
require_relative "alchemy/controller_actions"
|
39
39
|
require_relative "alchemy/deprecation"
|
40
40
|
require_relative "alchemy/elements_finder"
|
41
|
+
require_relative "alchemy/error_tracking"
|
41
42
|
require_relative "alchemy/errors"
|
42
43
|
require_relative "alchemy/essence"
|
43
44
|
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.0.
|
4
|
+
version: 5.0.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
|
@@ -1085,8 +1073,11 @@ files:
|
|
1085
1073
|
- lib/alchemy/configuration_methods.rb
|
1086
1074
|
- lib/alchemy/controller_actions.rb
|
1087
1075
|
- lib/alchemy/deprecation.rb
|
1076
|
+
- lib/alchemy/dragonfly/processors/crop_resize.rb
|
1088
1077
|
- lib/alchemy/elements_finder.rb
|
1089
1078
|
- lib/alchemy/engine.rb
|
1079
|
+
- lib/alchemy/error_tracking.rb
|
1080
|
+
- lib/alchemy/error_tracking/airbrake_handler.rb
|
1090
1081
|
- lib/alchemy/errors.rb
|
1091
1082
|
- lib/alchemy/essence.rb
|
1092
1083
|
- lib/alchemy/filetypes.rb
|