bridgetown-cloudinary 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -3
- data/CHANGELOG.md +4 -0
- data/bridgetown.automation.rb +7 -7
- data/lib/bridgetown-cloudinary/builder.rb +0 -17
- data/lib/bridgetown-cloudinary/utils.rb +1 -1
- data/lib/bridgetown-cloudinary/version.rb +1 -1
- data/lib/bridgetown-cloudinary.rb +30 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42cfebd13b5873c08022a83f4d44f0bc0623583dbb7b67dd6f6fd11d8f5f84d0
|
4
|
+
data.tar.gz: f880397f2c76021e165f53ae95911cf3f7af0bd332f83910a5721e600b46a666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a29ae57fc94caed150a151325d6a84a40143f182d9eaf976148bc271a370c0d8f2f7051ae2837bd94ae79e8cf3bf7e20988d3343ea49900cbe6222b385f020
|
7
|
+
data.tar.gz: acb7aa35e195caf534287040d1d8aab172167c74f780f6ebad28fd0e7c79bbdb3792ddc18c86bcfc84b3bac66a5924327858f2cbbd69d5070996d9162b82d29d
|
data/.rubocop.yml
CHANGED
@@ -5,21 +5,22 @@ inherit_gem:
|
|
5
5
|
|
6
6
|
AllCops:
|
7
7
|
TargetRubyVersion: 2.5
|
8
|
-
Include:
|
9
|
-
- lib/**/*.rb
|
10
|
-
|
11
8
|
Exclude:
|
12
9
|
- .gitignore
|
13
10
|
- .rspec
|
14
11
|
- .rubocop.yml
|
15
12
|
|
13
|
+
- Rakefile
|
14
|
+
- bridgetown.automation.rb
|
16
15
|
- Gemfile.lock
|
16
|
+
- "*.gemspec"
|
17
17
|
- CHANGELOG.md
|
18
18
|
- LICENSE.txt
|
19
19
|
- README.md
|
20
20
|
|
21
21
|
- script/**/*
|
22
22
|
- vendor/**/*
|
23
|
+
- spec/**/*
|
23
24
|
|
24
25
|
Metrics/AbcSize:
|
25
26
|
Exclude:
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [2.1.0] - 2022-10-09
|
9
|
+
|
10
|
+
- Provide configuration features through either initializer or YAML
|
11
|
+
- Update the automation script
|
8
12
|
|
9
13
|
## [2.0.0] - 2022-10-08
|
10
14
|
|
data/bridgetown.automation.rb
CHANGED
@@ -6,13 +6,13 @@ cloud_name = ask("What's your Cloudinary cloud name?")
|
|
6
6
|
|
7
7
|
add_bridgetown_plugin "bridgetown-cloudinary"
|
8
8
|
|
9
|
-
|
10
|
-
<<~
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
add_initializer :"bridgetown-cloudinary" do
|
10
|
+
<<~RUBY
|
11
|
+
do
|
12
|
+
cloud_name "#{cloud_name}"
|
13
|
+
end
|
14
|
+
end
|
15
15
|
end
|
16
16
|
|
17
|
-
say_status :cloudinary, "All set! Double-check the cloudinary block in your config file and review docs at"
|
17
|
+
say_status :cloudinary, "All set! Double-check the cloudinary block in your config/initializers.rb file and review docs at"
|
18
18
|
say_status :cloudinary, "https://github.com/bridgetownrb/bridgetown-cloudinary"
|
@@ -5,23 +5,6 @@ module Bridgetown
|
|
5
5
|
class Builder < Bridgetown::Builder
|
6
6
|
include Bridgetown::Filters
|
7
7
|
|
8
|
-
CONFIG_DEFAULTS = {
|
9
|
-
cloudinary: {
|
10
|
-
cloud_name: nil,
|
11
|
-
default_transformation: "open_graph",
|
12
|
-
default_image_format: "jpg",
|
13
|
-
transformations: {
|
14
|
-
open_graph: "c_fill,g_face:center,w_1600,h_900,q_50",
|
15
|
-
tiny: "w_300,c_limit,q_90",
|
16
|
-
small: "w_600,c_limit,q_85",
|
17
|
-
medium: "w_1200,c_limit,q_80",
|
18
|
-
large: "w_1800,c_limit,q_80",
|
19
|
-
xlarge: "w_2048,c_limit,q_75",
|
20
|
-
},
|
21
|
-
add_transformed_urls_to_image_front_matter: false,
|
22
|
-
},
|
23
|
-
}.freeze
|
24
|
-
|
25
8
|
# Set up the Cloudinary configuration
|
26
9
|
def build
|
27
10
|
::Cloudinary.config({
|
@@ -18,7 +18,7 @@ module Bridgetown
|
|
18
18
|
cloudinary_url&.sub("/image/upload", "/image/upload#{transformation}")
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.add_image_urls_to_resources(site, config)
|
21
|
+
def self.add_image_urls_to_resources(site, config) # rubocop:todo Metrics/CyclomaticComplexity
|
22
22
|
site.contents.each do |resource|
|
23
23
|
next unless resource.data[:cloudinary_id] && !resource.data[:image]
|
24
24
|
next if resource.respond_to?(:collection) && resource.collection.data?
|
@@ -5,6 +5,35 @@ require "cloudinary"
|
|
5
5
|
require "bridgetown-cloudinary/utils"
|
6
6
|
require "bridgetown-cloudinary/builder"
|
7
7
|
|
8
|
-
|
8
|
+
# rubocop:disable Metrics/ParameterLists
|
9
|
+
Bridgetown.initializer :"bridgetown-cloudinary" do |config,
|
10
|
+
cloud_name: nil,
|
11
|
+
default_transformation: "open_graph",
|
12
|
+
default_image_format: "jpg",
|
13
|
+
transformations: {},
|
14
|
+
add_transformed_urls_to_image_front_matter: false|
|
15
|
+
|
16
|
+
options = {
|
17
|
+
default_transformation: default_transformation,
|
18
|
+
default_image_format: default_image_format,
|
19
|
+
transformations: {
|
20
|
+
open_graph: "c_fill,g_face:center,w_1600,h_900,q_50",
|
21
|
+
tiny: "w_300,c_limit,q_90",
|
22
|
+
small: "w_600,c_limit,q_85",
|
23
|
+
medium: "w_1200,c_limit,q_80",
|
24
|
+
large: "w_1800,c_limit,q_80",
|
25
|
+
xlarge: "w_2048,c_limit,q_75",
|
26
|
+
}.merge(transformations),
|
27
|
+
add_transformed_urls_to_image_front_matter: add_transformed_urls_to_image_front_matter,
|
28
|
+
}
|
29
|
+
|
30
|
+
if config.cloudinary
|
31
|
+
config.cloudinary Bridgetown::Utils.deep_merge_hashes(options, config.cloudinary)
|
32
|
+
else
|
33
|
+
config.cloudinary(options)
|
34
|
+
end
|
35
|
+
config.cloudinary.cloud_name = cloud_name if cloud_name
|
36
|
+
|
9
37
|
config.builder Bridgetown::Cloudinary::Builder
|
10
38
|
end
|
39
|
+
# rubocop:enable Metrics/ParameterLists
|