middleman-simple-thumbnailer 1.3.1 → 1.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 +5 -5
- data/.devcontainer/Dockerfile +20 -0
- data/.devcontainer/devcontainer.json +35 -0
- data/.github/workflows/ci.yml +22 -0
- data/.gitignore +4 -1
- data/README.md +6 -3
- data/config/cucumber.yml +1 -0
- data/features/caching_thumbnails_in_development.feature +28 -0
- data/features/generate_image_thumbnails.feature +15 -1
- data/features/generate_image_thumbnails_image_path.feature +10 -0
- data/features/generate_image_thumbnails_relative_assets.feature +12 -1
- data/features/support/image_thumbnails_steps.rb +33 -12
- data/fixtures/basic-app-image-path-use-cache/config.rb +1 -0
- data/fixtures/{cached-thumbnails-image-path → basic-app-image-path-use-cache}/source/images/original.jpg +0 -0
- data/fixtures/basic-app-image-path-use-cache/source/page-with-images-to-resize.html.erb +16 -0
- data/fixtures/basic-app-image-path-use-cache/source/page-with-untouched-image.html.erb +12 -0
- data/fixtures/basic-app-image-path/source/page-with-images-to-resize.html.erb +2 -2
- data/fixtures/basic-app-image-path/source/page-with-untouched-image.html.erb +1 -1
- data/fixtures/basic-app-no-resize/config.rb +1 -0
- data/fixtures/basic-app-no-resize/source/images/original.jpg +0 -0
- data/fixtures/basic-app-no-resize/source/page-with-untouched-image.html.erb +9 -0
- data/fixtures/basic-app-relative-assets-use-cache/config.rb +2 -0
- data/fixtures/basic-app-relative-assets-use-cache/source/images/original.jpg +0 -0
- data/fixtures/{cached-thumbnails-image-path → basic-app-relative-assets-use-cache}/source/page-with-images-to-resize.html.erb +3 -3
- data/fixtures/basic-app-relative-assets-use-cache/source/page-with-untouched-image.html.erb +9 -0
- data/fixtures/basic-app-relative-assets/source/page-with-images-to-resize.html.erb +2 -2
- data/fixtures/basic-app-relative-assets/source/page-with-untouched-image.html.erb +1 -1
- data/fixtures/basic-app-use-cache/config.rb +1 -0
- data/fixtures/basic-app-use-cache/source/images/original.jpg +0 -0
- data/fixtures/basic-app-use-cache/source/page-with-images-to-resize.html.erb +10 -0
- data/fixtures/basic-app-use-cache/source/page-with-untouched-image.html.erb +9 -0
- data/fixtures/basic-app/source/page-with-images-to-resize.html.erb +2 -2
- data/fixtures/basic-app/source/page-with-untouched-image.html.erb +1 -1
- data/fixtures/cached-thumbnails-use-cache/config.rb +1 -0
- data/fixtures/cached-thumbnails-use-cache/source/images/original.jpg +0 -0
- data/fixtures/cached-thumbnails-use-cache/source/page-with-images-to-resize.html.erb +10 -0
- data/fixtures/custom-cache-dir-use-cache/config.rb +3 -0
- data/fixtures/custom-cache-dir-use-cache/source/images/original.jpg +0 -0
- data/fixtures/custom-cache-dir-use-cache/source/page-with-images-to-resize.html.erb +10 -0
- data/lib/middleman-simple-thumbnailer.rb +1 -0
- data/lib/middleman-simple-thumbnailer/extension.rb +24 -15
- data/lib/middleman-simple-thumbnailer/image.rb +10 -9
- data/lib/middleman-simple-thumbnailer/image_store.rb +2 -1
- data/lib/middleman-simple-thumbnailer/rack.rb +42 -0
- data/lib/middleman-simple-thumbnailer/version.rb +1 -1
- data/middleman-simple-thumbnailer.gemspec +5 -5
- metadata +40 -68
- data/.travis.yml +0 -16
- data/fixtures/cached-thumbnails-image-path/config.rb +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7d26882da6c2c6bc7b27f6b2ea10a6d87190f2eb36d2f1365294860fd747966c
|
|
4
|
+
data.tar.gz: b1b99d9f8dd8955a040475de9554b2e610f91d6867969d1fb3ab00c3b95a3f28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78184f4ad682582dec4b790c08829527013f5cc451ec5cc41de0644341c07da1a609f2ffd20c5dc54bc85945bdc44abe30b7167c9764ecbc1ce7c31d5a445d74
|
|
7
|
+
data.tar.gz: cf26509202cff72228f4c4babd5f48f67c5c40f93c17f8608e7f91af7ff970affc04b86019c7a5d8093cf31e182e0390bc7acde77f9b7f76270e813c809bf49e
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/ruby/.devcontainer/base.Dockerfile
|
|
2
|
+
|
|
3
|
+
# [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6, 2.5
|
|
4
|
+
ARG VARIANT="3"
|
|
5
|
+
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
|
|
6
|
+
|
|
7
|
+
# [Option] Install Node.js
|
|
8
|
+
ARG INSTALL_NODE="true"
|
|
9
|
+
ARG NODE_VERSION="lts/*"
|
|
10
|
+
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
|
11
|
+
|
|
12
|
+
# [Optional] Uncomment this section to install additional OS packages.
|
|
13
|
+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
14
|
+
&& apt-get -y install --no-install-recommends imagemagick
|
|
15
|
+
|
|
16
|
+
# [Optional] Uncomment this line to install additional gems.
|
|
17
|
+
# RUN gem install <your-gem-names-here>
|
|
18
|
+
|
|
19
|
+
# [Optional] Uncomment this line to install global node packages.
|
|
20
|
+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
|
2
|
+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/ruby
|
|
3
|
+
{
|
|
4
|
+
"name": "Ruby",
|
|
5
|
+
"build": {
|
|
6
|
+
"dockerfile": "Dockerfile",
|
|
7
|
+
"args": {
|
|
8
|
+
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6, 2.5
|
|
9
|
+
"VARIANT": "2.7",
|
|
10
|
+
// Options
|
|
11
|
+
"INSTALL_NODE": "false",
|
|
12
|
+
"NODE_VERSION": "lts/*"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
// Set *default* container specific settings.json values on container create.
|
|
17
|
+
"settings": {
|
|
18
|
+
"terminal.integrated.shell.linux": "/bin/bash"
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Add the IDs of extensions you want installed when the container is created.
|
|
22
|
+
"extensions": [
|
|
23
|
+
"rebornix.Ruby"
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
27
|
+
// "forwardPorts": [],
|
|
28
|
+
|
|
29
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
30
|
+
"postCreateCommand": "sudo apt-get update && sudo apt-get install -y ripgrep && gem install bundler && bundle install",
|
|
31
|
+
|
|
32
|
+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
|
33
|
+
"remoteUser": "vscode"
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
continue-on-error: ${{ matrix.experimental == true }}
|
|
9
|
+
name: ubuntu-ruby-${{ matrix.ruby-version }}
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
ruby-version: ['2.7']
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v2
|
|
15
|
+
- name: Set up Ruby
|
|
16
|
+
uses: ruby/setup-ruby@v1
|
|
17
|
+
with:
|
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
19
|
+
bundler-cache: true
|
|
20
|
+
- name: Runs tests
|
|
21
|
+
run: bundle exec cucumber
|
|
22
|
+
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -77,8 +77,9 @@ In this mode if a resizing specification found in an `image_tag` or `image_path`
|
|
|
77
77
|
|
|
78
78
|
Option | default value | Description
|
|
79
79
|
------------------------------|----------------------------------|-------------
|
|
80
|
-
:
|
|
81
|
-
:
|
|
80
|
+
:use\_cache\_dev | `true` | In development, add a Rack middleware to serve the resized image from cache
|
|
81
|
+
:cache\_dir | `'tmp/simple-thumbnailer-cache'` | Directory (relative to project root) for cached thumbnails.
|
|
82
|
+
:use\_specs | `false` | Wether or not use resize specfication data file
|
|
82
83
|
:specs\_data | `'simple_thumbnailer'` | name of the specification data file. It must follow the Middleman data file name convention.
|
|
83
84
|
:specs\_data\_default\_format | `'yaml'` | defaut specification format (and extension). Can be 'yml', 'yaml', 'json'
|
|
84
85
|
:specs\_data\_save\_old | `true` | save previous specification data file
|
|
@@ -92,7 +93,9 @@ In the dynamic mode, this extension is unable to update the [sitemap](https://mi
|
|
|
92
93
|
|
|
93
94
|
## Build/Development modes
|
|
94
95
|
|
|
95
|
-
During development
|
|
96
|
+
During development:
|
|
97
|
+
- if option `use_cache_dev` is set to `true` thumbnails will be created when accessed, and are served with a rack middleware from the cache folder.
|
|
98
|
+
- Otherwise thumbnails will be created on fly and presented as a base64 strings.
|
|
96
99
|
|
|
97
100
|
During build thumbnails will be created as normal files and stored in same dir as their originals.
|
|
98
101
|
|
data/config/cucumber.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
default: --publish-quiet
|
|
@@ -4,18 +4,46 @@ Feature: Caching thumbnails in development
|
|
|
4
4
|
Given the Server is running at "basic-app"
|
|
5
5
|
And there is no cache directory yet
|
|
6
6
|
When I go to "/page-with-images-to-resize.html"
|
|
7
|
+
And I visit all images
|
|
7
8
|
Then the cache directory should exist with the following files
|
|
8
9
|
| images/original.10x10gt.eb4e78fd2554225b2.jpg |
|
|
9
10
|
| images/original.5x5.eb4e78fd2554225b2.jpg |
|
|
10
11
|
|
|
12
|
+
Scenario: Cached thumbnails are created use cache dev
|
|
13
|
+
Given the Server is running at "basic-app-use-cache"
|
|
14
|
+
And there is no cache directory yet
|
|
15
|
+
When I go to "/page-with-images-to-resize.html"
|
|
16
|
+
And I visit all images
|
|
17
|
+
Then the cache directory should exist with the following files
|
|
18
|
+
| images/original.10x10gt.eb4e78fd2554225b2.jpg |
|
|
19
|
+
| images/original.5x5.eb4e78fd2554225b2.jpg |
|
|
20
|
+
|
|
21
|
+
|
|
11
22
|
Scenario: Cached thumbnails are used, if present
|
|
12
23
|
Given the Server is running at "cached-thumbnails"
|
|
13
24
|
When I go to "/page-with-images-to-resize.html"
|
|
14
25
|
Then I should see base64ed data of the cached thumbnails
|
|
15
26
|
|
|
27
|
+
Scenario: Cached thumbnails are used, if present use cache dev
|
|
28
|
+
Given the Server is running at "cached-thumbnails-use-cache"
|
|
29
|
+
When I go to "/page-with-images-to-resize.html"
|
|
30
|
+
Then I should see urls for the following cached thumbnails:
|
|
31
|
+
| type | size | class | relative |
|
|
32
|
+
| img | 10x10 | 10x10 | false |
|
|
33
|
+
| img | 5x5 | 5x5 | false |
|
|
34
|
+
|
|
16
35
|
Scenario: Manually setting the cache directory
|
|
17
36
|
Given the Server is running at "custom-cache-dir"
|
|
18
37
|
When I go to "/page-with-images-to-resize.html"
|
|
38
|
+
And I visit all images
|
|
39
|
+
Then the cache directory should exist at "tmp/xxx" with the following files
|
|
40
|
+
| images/original.10x10.eb4e78fd2554225b2.jpg |
|
|
41
|
+
| images/original.5x5.eb4e78fd2554225b2.jpg |
|
|
42
|
+
|
|
43
|
+
Scenario: Manually setting the cache directory use cache
|
|
44
|
+
Given the Server is running at "custom-cache-dir-use-cache"
|
|
45
|
+
When I go to "/page-with-images-to-resize.html"
|
|
46
|
+
And I visit all images
|
|
19
47
|
Then the cache directory should exist at "tmp/xxx" with the following files
|
|
20
48
|
| images/original.10x10.eb4e78fd2554225b2.jpg |
|
|
21
49
|
| images/original.5x5.eb4e78fd2554225b2.jpg |
|
|
@@ -11,6 +11,14 @@ Feature: Generate image thumbnails
|
|
|
11
11
|
When I cd to "build"
|
|
12
12
|
Then the file "page-with-untouched-image.html" should contain '<img src="/images/original.jpg" alt="Original" />'
|
|
13
13
|
|
|
14
|
+
Scenario: Generate base64 thumbnail of image with resize_to param given use cache dev
|
|
15
|
+
Given the Server is running at "basic-app-use-cache"
|
|
16
|
+
When I go to "/page-with-images-to-resize.html"
|
|
17
|
+
Then I should see urls for the following cached thumbnails:
|
|
18
|
+
| type | size | class | relative | alt |
|
|
19
|
+
| img | 10x10> | 10x10 | false | Original.10x10gt |
|
|
20
|
+
| img | 5x5 | 5x5 | false | Original.5x5 |
|
|
21
|
+
|
|
14
22
|
Scenario: Generate base64 thumbnail of image with resize_to param given
|
|
15
23
|
Given the Server is running at "basic-app"
|
|
16
24
|
When I go to "/page-with-images-to-resize.html"
|
|
@@ -25,4 +33,10 @@ Feature: Generate image thumbnails
|
|
|
25
33
|
| images/original.10x10gt.jpg | 10x5 |
|
|
26
34
|
| images/original.5x5.jpg | 5x2 |
|
|
27
35
|
And the file "page-with-images-to-resize.html" should contain '<img src="/images/original.10x10gt.jpg" class="image-resized-to10x10" alt="Original.10x10gt" />'
|
|
28
|
-
And the file "page-with-images-to-resize.html" should contain '<img src="/images/original.5x5.jpg" class="image-resized-to5x5" alt="Original.5x5" />'
|
|
36
|
+
And the file "page-with-images-to-resize.html" should contain '<img src="/images/original.5x5.jpg" class="image-resized-to5x5" alt="Original.5x5" />'
|
|
37
|
+
|
|
38
|
+
Scenario: Not using resize_to should nt fail the build
|
|
39
|
+
Given a fixture app "basic-app-no-resize"
|
|
40
|
+
And a successfully built app at "basic-app-no-resize"
|
|
41
|
+
When I cd to "build"
|
|
42
|
+
Then the file "page-with-untouched-image.html" should contain '<img src="/images/original.jpg" alt="Original" />'
|
|
@@ -13,11 +13,21 @@ Feature: Generate image thumbnails with image path
|
|
|
13
13
|
Then the file "page-with-untouched-image.html" should contain '<img src="/images/original.jpg" alt="Original" />'
|
|
14
14
|
And the file "page-with-untouched-image.html" should contain '<source srcset="/images/original.jpg" media="(min-width: 900px)">'
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
Scenario: Generate url thumbnail of image with resize_to param given use cache dev
|
|
18
|
+
Given the Server is running at "basic-app-image-path-use-cache"
|
|
19
|
+
When I go to "/page-with-images-to-resize.html"
|
|
20
|
+
Then I should see urls for the following cached thumbnails:
|
|
21
|
+
| type | size | class | relative | alt |
|
|
22
|
+
| img | 10x10> | 10x10 | false | Original.10x10gt |
|
|
23
|
+
| img | 5x5 | 5x5 | false | Original.5x5 |
|
|
24
|
+
|
|
16
25
|
Scenario: Generate base64 thumbnail of image with resize_to param given
|
|
17
26
|
Given the Server is running at "basic-app-image-path"
|
|
18
27
|
When I go to "/page-with-images-to-resize.html"
|
|
19
28
|
Then I should see base64ed thumbnails and srcset of the images
|
|
20
29
|
|
|
30
|
+
|
|
21
31
|
Scenario: After build server resized images
|
|
22
32
|
Given a fixture app "basic-app-image-path"
|
|
23
33
|
And a successfully built app at "basic-app-image-path"
|
|
@@ -11,6 +11,17 @@ Feature: Generate image thumbnails
|
|
|
11
11
|
When I cd to "build"
|
|
12
12
|
Then the file "page-with-untouched-image.html" should contain '<img src="images/original.jpg" alt="Original" />'
|
|
13
13
|
|
|
14
|
+
|
|
15
|
+
Scenario: Generate url thumbnail of image with resize_to param given
|
|
16
|
+
Given the Server is running at "basic-app-relative-assets-use-cache"
|
|
17
|
+
When I go to "/page-with-images-to-resize.html"
|
|
18
|
+
Then I should see urls for the following cached thumbnails:
|
|
19
|
+
| type | size | class | relative | alt |
|
|
20
|
+
| img | 10x10 | 10x10 | true | Original.10x10gt |
|
|
21
|
+
| img | 5x5 | 5x5 | true | Original.5x5 |
|
|
22
|
+
| srcset | 20x20> | | true | |
|
|
23
|
+
| srcset | 15x15> | | true | |
|
|
24
|
+
|
|
14
25
|
Scenario: Generate base64 thumbnail of image with resize_to param given
|
|
15
26
|
Given the Server is running at "basic-app-relative-assets"
|
|
16
27
|
When I go to "/page-with-images-to-resize.html"
|
|
@@ -26,7 +37,7 @@ Feature: Generate image thumbnails
|
|
|
26
37
|
| images/original.5x5.jpg | 5x2 |
|
|
27
38
|
| images/original.20x20gt.jpg | 20x9 |
|
|
28
39
|
| images/original.15x15gt.jpg | 15x7 |
|
|
29
|
-
And the file "page-with-images-to-resize.html" should contain '<img src="images/original.10x10.jpg" class="image-resized-to10x10" alt="Original.
|
|
40
|
+
And the file "page-with-images-to-resize.html" should contain '<img src="images/original.10x10.jpg" class="image-resized-to10x10" alt="Original.10x10gt" />'
|
|
30
41
|
And the file "page-with-images-to-resize.html" should contain '<source srcset="images/original.20x20gt.jpg" media="(min-width: 900px)">'
|
|
31
42
|
And the file "page-with-images-to-resize.html" should contain '<img src="images/original.5x5.jpg" class="image-resized-to5x5" alt="Original.5x5" />'
|
|
32
43
|
And the file "page-with-images-to-resize.html" should contain '<source srcset="images/original.15x15gt.jpg" media="(min-width: 900px)">'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'base64'
|
|
2
2
|
require 'yaml'
|
|
3
|
+
require 'uri'
|
|
3
4
|
|
|
4
5
|
def calculate_resized_image_b64(resize_str)
|
|
5
6
|
base_image = MiniMagick::Image.open(File.expand_path("../../fixtures/basic-app/source/images/original.jpg", __dir__))
|
|
@@ -7,26 +8,19 @@ def calculate_resized_image_b64(resize_str)
|
|
|
7
8
|
Base64.strict_encode64(base_image.to_blob)
|
|
8
9
|
end
|
|
9
10
|
|
|
10
|
-
image10x10 = "<img src=\"data:image/jpeg;base64,"+calculate_resized_image_b64("10x10>")+"\" class=\"image-resized-to10x10\" />"
|
|
11
|
+
image10x10 = "<img src=\"data:image/jpeg;base64,"+calculate_resized_image_b64("10x10>")+"\" class=\"image-resized-to10x10\" alt=\"Original.10x10gt\" />"
|
|
11
12
|
|
|
12
|
-
image5x5 = "<img src=\"data:image/jpeg;base64,"+calculate_resized_image_b64("5x5")+"\" class=\"image-resized-to5x5\" />"
|
|
13
|
+
image5x5 = "<img src=\"data:image/jpeg;base64,"+calculate_resized_image_b64("5x5")+"\" class=\"image-resized-to5x5\" alt=\"Original.5x5\" />"
|
|
13
14
|
|
|
14
15
|
srcset20x20 = "<source srcset=\"data:image/jpeg;base64,"+calculate_resized_image_b64("20x20")+"\" media=\"(min-width: 900px)\">"
|
|
15
16
|
|
|
16
17
|
srcset15x15 = "<source srcset=\"data:image/jpeg;base64,"+calculate_resized_image_b64("15x15")+"\" media=\"(min-width: 900px)\">"
|
|
17
18
|
|
|
18
|
-
Given(/^there is no cache directory yet$/) do
|
|
19
|
-
if directory? MiddlemanSimpleThumbnailer::Extension.config.cache_dir
|
|
20
|
-
remove MiddlemanSimpleThumbnailer::Extension.config.cache_dir
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
19
|
Then(/^I should see base64ed thumbnails of the images$/) do
|
|
25
20
|
step %Q{I should see '#{image10x10}'}
|
|
26
21
|
step %Q{I should see '#{image5x5}'}
|
|
27
22
|
end
|
|
28
23
|
|
|
29
|
-
|
|
30
24
|
Then(/^I should see base64ed thumbnails and srcset of the images$/) do
|
|
31
25
|
step %Q{I should see '#{image10x10}'}
|
|
32
26
|
step %Q{I should see '#{image5x5}'}
|
|
@@ -34,6 +28,12 @@ Then(/^I should see base64ed thumbnails and srcset of the images$/) do
|
|
|
34
28
|
step %Q{I should see '#{srcset15x15}'}
|
|
35
29
|
end
|
|
36
30
|
|
|
31
|
+
Given(/^there is no cache directory yet$/) do
|
|
32
|
+
if directory? MiddlemanSimpleThumbnailer::Extension.config.cache_dir
|
|
33
|
+
remove MiddlemanSimpleThumbnailer::Extension.config.cache_dir
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
37
|
|
|
38
38
|
Then(/^the cache directory should exist (?:at "([^"]+)" )?with the following files$/) do |cache_dir, files|
|
|
39
39
|
cache_dir ||= MiddlemanSimpleThumbnailer::Extension.config.cache_dir
|
|
@@ -57,17 +57,32 @@ Then(/^I should see base64ed data of the cached thumbnails with image path$/) do
|
|
|
57
57
|
step %Q{I should see '#{cachedsrcset20x20}'}
|
|
58
58
|
step %Q{I should see '#{cachedsrcset15x15}'}
|
|
59
59
|
end
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
Then(/^I should see base64ed data of the cached thumbnails$/) do
|
|
62
62
|
# data that won't ever be generated by resizing an actual image
|
|
63
63
|
cached_10x10_data = "foo"
|
|
64
64
|
cached_5x5_data = "bar"
|
|
65
|
-
cachedimage10x10 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_10x10_data)}\" class=\"image-resized-to10x10\" />"
|
|
66
|
-
cachedimage5x5 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_5x5_data)}\" class=\"image-resized-to5x5\" />"
|
|
65
|
+
cachedimage10x10 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_10x10_data)}\" class=\"image-resized-to10x10\" alt=\"\" />"
|
|
66
|
+
cachedimage5x5 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_5x5_data)}\" class=\"image-resized-to5x5\" alt=\"\" />"
|
|
67
67
|
step %Q{I should see '#{cachedimage10x10}'}
|
|
68
68
|
step %Q{I should see '#{cachedimage5x5}'}
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
Then(/^I should see urls for the following cached thumbnails:$/) do |table|
|
|
72
|
+
table.hashes.each do |row|
|
|
73
|
+
isRelative = (row['relative'].to_s == "true")
|
|
74
|
+
urlPrefix = isRelative ? '' : '/'
|
|
75
|
+
if(row['type'] == "img")
|
|
76
|
+
imagedef = "<img src=\"#{urlPrefix}images/original.jpg?simple-thumbnailer=original.jpg%7C#{URI.encode_www_form_component(row['size'])}\" class=\"image-resized-to#{row['class']}\" alt=\"#{row['alt']}\" />"
|
|
77
|
+
else
|
|
78
|
+
imagedef = "<source srcset=\"#{urlPrefix}images/original.jpg?simple-thumbnailer=original.jpg%7C#{URI.encode_www_form_component(row['size'])}\" media=\"(min-width: 900px)\">"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
step %Q{I should see '#{imagedef}'}
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
|
|
71
86
|
Then(/^the following images should exist:$/) do |table|
|
|
72
87
|
table.hashes.each do |row|
|
|
73
88
|
cd('.') do
|
|
@@ -91,3 +106,9 @@ end
|
|
|
91
106
|
Then(/^the file "([^"]*)" should not contain '([^']*)'$/) do |file, partial_content|
|
|
92
107
|
expect(file).not_to have_file_content(Regexp.new(Regexp.escape(partial_content)), true)
|
|
93
108
|
end
|
|
109
|
+
|
|
110
|
+
When(/^I visit all images$/) do
|
|
111
|
+
page.body.scan(/\<img src=\"(.*?)\"[^>]*\>/) do |m|
|
|
112
|
+
visit(m[0]) if !m[0].start_with?('data:')
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :middleman_simple_thumbnailer, use_cache_dev: true
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Hello World</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<picture>
|
|
8
|
+
<source srcset="<%= image_path 'original.jpg', resize_to: '20x20' %>" media="(min-width: 900px)">
|
|
9
|
+
<%= image_tag 'original.jpg', resize_to: '10x10>', class: 'image-resized-to10x10', alt: 'Original.10x10gt' %>
|
|
10
|
+
</picture>
|
|
11
|
+
<picture>
|
|
12
|
+
<source srcset="<%= image_path 'original.jpg', resize_to: '15x15' %>" media="(min-width: 900px)">
|
|
13
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5', alt: 'Original.5x5' %>
|
|
14
|
+
</picture>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Hello World</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<picture>
|
|
8
|
+
<source srcset="<%= image_path 'original.jpg' %>" media="(min-width: 900px)">
|
|
9
|
+
<%= image_tag 'original.jpg', alt: 'Original' %>
|
|
10
|
+
</picture>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<body>
|
|
7
7
|
<picture>
|
|
8
8
|
<source srcset="<%= image_path 'original.jpg', resize_to: '20x20' %>" media="(min-width: 900px)">
|
|
9
|
-
<%= image_tag 'original.jpg', resize_to: '10x10>', class: 'image-resized-to10x10' %>
|
|
9
|
+
<%= image_tag 'original.jpg', resize_to: '10x10>', class: 'image-resized-to10x10', alt: 'Original.10x10gt' %>
|
|
10
10
|
</picture>
|
|
11
11
|
<picture>
|
|
12
12
|
<source srcset="<%= image_path 'original.jpg', resize_to: '15x15' %>" media="(min-width: 900px)">
|
|
13
|
-
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5' %>
|
|
13
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5', alt: 'Original.5x5' %>
|
|
14
14
|
</picture>
|
|
15
15
|
</body>
|
|
16
16
|
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :middleman_simple_thumbnailer
|
|
Binary file
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<body>
|
|
7
7
|
<picture>
|
|
8
8
|
<source srcset="<%= image_path 'original.jpg', resize_to: '20x20>'%>" media="(min-width: 900px)">
|
|
9
|
-
<%= image_tag 'original.jpg', resize_to: '10x10', class: 'image-resized-to10x10' %>
|
|
9
|
+
<%= image_tag 'original.jpg', resize_to: '10x10', class: 'image-resized-to10x10', alt:'Original.10x10gt' %>
|
|
10
10
|
</picture>
|
|
11
11
|
<picture>
|
|
12
12
|
<source srcset="<%= image_path 'original.jpg', resize_to: '15x15>'%>" media="(min-width: 900px)">
|
|
13
|
-
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5' %>
|
|
13
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5', alt:'Original.5x5' %>
|
|
14
14
|
</picture>
|
|
15
15
|
</body>
|
|
16
|
-
</html>
|
|
16
|
+
</html>
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<body>
|
|
7
7
|
<picture>
|
|
8
8
|
<source srcset="<%= image_path 'original.jpg', resize_to: '20x20>'%>" media="(min-width: 900px)">
|
|
9
|
-
<%= image_tag 'original.jpg', resize_to: '10x10', class: 'image-resized-to10x10' %>
|
|
9
|
+
<%= image_tag 'original.jpg', resize_to: '10x10', class: 'image-resized-to10x10', alt:'Original.10x10gt' %>
|
|
10
10
|
</picture>
|
|
11
11
|
<picture>
|
|
12
12
|
<source srcset="<%= image_path 'original.jpg', resize_to: '15x15>'%>" media="(min-width: 900px)">
|
|
13
|
-
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5' %>
|
|
13
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5', alt:'Original.5x5' %>
|
|
14
14
|
</picture>
|
|
15
15
|
</body>
|
|
16
16
|
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :middleman_simple_thumbnailer, use_cache_dev: true
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Hello World</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<%= image_tag 'original.jpg', resize_to: '10x10>', class: 'image-resized-to10x10', alt: 'Original.10x10gt' %>
|
|
8
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5', alt: 'Original.5x5' %>
|
|
9
|
+
</body>
|
|
10
|
+
</html>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>Hello World</title>
|
|
5
5
|
</head>
|
|
6
6
|
<body>
|
|
7
|
-
<%= image_tag 'original.jpg', resize_to: '10x10>', class: 'image-resized-to10x10' %>
|
|
8
|
-
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5' %>
|
|
7
|
+
<%= image_tag 'original.jpg', resize_to: '10x10>', class: 'image-resized-to10x10', alt: 'Original.10x10gt' %>
|
|
8
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5', alt: 'Original.5x5' %>
|
|
9
9
|
</body>
|
|
10
10
|
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :middleman_simple_thumbnailer, use_cache_dev: true
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Hello World</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<%= image_tag 'original.jpg', resize_to: '10x10', class: 'image-resized-to10x10' %>
|
|
8
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5' %>
|
|
9
|
+
</body>
|
|
10
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Hello World</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<%= image_tag 'original.jpg', resize_to: '10x10', class: 'image-resized-to10x10' %>
|
|
8
|
+
<%= image_tag 'original.jpg', resize_to: '5x5', class: 'image-resized-to5x5' %>
|
|
9
|
+
</body>
|
|
10
|
+
</html>
|
|
@@ -2,6 +2,7 @@ require 'tmpdir'
|
|
|
2
2
|
require 'yaml'
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'tempfile'
|
|
5
|
+
require 'uri'
|
|
5
6
|
# add resize_to param to image_tag to create thumbnails
|
|
6
7
|
#
|
|
7
8
|
#
|
|
@@ -17,6 +18,7 @@ module MiddlemanSimpleThumbnailer
|
|
|
17
18
|
option :specs_data_default_format, 'yaml', 'defaut specification file format (and extension). Can be yaml, yml or json'
|
|
18
19
|
option :specs_data_save_old, true, 'save previous specification data file '
|
|
19
20
|
option :update_specs, true, 'Warn about missing image file in specification and add them to teh spec file'
|
|
21
|
+
option :use_cache_dev, false, 'In development, add a Rack middleware to serve the resized image from cache'
|
|
20
22
|
|
|
21
23
|
def initialize(app, options_hash={}, &block)
|
|
22
24
|
super
|
|
@@ -30,14 +32,16 @@ module MiddlemanSimpleThumbnailer
|
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
|
|
35
|
+
def after_configuration
|
|
36
|
+
if app.development? && options.use_cache_dev
|
|
37
|
+
app.use MiddlemanSimpleThumbnailer::Rack, options, app, options
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
33
41
|
def store_resized_image(img_path, resize_to)
|
|
34
42
|
@images_store.store(img_path, resize_to)
|
|
35
43
|
end
|
|
36
44
|
|
|
37
|
-
# def after_configuration
|
|
38
|
-
# MiddlemanSimpleThumbnailer::Image.options = options
|
|
39
|
-
# end
|
|
40
|
-
|
|
41
45
|
def check_image_in_specs(img_path, resize_to)
|
|
42
46
|
@resize_specs.each do |resize_spec|
|
|
43
47
|
if resize_to == resize_spec.resize_to && File.fnmatch(resize_spec.path, img_path)
|
|
@@ -47,12 +51,6 @@ module MiddlemanSimpleThumbnailer
|
|
|
47
51
|
return false
|
|
48
52
|
end
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
# def source_dir
|
|
52
|
-
# File.absolute_path(app.config[:source], app.root)
|
|
53
|
-
# end
|
|
54
|
-
|
|
55
|
-
|
|
56
54
|
def manipulate_resource_list(resources)
|
|
57
55
|
return resources unless options.use_specs
|
|
58
56
|
resources + @resize_specs.reduce([]) do |res, resize_spec|
|
|
@@ -135,23 +133,34 @@ module MiddlemanSimpleThumbnailer
|
|
|
135
133
|
|
|
136
134
|
image = MiddlemanSimpleThumbnailer::Image.new(path, resize_to, app, ext.options)
|
|
137
135
|
if app.development?
|
|
138
|
-
|
|
136
|
+
if ext.options.use_cache_dev
|
|
137
|
+
[path, {"simple-thumbnailer" => "#{path}|#{resize_to}"}]
|
|
138
|
+
else
|
|
139
|
+
["data:#{image.mime_type};base64,#{image.base64_data}", {}]
|
|
140
|
+
end
|
|
139
141
|
else
|
|
140
142
|
ext.store_resized_image(path, resize_to)
|
|
141
|
-
image.resized_img_path
|
|
143
|
+
[image.resized_img_path, {}]
|
|
142
144
|
end
|
|
143
145
|
end
|
|
144
146
|
|
|
145
147
|
def image_tag(path, options={})
|
|
146
148
|
resize_to = options.delete(:resize_to)
|
|
147
|
-
new_path = resize_to ? resized_image_path(path, resize_to) : path
|
|
149
|
+
new_path, query_params = resize_to ? resized_image_path(path, resize_to) : [path, {}]
|
|
150
|
+
if(!query_params.empty?)
|
|
151
|
+
new_path = "#{new_path}?#{URI.encode_www_form(query_params)}"
|
|
152
|
+
end
|
|
148
153
|
super(new_path, options)
|
|
149
154
|
end
|
|
150
155
|
|
|
151
156
|
def image_path(path, options={})
|
|
152
157
|
resize_to = options.delete(:resize_to)
|
|
153
|
-
new_path = resize_to ? resized_image_path(path, resize_to) : path
|
|
154
|
-
super(new_path)
|
|
158
|
+
new_path, query_params = resize_to ? resized_image_path(path, resize_to) : [path, {}]
|
|
159
|
+
res = super(new_path)
|
|
160
|
+
if(!query_params.empty?)
|
|
161
|
+
res = "#{res}?#{URI.encode_www_form(query_params)}"
|
|
162
|
+
end
|
|
163
|
+
res
|
|
155
164
|
end
|
|
156
165
|
|
|
157
166
|
end
|
|
@@ -22,6 +22,11 @@ module MiddlemanSimpleThumbnailer
|
|
|
22
22
|
img_path.gsub(image_name, resized_image_name)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def base64_data
|
|
26
|
+
prepare_thumbnail
|
|
27
|
+
Base64.strict_encode64(File.read(cached_resized_img_abs_path))
|
|
28
|
+
end
|
|
29
|
+
|
|
25
30
|
def prepare_thumbnail
|
|
26
31
|
unless cached_thumbnail_available?
|
|
27
32
|
resize!
|
|
@@ -29,11 +34,6 @@ module MiddlemanSimpleThumbnailer
|
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
|
|
32
|
-
def base64_data
|
|
33
|
-
prepare_thumbnail
|
|
34
|
-
Base64.strict_encode64(File.read(cached_resized_img_abs_path))
|
|
35
|
-
end
|
|
36
|
-
|
|
37
37
|
def render
|
|
38
38
|
prepare_thumbnail
|
|
39
39
|
File.read(cached_resized_img_abs_path)
|
|
@@ -45,10 +45,6 @@ module MiddlemanSimpleThumbnailer
|
|
|
45
45
|
FileUtils.copy_file(cached_resized_img_abs_path, resized_img_abs_path)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# def self.options=(options)
|
|
49
|
-
# @@options = options
|
|
50
|
-
# end
|
|
51
|
-
|
|
52
48
|
def resized_img_abs_path
|
|
53
49
|
File.join(build_dir, middleman_abs_path).gsub(image_name, resized_image_name)
|
|
54
50
|
end
|
|
@@ -88,6 +84,10 @@ module MiddlemanSimpleThumbnailer
|
|
|
88
84
|
File.basename(abs_path)
|
|
89
85
|
end
|
|
90
86
|
|
|
87
|
+
def original_mtime
|
|
88
|
+
File.mtime abs_path
|
|
89
|
+
end
|
|
90
|
+
|
|
91
91
|
def resized_image_name
|
|
92
92
|
image_name.split('.').tap { |a| a.insert(-2, resize_to) }.join('.') # add resize_to sufix
|
|
93
93
|
.gsub(/[%@!<>^]/, '>' => 'gt', '<' => 'lt', '^' => 'c') # sanitize file name
|
|
@@ -104,6 +104,7 @@ module MiddlemanSimpleThumbnailer
|
|
|
104
104
|
def save_cached_thumbnail
|
|
105
105
|
FileUtils.mkdir_p(File.dirname(cached_resized_img_abs_path))
|
|
106
106
|
image.write(cached_resized_img_abs_path)
|
|
107
|
+
File.utime(original_mtime, original_mtime, cached_resized_img_abs_path)
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
def source_dir
|
|
@@ -24,6 +24,7 @@ module MiddlemanSimpleThumbnailer
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def each
|
|
27
|
+
return unless File.exist?(@tmp_path)
|
|
27
28
|
File.open(@tmp_path, "r") do |f|
|
|
28
29
|
f.flock(File::LOCK_SH)
|
|
29
30
|
resized_images = f.size > 0 ? Marshal.load(f) : {}
|
|
@@ -34,7 +35,7 @@ module MiddlemanSimpleThumbnailer
|
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def delete
|
|
37
|
-
File.delete(@tmp_path)
|
|
38
|
+
File.delete(@tmp_path) if File.exist?(@tmp_path)
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rack/utils'
|
|
2
|
+
require 'cgi'
|
|
3
|
+
|
|
4
|
+
module MiddlemanSimpleThumbnailer
|
|
5
|
+
class Rack
|
|
6
|
+
def initialize(app, options= {}, middleman_app, config)
|
|
7
|
+
@app = app
|
|
8
|
+
@options = options
|
|
9
|
+
@config = config
|
|
10
|
+
@middleman_app = middleman_app
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call(env)
|
|
14
|
+
path_info = env["PATH_INFO"]
|
|
15
|
+
query_str = env["QUERY_STRING"]
|
|
16
|
+
environment = @middleman_app.config[:environment]
|
|
17
|
+
status = -1
|
|
18
|
+
|
|
19
|
+
if(environment === :development && !query_str.empty?)
|
|
20
|
+
query_hash = CGI::parse(query_str)
|
|
21
|
+
if(query_hash.key?('simple-thumbnailer'))
|
|
22
|
+
path, resize_to = query_hash['simple-thumbnailer'][0].split('|')
|
|
23
|
+
image = MiddlemanSimpleThumbnailer::Image.new(path, resize_to, @middleman_app, @config)
|
|
24
|
+
status = 200
|
|
25
|
+
file_data = image.render
|
|
26
|
+
headers = {
|
|
27
|
+
"Content-Length" => file_data.bytesize.to_s,
|
|
28
|
+
"Content-Type" => image.mime_type
|
|
29
|
+
}
|
|
30
|
+
response = [file_data]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if status === -1
|
|
35
|
+
status, headers, response = @app.call(env)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
[status, headers, response]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -16,12 +16,12 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n")
|
|
17
17
|
s.require_paths = ['lib']
|
|
18
18
|
|
|
19
|
-
s.add_runtime_dependency 'middleman-core', '~> 4'
|
|
19
|
+
s.add_runtime_dependency 'middleman-core', '~> 4.3'
|
|
20
20
|
s.add_runtime_dependency 'mini_magick', '~> 4'
|
|
21
21
|
|
|
22
22
|
s.add_development_dependency 'middleman-cli', '~> 4'
|
|
23
|
-
s.add_development_dependency 'rake', '~>
|
|
24
|
-
s.add_development_dependency 'aruba', '~> 0.14
|
|
25
|
-
s.add_development_dependency 'cucumber', '~>
|
|
26
|
-
s.add_development_dependency 'capybara', '~>
|
|
23
|
+
s.add_development_dependency 'rake', '~> 13'
|
|
24
|
+
s.add_development_dependency 'aruba', '~> 0.14'
|
|
25
|
+
s.add_development_dependency 'cucumber', '~> 5'
|
|
26
|
+
s.add_development_dependency 'capybara', '~> 3'
|
|
27
27
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: middleman-simple-thumbnailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jakub Niewczas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: middleman-core
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '4'
|
|
19
|
+
version: '4.3'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '4'
|
|
26
|
+
version: '4.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: mini_magick
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,56 +58,56 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '13'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '13'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: aruba
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.14
|
|
75
|
+
version: '0.14'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.14
|
|
82
|
+
version: '0.14'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: cucumber
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
89
|
+
version: '5'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
96
|
+
version: '5'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: capybara
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - "~>"
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
103
|
+
version: '3'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
110
|
+
version: '3'
|
|
111
111
|
description: Middleman extension that allows you to create image thumbnails by providing
|
|
112
112
|
resize_to option to image_tag helper
|
|
113
113
|
email:
|
|
@@ -116,12 +116,15 @@ executables: []
|
|
|
116
116
|
extensions: []
|
|
117
117
|
extra_rdoc_files: []
|
|
118
118
|
files:
|
|
119
|
+
- ".devcontainer/Dockerfile"
|
|
120
|
+
- ".devcontainer/devcontainer.json"
|
|
121
|
+
- ".github/workflows/ci.yml"
|
|
119
122
|
- ".gitignore"
|
|
120
|
-
- ".travis.yml"
|
|
121
123
|
- Gemfile
|
|
122
124
|
- MIT-LICENSE
|
|
123
125
|
- README.md
|
|
124
126
|
- Rakefile
|
|
127
|
+
- config/cucumber.yml
|
|
125
128
|
- features/caching_thumbnails_in_development.feature
|
|
126
129
|
- features/generate_image_thumbnails.feature
|
|
127
130
|
- features/generate_image_thumbnails_image_path.feature
|
|
@@ -140,30 +143,44 @@ files:
|
|
|
140
143
|
- fixtures/basic-app-data-file/source/page-with-images-to-resize.html.erb
|
|
141
144
|
- fixtures/basic-app-data-file/source/page-with-untouched-image.html.erb
|
|
142
145
|
- fixtures/basic-app-data-file/source/sitemap.html.erb
|
|
146
|
+
- fixtures/basic-app-image-path-use-cache/config.rb
|
|
147
|
+
- fixtures/basic-app-image-path-use-cache/source/images/original.jpg
|
|
148
|
+
- fixtures/basic-app-image-path-use-cache/source/page-with-images-to-resize.html.erb
|
|
149
|
+
- fixtures/basic-app-image-path-use-cache/source/page-with-untouched-image.html.erb
|
|
143
150
|
- fixtures/basic-app-image-path/config.rb
|
|
144
151
|
- fixtures/basic-app-image-path/source/images/original.jpg
|
|
145
152
|
- fixtures/basic-app-image-path/source/page-with-images-to-resize.html.erb
|
|
146
153
|
- fixtures/basic-app-image-path/source/page-with-untouched-image.html.erb
|
|
154
|
+
- fixtures/basic-app-no-resize/config.rb
|
|
155
|
+
- fixtures/basic-app-no-resize/source/images/original.jpg
|
|
156
|
+
- fixtures/basic-app-no-resize/source/page-with-untouched-image.html.erb
|
|
157
|
+
- fixtures/basic-app-relative-assets-use-cache/config.rb
|
|
158
|
+
- fixtures/basic-app-relative-assets-use-cache/source/images/original.jpg
|
|
159
|
+
- fixtures/basic-app-relative-assets-use-cache/source/page-with-images-to-resize.html.erb
|
|
160
|
+
- fixtures/basic-app-relative-assets-use-cache/source/page-with-untouched-image.html.erb
|
|
147
161
|
- fixtures/basic-app-relative-assets/config.rb
|
|
148
162
|
- fixtures/basic-app-relative-assets/source/images/original.jpg
|
|
149
163
|
- fixtures/basic-app-relative-assets/source/page-with-images-to-resize.html.erb
|
|
150
164
|
- fixtures/basic-app-relative-assets/source/page-with-untouched-image.html.erb
|
|
165
|
+
- fixtures/basic-app-use-cache/config.rb
|
|
166
|
+
- fixtures/basic-app-use-cache/source/images/original.jpg
|
|
167
|
+
- fixtures/basic-app-use-cache/source/page-with-images-to-resize.html.erb
|
|
168
|
+
- fixtures/basic-app-use-cache/source/page-with-untouched-image.html.erb
|
|
151
169
|
- fixtures/basic-app/config.rb
|
|
152
170
|
- fixtures/basic-app/source/images/original.jpg
|
|
153
171
|
- fixtures/basic-app/source/page-with-images-to-resize.html.erb
|
|
154
172
|
- fixtures/basic-app/source/page-with-untouched-image.html.erb
|
|
155
|
-
- fixtures/cached-thumbnails-
|
|
156
|
-
- fixtures/cached-thumbnails-
|
|
157
|
-
- fixtures/cached-thumbnails-
|
|
158
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.10x10.eb4e78fd2554225b2.jpg
|
|
159
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.15x15.eb4e78fd2554225b2.jpg
|
|
160
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.20x20.eb4e78fd2554225b2.jpg
|
|
161
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.5x5.eb4e78fd2554225b2.jpg
|
|
173
|
+
- fixtures/cached-thumbnails-use-cache/config.rb
|
|
174
|
+
- fixtures/cached-thumbnails-use-cache/source/images/original.jpg
|
|
175
|
+
- fixtures/cached-thumbnails-use-cache/source/page-with-images-to-resize.html.erb
|
|
162
176
|
- fixtures/cached-thumbnails/config.rb
|
|
163
177
|
- fixtures/cached-thumbnails/source/images/original.jpg
|
|
164
178
|
- fixtures/cached-thumbnails/source/page-with-images-to-resize.html.erb
|
|
165
179
|
- fixtures/cached-thumbnails/tmp/simple-thumbnailer-cache/images/original.10x10.eb4e78fd2554225b2.jpg
|
|
166
180
|
- fixtures/cached-thumbnails/tmp/simple-thumbnailer-cache/images/original.5x5.eb4e78fd2554225b2.jpg
|
|
181
|
+
- fixtures/custom-cache-dir-use-cache/config.rb
|
|
182
|
+
- fixtures/custom-cache-dir-use-cache/source/images/original.jpg
|
|
183
|
+
- fixtures/custom-cache-dir-use-cache/source/page-with-images-to-resize.html.erb
|
|
167
184
|
- fixtures/custom-cache-dir/config.rb
|
|
168
185
|
- fixtures/custom-cache-dir/source/images/original.jpg
|
|
169
186
|
- fixtures/custom-cache-dir/source/page-with-images-to-resize.html.erb
|
|
@@ -171,6 +188,7 @@ files:
|
|
|
171
188
|
- lib/middleman-simple-thumbnailer/extension.rb
|
|
172
189
|
- lib/middleman-simple-thumbnailer/image.rb
|
|
173
190
|
- lib/middleman-simple-thumbnailer/image_store.rb
|
|
191
|
+
- lib/middleman-simple-thumbnailer/rack.rb
|
|
174
192
|
- lib/middleman-simple-thumbnailer/resource.rb
|
|
175
193
|
- lib/middleman-simple-thumbnailer/version.rb
|
|
176
194
|
- middleman-simple-thumbnailer.gemspec
|
|
@@ -193,54 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
193
211
|
- !ruby/object:Gem::Version
|
|
194
212
|
version: '0'
|
|
195
213
|
requirements: []
|
|
196
|
-
|
|
197
|
-
rubygems_version: 2.6.8
|
|
214
|
+
rubygems_version: 3.1.4
|
|
198
215
|
signing_key:
|
|
199
216
|
specification_version: 4
|
|
200
217
|
summary: Middleman extension that allows you to create image thumbnails
|
|
201
|
-
test_files:
|
|
202
|
-
- features/caching_thumbnails_in_development.feature
|
|
203
|
-
- features/generate_image_thumbnails.feature
|
|
204
|
-
- features/generate_image_thumbnails_image_path.feature
|
|
205
|
-
- features/generate_image_thumbnails_relative_assets.feature
|
|
206
|
-
- features/generate_new_data_file.feature
|
|
207
|
-
- features/given_data_file.feature
|
|
208
|
-
- features/support/env.rb
|
|
209
|
-
- features/support/image_thumbnails_steps.rb
|
|
210
|
-
- fixtures/basic-app-data-file-generate/config.rb
|
|
211
|
-
- fixtures/basic-app-data-file-generate/source/images/original.jpg
|
|
212
|
-
- fixtures/basic-app-data-file-generate/source/page-with-images-to-resize.html.erb
|
|
213
|
-
- fixtures/basic-app-data-file-generate/source/page-with-untouched-image.html.erb
|
|
214
|
-
- fixtures/basic-app-data-file/config.rb
|
|
215
|
-
- fixtures/basic-app-data-file/data/simple_thumbnailer.yml
|
|
216
|
-
- fixtures/basic-app-data-file/source/images/original.jpg
|
|
217
|
-
- fixtures/basic-app-data-file/source/page-with-images-to-resize.html.erb
|
|
218
|
-
- fixtures/basic-app-data-file/source/page-with-untouched-image.html.erb
|
|
219
|
-
- fixtures/basic-app-data-file/source/sitemap.html.erb
|
|
220
|
-
- fixtures/basic-app-image-path/config.rb
|
|
221
|
-
- fixtures/basic-app-image-path/source/images/original.jpg
|
|
222
|
-
- fixtures/basic-app-image-path/source/page-with-images-to-resize.html.erb
|
|
223
|
-
- fixtures/basic-app-image-path/source/page-with-untouched-image.html.erb
|
|
224
|
-
- fixtures/basic-app-relative-assets/config.rb
|
|
225
|
-
- fixtures/basic-app-relative-assets/source/images/original.jpg
|
|
226
|
-
- fixtures/basic-app-relative-assets/source/page-with-images-to-resize.html.erb
|
|
227
|
-
- fixtures/basic-app-relative-assets/source/page-with-untouched-image.html.erb
|
|
228
|
-
- fixtures/basic-app/config.rb
|
|
229
|
-
- fixtures/basic-app/source/images/original.jpg
|
|
230
|
-
- fixtures/basic-app/source/page-with-images-to-resize.html.erb
|
|
231
|
-
- fixtures/basic-app/source/page-with-untouched-image.html.erb
|
|
232
|
-
- fixtures/cached-thumbnails-image-path/config.rb
|
|
233
|
-
- fixtures/cached-thumbnails-image-path/source/images/original.jpg
|
|
234
|
-
- fixtures/cached-thumbnails-image-path/source/page-with-images-to-resize.html.erb
|
|
235
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.10x10.eb4e78fd2554225b2.jpg
|
|
236
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.15x15.eb4e78fd2554225b2.jpg
|
|
237
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.20x20.eb4e78fd2554225b2.jpg
|
|
238
|
-
- fixtures/cached-thumbnails-image-path/tmp/simple-thumbnailer-cache/images/original.5x5.eb4e78fd2554225b2.jpg
|
|
239
|
-
- fixtures/cached-thumbnails/config.rb
|
|
240
|
-
- fixtures/cached-thumbnails/source/images/original.jpg
|
|
241
|
-
- fixtures/cached-thumbnails/source/page-with-images-to-resize.html.erb
|
|
242
|
-
- fixtures/cached-thumbnails/tmp/simple-thumbnailer-cache/images/original.10x10.eb4e78fd2554225b2.jpg
|
|
243
|
-
- fixtures/cached-thumbnails/tmp/simple-thumbnailer-cache/images/original.5x5.eb4e78fd2554225b2.jpg
|
|
244
|
-
- fixtures/custom-cache-dir/config.rb
|
|
245
|
-
- fixtures/custom-cache-dir/source/images/original.jpg
|
|
246
|
-
- fixtures/custom-cache-dir/source/page-with-images-to-resize.html.erb
|
|
218
|
+
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
activate :middleman_simple_thumbnailer
|