jekyll-responsive_image 0.11.3 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de6842e6420c29f43a76dfb02a2aa5237427ae38
4
- data.tar.gz: fea958c837dd1622c8cff391d48a8ba26c8b358f
3
+ metadata.gz: f1a977d6f85c94a62c44f642c1c5db654858934c
4
+ data.tar.gz: ef3148da73fb5d20263355e5e11fe1b8b1b2c1de
5
5
  SHA512:
6
- metadata.gz: df011c8636d0bdaecc37bf1500de02d402647b7a5b6be3e8b6954e9cf5d904f5869d415db17266b6277c7044cca5280a0c640624c77b218850e6844989ddbc83
7
- data.tar.gz: bfde5df5e56dc9b0214314b9f9a9c2d166fe397f4e51d1328e251b499d0a7beafc0f25309f51d927aab673d8dda454c9b4f3ed3a7ea1793b78fa6b05bb37839d
6
+ metadata.gz: 65376dfb2c03ddd25ca527dba6a222821fd4b2ec4b19877fa6b9c4cb3cb74e605c0bdeb951fbe6fd26dcea006d84992e6ab04a1b6e7456667bcc45751836735a
7
+ data.tar.gz: c47166b22a9acc36d355f700c49cf42ba115284470ce3365cf914ce188cdcff8522a621fa6f91e9adeeb647d13fc865b59b46a17bd38fcd890330c8460aa321f
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ language: ruby
2
2
  bundler_args: --without debug
3
3
  script: bundle exec rake features_with_coveralls
4
4
  rvm:
5
+ - 2.2.0
5
6
  - 2.1.0
6
7
  - 2.0.0
7
8
  - 1.9.3
data/Gemfile CHANGED
@@ -3,7 +3,8 @@ gemspec
3
3
 
4
4
  group :development do
5
5
  gem 'rake'
6
- gem 'cucumber', '~> 1.3'
6
+ gem 'cucumber', '~> 2.1'
7
+ gem 'test-unit', '~> 3.1'
7
8
 
8
9
  gem 'coveralls', :require => false
9
10
  end
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Jekyll Responsive Images is a [Jekyll](http://jekyllrb.com/) plugin and utility for automatically resizing images. Its intended use is for sites which want to display responsive images using something like [`srcset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#Specifications) or [Imager.js](https://github.com/BBC-News/Imager.js/).
4
4
 
5
5
  [![Build Status](https://travis-ci.org/wildlyinaccurate/jekyll-responsive-image.svg?branch=master)](https://travis-ci.org/wildlyinaccurate/jekyll-responsive-image)
6
- [![Coverage Status](https://img.shields.io/coveralls/wildlyinaccurate/jekyll-responsive-images.svg)](https://coveralls.io/r/wildlyinaccurate/jekyll-responsive-images)
6
+ [![Coverage Status](https://coveralls.io/repos/wildlyinaccurate/jekyll-responsive-images/badge.svg?branch=master&service=github)](https://coveralls.io/github/wildlyinaccurate/jekyll-responsive-images?branch=master)
7
7
  [![Dependency Status](https://gemnasium.com/wildlyinaccurate/jekyll-responsive-images.svg)](https://gemnasium.com/wildlyinaccurate/jekyll-responsive-images)
8
8
 
9
9
  ## Installation
@@ -46,7 +46,8 @@ responsive_image:
46
46
  quality: 90
47
47
 
48
48
  # [Optional, Default: assets/resized/%{filename}-%{width}x%{height}.%{extension}]
49
- # The template used when generating filenames for resized images.
49
+ # The template used when generating filenames for resized images. Must be a
50
+ # relative path.
50
51
  #
51
52
  # Parameters available are:
52
53
  # %{basename} Basename of the file (assets/some-file.jpg => some-file.jpg)
@@ -22,6 +22,12 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = []
23
23
  spec.require_path = 'lib'
24
24
 
25
- spec.add_runtime_dependency 'jekyll', ['>= 2.0', '< 4.0']
25
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
26
+ max_jekyll_version = '3.0'
27
+ else
28
+ max_jekyll_version = '4.0'
29
+ end
30
+
31
+ spec.add_runtime_dependency 'jekyll', ['>= 2.0', "< #{max_jekyll_version}"]
26
32
  spec.add_runtime_dependency 'rmagick'
27
33
  end
@@ -9,6 +9,7 @@ require 'jekyll/responsive_image/defaults'
9
9
  require 'jekyll/responsive_image/utils'
10
10
  require 'jekyll/responsive_image/image_processor'
11
11
  require 'jekyll/responsive_image/resize_handler'
12
+ require 'jekyll/responsive_image/common'
12
13
  require 'jekyll/responsive_image/tag'
13
14
  require 'jekyll/responsive_image/block'
14
15
 
@@ -1,9 +1,10 @@
1
1
  module Jekyll
2
2
  class ResponsiveImage
3
3
  class Block < Liquid::Block
4
+ include Jekyll::ResponsiveImage::Common
5
+
4
6
  def render(context)
5
- config = ResponsiveImage.defaults.dup
6
- config.merge!(context.registers[:site].config['responsive_image'])
7
+ config = make_config(context.registers[:site])
7
8
 
8
9
  attributes = YAML.load(super)
9
10
  image_template = attributes['template'] || config['template']
@@ -0,0 +1,17 @@
1
+ module Jekyll
2
+ class ResponsiveImage
3
+ module Common
4
+ include Jekyll::ResponsiveImage::Utils
5
+
6
+ def make_config(site)
7
+ config = ResponsiveImage.defaults.dup.merge(site.config['responsive_image']).merge(:site_dest => site.dest)
8
+
9
+ # Not very nice, but this is needed to create a clean path to add to keep_files
10
+ output_dir = format_output_path(config['output_path_format'], '*', '*', '*')
11
+ site.config['keep_files'] << output_dir unless site.config['keep_files'].include?(output_dir)
12
+
13
+ config
14
+ end
15
+ end
16
+ end
17
+ end
@@ -28,17 +28,17 @@ module Jekyll
28
28
  f.quality = size['quality'] || config['default_quality']
29
29
  end
30
30
 
31
+ # Ensure the generated file is copied to the _site directory
32
+ site_dest_filepath = File.expand_path(filepath, config[:site_dest])
33
+ ensure_output_dir_exists!(File.dirname(site_dest_filepath))
34
+ FileUtils.copy(filepath, site_dest_filepath)
35
+
31
36
  i.destroy!
32
37
  end
33
38
 
34
39
  resized
35
40
  end
36
41
 
37
- def format_output_path(format, path, width, height)
38
- params = symbolize_keys(image_hash(path, width, height))
39
- format % params
40
- end
41
-
42
42
  def needs_resizing?(img, width)
43
43
  img.columns > width
44
44
  end
@@ -1,6 +1,8 @@
1
1
  module Jekyll
2
2
  class ResponsiveImage
3
3
  class Tag < Liquid::Tag
4
+ include Jekyll::ResponsiveImage::Common
5
+
4
6
  def initialize(tag_name, markup, tokens)
5
7
  super
6
8
 
@@ -13,8 +15,7 @@ module Jekyll
13
15
  end
14
16
 
15
17
  def render(context)
16
- config = ResponsiveImage.defaults.dup
17
- config.merge!(context.registers[:site].config['responsive_image'])
18
+ config = make_config(context.registers[:site])
18
19
 
19
20
  image = ImageProcessor.process(@attributes['path'], config)
20
21
  @attributes['original'] = image[:original]
@@ -9,6 +9,11 @@ module Jekyll
9
9
  result
10
10
  end
11
11
 
12
+ def format_output_path(format, path, width, height)
13
+ params = symbolize_keys(image_hash(path, width, height))
14
+ format % params
15
+ end
16
+
12
17
  # Build a hash containing image information
13
18
  def image_hash(path, width, height)
14
19
  {
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class ResponsiveImage
3
- VERSION = '0.11.3'.freeze
3
+ VERSION = '0.12.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-responsive_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Wynn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -71,6 +71,7 @@ files:
71
71
  - jekyll-responsive_image.gemspec
72
72
  - lib/jekyll/responsive_image.rb
73
73
  - lib/jekyll/responsive_image/block.rb
74
+ - lib/jekyll/responsive_image/common.rb
74
75
  - lib/jekyll/responsive_image/defaults.rb
75
76
  - lib/jekyll/responsive_image/image_processor.rb
76
77
  - lib/jekyll/responsive_image/resize_handler.rb
@@ -97,8 +98,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.4.5
101
+ rubygems_version: 2.4.5.1
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Responsive images for Jekyll via srcset
104
- test_files: []
105
+ test_files:
106
+ - features/fixtures/_includes/custom-template.html
107
+ - features/fixtures/_includes/responsive-image.html
108
+ - features/fixtures/assets/test.png
109
+ - features/responsive-image-block.feature
110
+ - features/responsive-image-tag.feature
111
+ - features/step_definitions/jekyll_steps.rb
112
+ - features/support/env.rb
113
+ - features/support/hooks.rb