jekyll_picture_tag 1.10.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +79 -0
  3. data/docs/Gemfile +4 -2
  4. data/docs/Gemfile.lock +14 -12
  5. data/docs/_config.yml +6 -10
  6. data/docs/devs/contributing/code.md +44 -0
  7. data/docs/devs/contributing/docs.md +13 -0
  8. data/docs/devs/contributing/index.md +15 -0
  9. data/docs/devs/contributing/setup.md +13 -0
  10. data/docs/devs/contributing/testing.md +41 -0
  11. data/docs/devs/index.md +7 -0
  12. data/docs/{releases.md → devs/releases.md} +37 -13
  13. data/docs/index.md +42 -26
  14. data/docs/users/configuration/cdn.md +35 -0
  15. data/docs/users/configuration/directories.md +34 -0
  16. data/docs/users/configuration/disable.md +24 -0
  17. data/docs/users/configuration/fast_build.md +28 -0
  18. data/docs/users/configuration/ignore_missing.md +23 -0
  19. data/docs/users/configuration/index.md +29 -0
  20. data/docs/users/configuration/kramdown_fix.md +20 -0
  21. data/docs/users/configuration/relative_urls.md +15 -0
  22. data/docs/users/configuration/suppress_warnings.md +16 -0
  23. data/docs/users/index.md +7 -0
  24. data/docs/users/installation.md +52 -0
  25. data/docs/users/liquid_tag/argument_reference/alternate_images.md +18 -0
  26. data/docs/users/liquid_tag/argument_reference/attributes.md +42 -0
  27. data/docs/users/liquid_tag/argument_reference/base_image.md +12 -0
  28. data/docs/users/liquid_tag/argument_reference/crop.md +48 -0
  29. data/docs/users/liquid_tag/argument_reference/link.md +16 -0
  30. data/docs/users/liquid_tag/argument_reference/preset.md +17 -0
  31. data/docs/users/liquid_tag/argument_reference/readme.md +9 -0
  32. data/docs/users/liquid_tag/examples.md +93 -0
  33. data/docs/users/liquid_tag/index.md +31 -0
  34. data/docs/users/notes/git_lfs.md +7 -0
  35. data/docs/users/notes/github_pages.md +5 -0
  36. data/docs/users/notes/html_attributes.md +5 -0
  37. data/docs/users/notes/index.md +6 -0
  38. data/docs/users/notes/input_checking.md +6 -0
  39. data/docs/users/notes/kramdown_bug.md +41 -0
  40. data/docs/users/notes/managing_images.md +21 -0
  41. data/docs/{migration.md → users/notes/migration.md} +0 -0
  42. data/docs/users/presets/cropping.md +61 -0
  43. data/docs/users/presets/default.md +23 -0
  44. data/docs/users/presets/examples.md +79 -0
  45. data/docs/users/presets/fallback_image.md +28 -0
  46. data/docs/users/presets/html_attributes.md +26 -0
  47. data/docs/users/presets/image_formats.md +21 -0
  48. data/docs/users/presets/image_quality.md +105 -0
  49. data/docs/users/presets/index.md +101 -0
  50. data/docs/users/presets/link_source.md +16 -0
  51. data/docs/users/presets/markup_formats/fragments.md +48 -0
  52. data/docs/users/presets/markup_formats/javascript_friendly.md +57 -0
  53. data/docs/users/presets/markup_formats/readme.md +43 -0
  54. data/docs/users/presets/markup_formats/standard_html.md +25 -0
  55. data/docs/users/presets/media_queries.md +36 -0
  56. data/docs/users/presets/nomarkdown_override.md +17 -0
  57. data/docs/users/presets/pixel_ratio_srcsets.md +32 -0
  58. data/docs/users/presets/quality_width_graph.png +0 -0
  59. data/docs/users/presets/width_height_attributes.md +34 -0
  60. data/docs/users/presets/width_srcsets.md +85 -0
  61. data/jekyll_picture_tag.gemspec +4 -5
  62. data/lib/jekyll_picture_tag.rb +3 -4
  63. data/lib/jekyll_picture_tag/cache.rb +3 -0
  64. data/lib/jekyll_picture_tag/cache/base.rb +59 -0
  65. data/lib/jekyll_picture_tag/cache/generated.rb +20 -0
  66. data/lib/jekyll_picture_tag/cache/source.rb +19 -0
  67. data/lib/jekyll_picture_tag/defaults/presets.yml +1 -0
  68. data/lib/jekyll_picture_tag/images.rb +3 -0
  69. data/lib/jekyll_picture_tag/images/generated_image.rb +127 -0
  70. data/lib/jekyll_picture_tag/{img_uri.rb → images/img_uri.rb} +1 -0
  71. data/lib/jekyll_picture_tag/images/source_image.rb +103 -0
  72. data/lib/jekyll_picture_tag/instructions/arg_splitter.rb +3 -2
  73. data/lib/jekyll_picture_tag/instructions/configuration.rb +1 -1
  74. data/lib/jekyll_picture_tag/instructions/preset.rb +24 -4
  75. data/lib/jekyll_picture_tag/instructions/set.rb +5 -1
  76. data/lib/jekyll_picture_tag/output_formats/basic.rb +16 -14
  77. data/lib/jekyll_picture_tag/output_formats/img.rb +11 -0
  78. data/lib/jekyll_picture_tag/output_formats/picture.rb +22 -0
  79. data/lib/jekyll_picture_tag/router.rb +3 -2
  80. data/lib/jekyll_picture_tag/srcsets/basic.rb +10 -1
  81. data/lib/jekyll_picture_tag/utils.rb +14 -0
  82. data/lib/jekyll_picture_tag/version.rb +1 -1
  83. data/readme.md +9 -7
  84. metadata +78 -45
  85. data/docs/_layouts/directory.html +0 -32
  86. data/docs/assets/style.css +0 -31
  87. data/docs/contributing.md +0 -109
  88. data/docs/example_presets.md +0 -116
  89. data/docs/global_configuration.md +0 -173
  90. data/docs/installation.md +0 -45
  91. data/docs/notes.md +0 -91
  92. data/docs/output.md +0 -63
  93. data/docs/presets.md +0 -361
  94. data/docs/usage.md +0 -143
  95. data/lib/jekyll_picture_tag/generated_image.rb +0 -161
  96. data/lib/jekyll_picture_tag/source_image.rb +0 -87
@@ -3,7 +3,13 @@ module PictureTag
3
3
  # Represents a <picture> tag, enclosing at least 2 <source> tags and an
4
4
  # <img> tag.
5
5
  class Picture < Basic
6
+ private
7
+
6
8
  def srcsets
9
+ @srcsets ||= build_srcsets
10
+ end
11
+
12
+ def build_srcsets
7
13
  formats = PictureTag.formats
8
14
  # Source images are provided in reverse order and must be flipped:
9
15
  images = PictureTag.source_images.reverse
@@ -37,6 +43,22 @@ module PictureTag
37
43
  source
38
44
  end
39
45
 
46
+ def build_base_img
47
+ img = super
48
+
49
+ # Only add source dimensions if there is a single source image.
50
+ # Currently you can't use both art direction and intrinsic image sizes.
51
+ if PictureTag.preset['dimension_attributes'] &&
52
+ PictureTag.source_images.length == 1
53
+ img.attributes << {
54
+ width: srcsets.first.width_attribute,
55
+ height: srcsets.first.height_attribute
56
+ }
57
+ end
58
+
59
+ img
60
+ end
61
+
40
62
  def base_markup
41
63
  picture = DoubleTag.new(
42
64
  'picture',
@@ -9,6 +9,7 @@ module PictureTag
9
9
  # gets big, I'll refactor.
10
10
  module Router
11
11
  attr_accessor :instructions, :context
12
+
12
13
  # Context forwarding
13
14
 
14
15
  # Global site data
@@ -107,8 +108,8 @@ module PictureTag
107
108
  preset.nomarkdown?
108
109
  end
109
110
 
110
- def quality(format)
111
- preset.quality(format)
111
+ def quality(format, width)
112
+ preset.quality(format, width)
112
113
  end
113
114
  end
114
115
  end
@@ -23,6 +23,7 @@ module PictureTag
23
23
  @format ||= files.first.format
24
24
  end
25
25
 
26
+ # GeneratedImage class
26
27
  def files
27
28
  @files ||= build_files
28
29
  end
@@ -51,6 +52,14 @@ module PictureTag
51
52
  "(#{PictureTag.media_presets[@media]})"
52
53
  end
53
54
 
55
+ def width_attribute
56
+ files.first.source_width.to_s
57
+ end
58
+
59
+ def height_attribute
60
+ files.first.source_height.to_s
61
+ end
62
+
54
63
  private
55
64
 
56
65
  def build_files
@@ -78,7 +87,7 @@ module PictureTag
78
87
 
79
88
  def source_width
80
89
  @source_width ||= if PictureTag.crop(@media)
81
- target_files.first.cropped_source_width
90
+ target_files.first.source_width
82
91
  else
83
92
  @source_image.width
84
93
  end
@@ -63,6 +63,20 @@ module PictureTag
63
63
  def titleize(input)
64
64
  input.split('_').map(&:capitalize).join
65
65
  end
66
+
67
+ # Linear interpolator. Pass it 2 values in the x array, 2 values
68
+ # in the y array, and an x value, returns a y value.
69
+ def interpolate(xvals, yvals, xval)
70
+ xvals.map!(&:to_f)
71
+ yvals.map!(&:to_f)
72
+
73
+ # Slope
74
+ m = (yvals.last - yvals.first) / (xvals.last - xvals.first)
75
+ # Value of y when x=0
76
+ b = yvals.first - (m * xvals.first)
77
+ # y = mx + b
78
+ (m * xval) + b
79
+ end
66
80
  end
67
81
  end
68
82
  end
@@ -1,3 +1,3 @@
1
1
  module PictureTag
2
- VERSION = '1.10.0'.freeze
2
+ VERSION = '1.13.0'.freeze
3
3
  end
data/readme.md CHANGED
@@ -39,19 +39,21 @@ https://rbuchberger.github.io/jekyll_picture_tag/
39
39
 
40
40
  ## Changelog:
41
41
 
42
- https://rbuchberger.github.io/jekyll_picture_tag/releases
42
+ https://rbuchberger.github.io/jekyll_picture_tag/devs/releases
43
43
 
44
- Latest version:
44
+ Latest versions:
45
45
 
46
- * 1.10.0 May 11, 2020
47
- * **Image Cropping support!** access the power of ImageMagick's `crop` function.
48
- * Don't issue a warning when `default` preset is not found.
49
- * Documentation improvements
46
+ * 1.13.0 November 23, 2020
47
+ * Add image quality interpolation; allows for variable image quality based on image size.
48
+ * Bugfix: Perform format, resize, and quality changes simultaneously rather than individually.
49
+ * Allows for actual lossless webp: simply set quality to 100.
50
+ * Improves fresh (no cached images) build times by ~15%
51
+ * Fix problems with poor image quality.
50
52
 
51
53
  ## Help Wanted
52
54
 
53
55
  Writing code is only part of the job; often the harder part is knowing what needs to be changed. Any
54
56
  and all feedback is greatly appreciated, especially in regards to documentation. What are your pain
55
57
  points? See the [contributing
56
- guidelines](https://rbuchberger.github.io/jekyll_picture_tag/contributing), or the
58
+ guidelines](https://rbuchberger.github.io/jekyll_picture_tag/devs/contributing), or the
57
59
  [issues](https://github.com/rbuchberger/jekyll_picture_tag/issues) page for more.
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_picture_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wierzbowski
8
8
  - Brendan Tobolaski
9
9
  - Robert Buchberger
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-05-11 00:00:00.000000000 Z
13
+ date: 2020-11-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -100,16 +100,16 @@ dependencies:
100
100
  name: rubocop
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ">="
103
+ - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '0'
105
+ version: '0.8'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ">="
110
+ - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '0'
112
+ version: '0.8'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: simplecov
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -152,62 +152,48 @@ dependencies:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
154
  version: '2.6'
155
- - !ruby/object:Gem::Dependency
156
- name: base32
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - "~>"
160
- - !ruby/object:Gem::Version
161
- version: '0.3'
162
- type: :runtime
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - "~>"
167
- - !ruby/object:Gem::Version
168
- version: '0.3'
169
155
  - !ruby/object:Gem::Dependency
170
156
  name: mime-types
171
157
  requirement: !ruby/object:Gem::Requirement
172
158
  requirements:
173
159
  - - "~>"
174
160
  - !ruby/object:Gem::Version
175
- version: '3'
161
+ version: '3.0'
176
162
  type: :runtime
177
163
  prerelease: false
178
164
  version_requirements: !ruby/object:Gem::Requirement
179
165
  requirements:
180
166
  - - "~>"
181
167
  - !ruby/object:Gem::Version
182
- version: '3'
168
+ version: '3.0'
183
169
  - !ruby/object:Gem::Dependency
184
170
  name: mini_magick
185
171
  requirement: !ruby/object:Gem::Requirement
186
172
  requirements:
187
173
  - - "~>"
188
174
  - !ruby/object:Gem::Version
189
- version: '4'
175
+ version: '4.0'
190
176
  type: :runtime
191
177
  prerelease: false
192
178
  version_requirements: !ruby/object:Gem::Requirement
193
179
  requirements:
194
180
  - - "~>"
195
181
  - !ruby/object:Gem::Version
196
- version: '4'
182
+ version: '4.0'
197
183
  - !ruby/object:Gem::Dependency
198
184
  name: objective_elements
199
185
  requirement: !ruby/object:Gem::Requirement
200
186
  requirements:
201
187
  - - "~>"
202
188
  - !ruby/object:Gem::Version
203
- version: 1.1.2
189
+ version: '1.1'
204
190
  type: :runtime
205
191
  prerelease: false
206
192
  version_requirements: !ruby/object:Gem::Requirement
207
193
  requirements:
208
194
  - - "~>"
209
195
  - !ruby/object:Gem::Version
210
- version: 1.1.2
196
+ version: '1.1'
211
197
  - !ruby/object:Gem::Dependency
212
198
  name: jekyll
213
199
  requirement: !ruby/object:Gem::Requirement
@@ -246,27 +232,75 @@ files:
246
232
  - docs/Gemfile
247
233
  - docs/Gemfile.lock
248
234
  - docs/_config.yml
249
- - docs/_layouts/directory.html
250
- - docs/assets/style.css
251
- - docs/contributing.md
252
- - docs/example_presets.md
253
- - docs/global_configuration.md
235
+ - docs/devs/contributing/code.md
236
+ - docs/devs/contributing/docs.md
237
+ - docs/devs/contributing/index.md
238
+ - docs/devs/contributing/setup.md
239
+ - docs/devs/contributing/testing.md
240
+ - docs/devs/index.md
241
+ - docs/devs/releases.md
254
242
  - docs/index.md
255
- - docs/installation.md
256
- - docs/migration.md
257
- - docs/notes.md
258
- - docs/output.md
259
- - docs/presets.md
260
- - docs/releases.md
261
- - docs/usage.md
243
+ - docs/users/configuration/cdn.md
244
+ - docs/users/configuration/directories.md
245
+ - docs/users/configuration/disable.md
246
+ - docs/users/configuration/fast_build.md
247
+ - docs/users/configuration/ignore_missing.md
248
+ - docs/users/configuration/index.md
249
+ - docs/users/configuration/kramdown_fix.md
250
+ - docs/users/configuration/relative_urls.md
251
+ - docs/users/configuration/suppress_warnings.md
252
+ - docs/users/index.md
253
+ - docs/users/installation.md
254
+ - docs/users/liquid_tag/argument_reference/alternate_images.md
255
+ - docs/users/liquid_tag/argument_reference/attributes.md
256
+ - docs/users/liquid_tag/argument_reference/base_image.md
257
+ - docs/users/liquid_tag/argument_reference/crop.md
258
+ - docs/users/liquid_tag/argument_reference/link.md
259
+ - docs/users/liquid_tag/argument_reference/preset.md
260
+ - docs/users/liquid_tag/argument_reference/readme.md
261
+ - docs/users/liquid_tag/examples.md
262
+ - docs/users/liquid_tag/index.md
263
+ - docs/users/notes/git_lfs.md
264
+ - docs/users/notes/github_pages.md
265
+ - docs/users/notes/html_attributes.md
266
+ - docs/users/notes/index.md
267
+ - docs/users/notes/input_checking.md
268
+ - docs/users/notes/kramdown_bug.md
269
+ - docs/users/notes/managing_images.md
270
+ - docs/users/notes/migration.md
271
+ - docs/users/presets/cropping.md
272
+ - docs/users/presets/default.md
273
+ - docs/users/presets/examples.md
274
+ - docs/users/presets/fallback_image.md
275
+ - docs/users/presets/html_attributes.md
276
+ - docs/users/presets/image_formats.md
277
+ - docs/users/presets/image_quality.md
278
+ - docs/users/presets/index.md
279
+ - docs/users/presets/link_source.md
280
+ - docs/users/presets/markup_formats/fragments.md
281
+ - docs/users/presets/markup_formats/javascript_friendly.md
282
+ - docs/users/presets/markup_formats/readme.md
283
+ - docs/users/presets/markup_formats/standard_html.md
284
+ - docs/users/presets/media_queries.md
285
+ - docs/users/presets/nomarkdown_override.md
286
+ - docs/users/presets/pixel_ratio_srcsets.md
287
+ - docs/users/presets/quality_width_graph.png
288
+ - docs/users/presets/width_height_attributes.md
289
+ - docs/users/presets/width_srcsets.md
262
290
  - jekyll-picture-tag.gemspec
263
291
  - jekyll_picture_tag.gemspec
264
292
  - lib/jekyll-picture-tag.rb
265
293
  - lib/jekyll_picture_tag.rb
294
+ - lib/jekyll_picture_tag/cache.rb
295
+ - lib/jekyll_picture_tag/cache/base.rb
296
+ - lib/jekyll_picture_tag/cache/generated.rb
297
+ - lib/jekyll_picture_tag/cache/source.rb
266
298
  - lib/jekyll_picture_tag/defaults/global.yml
267
299
  - lib/jekyll_picture_tag/defaults/presets.yml
268
- - lib/jekyll_picture_tag/generated_image.rb
269
- - lib/jekyll_picture_tag/img_uri.rb
300
+ - lib/jekyll_picture_tag/images.rb
301
+ - lib/jekyll_picture_tag/images/generated_image.rb
302
+ - lib/jekyll_picture_tag/images/img_uri.rb
303
+ - lib/jekyll_picture_tag/images/source_image.rb
270
304
  - lib/jekyll_picture_tag/instructions.rb
271
305
  - lib/jekyll_picture_tag/instructions/arg_splitter.rb
272
306
  - lib/jekyll_picture_tag/instructions/configuration.rb
@@ -287,7 +321,6 @@ files:
287
321
  - lib/jekyll_picture_tag/output_formats/picture.rb
288
322
  - lib/jekyll_picture_tag/output_formats/readme.md
289
323
  - lib/jekyll_picture_tag/router.rb
290
- - lib/jekyll_picture_tag/source_image.rb
291
324
  - lib/jekyll_picture_tag/srcsets.rb
292
325
  - lib/jekyll_picture_tag/srcsets/basic.rb
293
326
  - lib/jekyll_picture_tag/srcsets/pixel_ratio.rb
@@ -299,7 +332,7 @@ homepage: https://github.com/rbuchberger/jekyll_picture_tag
299
332
  licenses:
300
333
  - BSD-3-Clause
301
334
  metadata: {}
302
- post_install_message:
335
+ post_install_message:
303
336
  rdoc_options: []
304
337
  require_paths:
305
338
  - lib
@@ -317,8 +350,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
350
  - !ruby/object:Gem::Version
318
351
  version: '0'
319
352
  requirements: []
320
- rubygems_version: 3.1.3
321
- signing_key:
353
+ rubygems_version: 3.1.4
354
+ signing_key:
322
355
  specification_version: 4
323
356
  summary: Easy responsive images for Jekyll.
324
357
  test_files: []
@@ -1,32 +0,0 @@
1
- ---
2
- layout: default
3
- ---
4
-
5
- <link href="{{ site.baseurl }}/assets/style.css" rel="stylesheet" type="text/css">
6
-
7
- <ul class="directory">
8
- <li><a href="{{ site.baseurl }}/">Quick Start</a></li>
9
- <li><a href="{{ site.baseurl }}/installation">Installation</a></li>
10
- <li><a href="{{ site.baseurl }}/usage">Usage</a></li>
11
- <li><a href="{{ site.baseurl }}/global_configuration">Global Settings</a></li>
12
- <li><a href="{{ site.baseurl }}/presets">Writing Presets</a></li>
13
- <li><a href="{{ site.baseurl }}/example_presets">Example Presets</a></li>
14
- <li><a href="{{ site.baseurl }}/output">Output Formats</a></li>
15
- <li><a href="{{ site.baseurl }}/notes">Notes and FAQ</a></li>
16
- <li><a href="{{ site.baseurl }}/contributing">Contributing</a></li>
17
- <li><a href="{{ site.baseurl }}/releases">Release History</a></li>
18
- </ul>
19
-
20
- <hr />
21
-
22
- {{ content }}
23
-
24
- <script>
25
- const navItems = Array.from(document.querySelectorAll('ul.directory li'))
26
- const currentPath = window.location.toString()
27
- const activeItem = navItems.find(function(item) {
28
- return item.firstChild.href == currentPath
29
- })
30
-
31
- activeItem.classList.add('active')
32
- </script>
@@ -1,31 +0,0 @@
1
- @media (max-width: 600px) {
2
- ul.directory {
3
- flex-direction: column;
4
- align-items: center;
5
- }
6
- }
7
-
8
- ul.directory {
9
- display: flex;
10
- flex-wrap: wrap;
11
- justify-content: center;
12
- list-style: none;
13
- padding-left: 0;
14
- flex-grow: 0;
15
- }
16
-
17
- ul.directory li {
18
- margin: .3em;
19
- }
20
-
21
- ul.directory a {
22
- line-height: 2;
23
- padding: 8px 20px;
24
- }
25
-
26
- li.active a {
27
- border-radius: 3px;
28
- background-color: #007edf;
29
- color: #fff;
30
- box-shadow: 2px 2px 3px #999;
31
- }
@@ -1,109 +0,0 @@
1
- ---
2
- ---
3
- # Contributing
4
-
5
- Bug reports, feature requests, and feedback are very welcome, either through github issues or via
6
- email: robert@buchberger.cc
7
-
8
- Pull requests are encouraged! I'm happy to answer questions and provide assistance along the way.
9
- Don't let any of the recommendations/requests in this guide stop you from submitting one.
10
-
11
- ## Setup
12
-
13
- It's pretty standard:
14
-
15
- ```
16
- $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git
17
- $ cd jekyll_picture_tag
18
- $ bundle install
19
- ```
20
-
21
- ## Testing
22
-
23
- You probably only need to use docker if it's inconvenient to install ImageMagick 7.
24
-
25
- ### Bare Metal
26
-
27
- `rake test` runs the test suite (both unit tests and integration tests). Ignore the mini_magick
28
- `method redefined` warnings (unless you know how to fix them?)
29
-
30
- `rake unit` runs just the unit tests, while `rake integration` runs the integration tests. The unit
31
- test coverage isn't stellar, but both unit and integration tests together hit 100%.
32
-
33
- Speaking of coverage, simplecov is set up -- you'll get a measurement of coverage in the test output
34
- and a nice report in the `coverage` directory. I'd like to move to mutation based coverage testing,
35
- but that's a project for another day.
36
-
37
- The tests do output a few images to the `/tmp/` directory, which I'm pretty sure means it won't work
38
- on Windows. This is fixable if there is a need, so if that gets in your way just ask.
39
-
40
- `rake rubocop` checks code formatting, `rake rubocop:auto_correct` will try to fix any rubocop
41
- issues, if possible.
42
-
43
- `rake` will run all tests and rubocop.
44
-
45
- ### Docker
46
-
47
- The following commands will build and run the tests inside a docker image. This is useful if it's
48
- inconvenient to install ImageMagick 7, or to ensure the Travis CI build will succeed:
49
-
50
- ```
51
- $ docker build . -t jpt
52
- $ docker run -t jpt
53
- ```
54
-
55
- ## Docs
56
-
57
- I think one of the biggest opportunities for improvement in this plugin is its documentation. I'd
58
- really love help here, and all you need to know is markdown.
59
-
60
- It runs on github pages, which is based on jekyll. You can preview as you edit:
61
-
62
- 0. Follow setup instructions above
63
- 1. `$ cd docs`
64
- 2. `$ bundle install`
65
- 3. `$ bundle exec jekyll serve`
66
- 4. In a web browser, navigate to `localhost:4000/jekyll_picture_tag/`
67
-
68
- ## Code Guidelines
69
-
70
- * Generally, go for straightforward and readable rather than terse and clever. I'm not actually a
71
- very good programmer; I need simple code that's easy to understand.
72
-
73
- * Refactoring is welcome, especially in the name of the previous point.
74
-
75
- * I'm very reluctant to introduce breaking changes to configuration settings. This rule isn't
76
- absolute, but I'm not going to do it without a good reason.
77
-
78
- * I've been using 80 characters for code and 100 characters for documentation.
79
-
80
- * Don't disable cops without strong justification.
81
-
82
- * I generally try to write tests before writing code, especially when fixing bugs. This
83
- gives us some confidence that what we think we're testing and what we're actually testing aren't
84
- too different.
85
-
86
- ## Hard rules
87
-
88
- These aren't the rules for submitting a pull request, these are the rules for merging into master.
89
- I'm thrilled to receive any help at all, and I'm more than happy to help with meeting these
90
- criteria:
91
-
92
- * Liquid tag syntax can only be extended; no breaking changes. I'm not willing to force
93
- users to dig through their entire site and change every picture tag in order to update to the
94
- latest version.
95
-
96
- * Maintain "no configuration required" - a new user must be able to add JPT to their gemfile, bundle
97
- install, and start writing picture tags in their site without touching a yml file.
98
-
99
- * 100% test coverage (Meaning that when running the unit and integration tests together, every line
100
- of code in the `lib` folder must run at least once.)
101
-
102
- * No failing tests
103
-
104
- * No rubocop warnings
105
-
106
- ### Thanks!
107
-
108
- As I said, don't let any of the rules & guidelines scare you away. They're the rules for merging
109
- into master, not submitting a pull request. I'm thrilled to receive any help at all.