bridgetown-cloudinary 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '094d6f9ea2137031f59a039a70c6225447a27c2149dd3f4aaf40c1a010ecce37'
4
- data.tar.gz: a8f336a1dee7036d4db63852cd24b42aa9c6fadfe945c7f971f48b79a55c496e
3
+ metadata.gz: 42cfebd13b5873c08022a83f4d44f0bc0623583dbb7b67dd6f6fd11d8f5f84d0
4
+ data.tar.gz: f880397f2c76021e165f53ae95911cf3f7af0bd332f83910a5721e600b46a666
5
5
  SHA512:
6
- metadata.gz: 94401e8f4c81dfe33194dbff7335981c61503150b02e299e1663a90ff97877ebde9fb629d22c429a3fca43e9b7e9b216d1f6871fee217937d15ad8fccd6a3041
7
- data.tar.gz: 7fd2188450afdefb79c57a910ed114f1e3b031ce984c9de79b79c180ff4889bcccec8c4f2ea8dd3a5ac9ae9d840563f0ff73b9b0612174dc42d30f1694e5fd9d
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
 
@@ -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
- append_to_file "bridgetown.config.yml" do
10
- <<~YAML
11
-
12
- cloudinary:
13
- cloud_name: #{cloud_name}
14
- YAML
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?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bridgetown
4
4
  module Cloudinary
5
- VERSION = "2.0.0"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
@@ -5,6 +5,35 @@ require "cloudinary"
5
5
  require "bridgetown-cloudinary/utils"
6
6
  require "bridgetown-cloudinary/builder"
7
7
 
8
- Bridgetown.initializer :"bridgetown-cloudinary" do |config|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team