jekyll-imgproxy-tag 0.1.0 → 0.4.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: 4986a8d138622cab25b06efb7716d58786a2dd34e646f6ed2c34c94d79d4eda5
4
- data.tar.gz: 9d4fd300c70729f06a9df38ea742bba7ea7f0428664fb542a1d1025063e2c6be
3
+ metadata.gz: acbe39a4ae228887043a40c257606c034bd8a90a9d0c33c2c4db48262dfd8806
4
+ data.tar.gz: f7f38a3f4380808ed81c2e7799271b0913cd1e0254e374ff96dec3164e9a9838
5
5
  SHA512:
6
- metadata.gz: 34d27de575af077407197a0e3c9f1e518d5c6b3a8f006d9feaa84ec1932ff2c4243571dd2da87477e81290e4d2ee4214bcf04363f0424bf5975402d87af7e42a
7
- data.tar.gz: 28c1efba10ef21ff65f7941606633868b87e4a30cc0ec58dffa79ffa1cb918ffea7d7b54cf1ab238090b5739e924ad850f2fc9610e658d44205036254a8360cf
6
+ metadata.gz: 24f9d88c21c0b98cbd95cea884b7102cbb545a95f0feb5aa9b82d4279a6692497a1d65e1c56d0ce1c84d84d56689db9ee3ffe9582c4cec7db1779f2ac7884144
7
+ data.tar.gz: 6b138902223e9a28c909eb5c62a1f42e37f955d1192360ca361f039e2c3226b59cdf36fe4dcf6a0211793e60cde3f771461e22f68c1347f171e571503634f91a
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/CHANGELOG ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.4.0] - 2022-06-27
11
+
12
+ - Use passed in page context to access Jekyll's config instead of accessing
13
+ `Jekyll.configuration`.
14
+
15
+ ## [0.3.0] - 2022-06-18
16
+
17
+ - Refactored the config class to access the Jekyll configuration object only
18
+ once so that we're not repeatedly logging to STDOUT about its being accessed.
19
+
20
+ ## [0.2.0] - 2022-06-12
21
+
22
+ ### Changed
23
+
24
+ - Refactored the `PathBuilder` to check that there's a path to an image passed
25
+ to it, otherwise, raise an error. Without a image path, this would be useless.
26
+
27
+ ## [0.1.0] - 2022-06-07
28
+
29
+ ### Added
30
+
31
+ - Everything
32
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-imgproxy-tag (0.1.0)
4
+ jekyll-imgproxy-tag (0.4.0)
5
5
  jekyll
6
6
 
7
7
  GEM
@@ -24,6 +24,10 @@ module Jekyll
24
24
  class BaseUrlNotSet < Error
25
25
  '"base_url" not set in Jekyll Imgproxy config'
26
26
  end
27
+
28
+ class PathNotSet < Error
29
+ '"path" to image is not provided'
30
+ end
27
31
  end
28
32
  end
29
33
  end
@@ -4,13 +4,17 @@ module Jekyll
4
4
  module Imgproxy
5
5
  class Tag
6
6
  class ImgproxyConfig
7
+ extend Forwardable
8
+
7
9
  attr_reader \
10
+ :context,
8
11
  :base_url,
9
12
  :key,
10
13
  :salt,
11
14
  :aws_bucket
12
15
 
13
- def initialize
16
+ def initialize(context)
17
+ @context = context
14
18
  @base_url = fetch_config(:base_url)
15
19
  @key = fetch_config(:key)
16
20
  @salt = fetch_config(:salt)
@@ -36,7 +40,7 @@ module Jekyll
36
40
  end
37
41
 
38
42
  def imgproxy_config
39
- Jekyll.configuration['imgproxy']
43
+ context['site']['imgproxy']
40
44
  end
41
45
  end
42
46
  end
@@ -9,7 +9,6 @@ module Jekyll
9
9
  def initialize(config, options)
10
10
  @config = config
11
11
  @options = options
12
- @path = @options.delete('path')
13
12
 
14
13
  @resizing_type = 'rs:fit'
15
14
  @width = ':'
@@ -20,15 +19,18 @@ module Jekyll
20
19
  def build
21
20
  options.each { |key, value| send("#{key}=".to_sym, value) }
22
21
 
22
+ raise Jekyll::Imgproxy::Tag::Errors::PathNotSet unless path
23
+
23
24
  "/#{resizing_type}#{width}#{height}#{gravity}#{quality}#{max_bytes}#{cache_buster}/#{encoded_url}#{format}"
24
25
  end
25
26
 
26
27
  protected
27
28
 
29
+ attr_accessor :path
30
+
28
31
  attr_reader \
29
32
  :config,
30
33
  :options,
31
- :path,
32
34
  :resizing_type,
33
35
  :width,
34
36
  :height,
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  module Imgproxy
5
5
  class Tag < ::Liquid::Tag
6
- VERSION = '0.1.0'
6
+ VERSION = '0.4.0'
7
7
 
8
8
  def initialize(tag_name, raw_options, tokens)
9
9
  super
@@ -15,8 +15,8 @@ module Jekyll
15
15
  end
16
16
  end
17
17
 
18
- def render(_context)
19
- imgproxy_config = ImgproxyConfig.new
18
+ def render(context)
19
+ imgproxy_config = ImgproxyConfig.new(context)
20
20
  UrlGenerator.new(imgproxy_config, options).url
21
21
  end
22
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-imgproxy-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2022-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -101,7 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".gitignore"
104
105
  - ".rspec"
106
+ - CHANGELOG
105
107
  - Gemfile
106
108
  - Gemfile.lock
107
109
  - LICENSE.md