nanoc 4.12.4 → 4.12.7

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
  SHA256:
3
- metadata.gz: 437153302bf3976f9e3187df89dec7ef4da2f63a4bafe681adefbe348a06d31d
4
- data.tar.gz: 40b66e18acae6aeb83de12c47f9672aac6c2135e536b74f0a06c8fa73acf95f3
3
+ metadata.gz: fdb0492ec48bece377285f3e02e3cec63ec48af4542c4aa55006e3bb1b06a6e9
4
+ data.tar.gz: 8daf5631e1711f91e6ed2c2f571f456d12140fb4285def555f0d18e4b311ad5b
5
5
  SHA512:
6
- metadata.gz: 1210addd31a8f1e795d67bc8371e97f594cb6950374514f1e7a641635816c1923468588e2d63b26f86c12c537bc4b3b4ecee01694acc99f403b787c606518d8a
7
- data.tar.gz: 3e1ab8785fffb97d55274196e509aaf1dceda6e080b852e639316eb0fc5e9f86dcbf243bda070dc478452e46fd4a6c70af9e42d36c095cc0570a61a07d5eeec6
6
+ metadata.gz: ebb45b98247466d11385db0285d1e24d210c6aeb037bbbbe10b655dfdfcfdd05f80206c7282b5cfb4bcb69bbeb16ce73355423b43111905edd49a1c062b7c5bf
7
+ data.tar.gz: ff4219588e17be3de27c20e0fdaa76036587e94b6b204480baffc06786d5ad1a79ae0280297ec01e9af50fa580d2541d7178eb1ae2c9b5bc16a02065c4545f61
data/NEWS.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.12.7 (2022-06-06)
4
+
5
+ Fixes:
6
+
7
+ - Dropped support for incompatible Psych versions (#1577, #1583)
8
+
9
+ Enhancements:
10
+
11
+ - Replaced UglifyJS (unmaintained) with Terser (#1578, #1579)
12
+ - Dropped support for Ruby 2.6 (EOL) (#1580)
13
+
14
+ ## 4.12.6 (2022-05-28)
15
+
16
+ Fixes:
17
+
18
+ - Fixed a crash in `nanc view` when a TUN device is present (#1567) [Sergio Durigan Junior]
19
+ - Fixed a crash when content/ has non-writable binary files (#1576)
20
+ - Fixed inconsistency in allowed YAML classes in metadata (#1574) [Daniel Aleksandersen]
21
+
22
+ ## 4.12.5 (2022-01-22)
23
+
24
+ Fixes:
25
+
26
+ - Prefer YAML.safe_load over YAML.load (#1566)
27
+
28
+ Enhancements:
29
+
30
+ - Added `Time` to the list of permitted classes for YAML (#1565) [Hideaki Nagamine]
31
+
3
32
  ## 4.12.4 (2022-01-15)
4
33
 
5
34
  Fixes:
@@ -4,7 +4,7 @@
4
4
  class Nanoc::DataSources::Filesystem
5
5
  class Parser
6
6
  SEPARATOR = /(-{5}|-{3})/.source
7
- PERMITTED_YAML_CLASSES = [Symbol, Date].freeze
7
+ PERMITTED_YAML_CLASSES = Nanoc::Core::ConfigLoader::PERMITTED_YAML_CLASSES
8
8
 
9
9
  class ParseResult
10
10
  attr_reader :content
@@ -61,7 +61,7 @@ class Nanoc::DataSources::Filesystem
61
61
  # @return [Hash]
62
62
  def parse_metadata(data, filename)
63
63
  begin
64
- meta = YAML.load(data, permitted_classes: PERMITTED_YAML_CLASSES) || {}
64
+ meta = YAML.safe_load(data, permitted_classes: PERMITTED_YAML_CLASSES) || {}
65
65
  rescue => e
66
66
  raise Errors::UnparseableMetadata.new(filename, e)
67
67
  end
@@ -48,6 +48,8 @@ module Nanoc::DataSources
48
48
  #
49
49
  # @api private
50
50
  class Filesystem < Nanoc::DataSource
51
+ PERMITTED_YAML_CLASSES = Nanoc::Core::ConfigLoader::PERMITTED_YAML_CLASSES
52
+
51
53
  class AmbiguousMetadataAssociationError < ::Nanoc::Core::Error
52
54
  def initialize(content_filenames, meta_filename)
53
55
  super("There are multiple content files (#{content_filenames.sort.join(', ')}) that could match the file containing metadata (#{meta_filename}).")
@@ -116,7 +118,7 @@ module Nanoc::DataSources
116
118
  attr_reader :is_binary
117
119
  alias binary? is_binary
118
120
 
119
- def initialize(is_binary:, content: nil, filename: nil, attributes:, content_checksum_data: nil, attributes_checksum_data: nil)
121
+ def initialize(is_binary:, attributes:, content: nil, filename: nil, content_checksum_data: nil, attributes_checksum_data: nil)
120
122
  if content.nil? && filename.nil?
121
123
  raise ArgumentError, '#initialize needs at least content or filename'
122
124
  end
@@ -150,7 +152,7 @@ module Nanoc::DataSources
150
152
  is_binary = content_filename && !@site_config[:text_extensions].include?(File.extname(content_filename)[1..-1])
151
153
 
152
154
  if is_binary && klass == Nanoc::Core::Item
153
- meta = (meta_filename && YAML.load_file(meta_filename)) || {}
155
+ meta = (meta_filename && YAML.safe_load_file(meta_filename, permitted_classes: PERMITTED_YAML_CLASSES)) || {}
154
156
 
155
157
  ProtoDocument.new(is_binary: true, filename: content_filename, attributes: meta)
156
158
  elsif is_binary && klass == Nanoc::Core::Layout
@@ -318,10 +320,8 @@ module Nanoc::DataSources
318
320
  raise Errors::MultipleMetaFiles.new(meta_filenames, basename)
319
321
  end
320
322
 
321
- unless config[:identifier_type] == 'full'
322
- unless [0, 1].include?(content_filenames.size)
323
- raise Errors::MultipleContentFiles.new(meta_filenames, basename)
324
- end
323
+ if (config[:identifier_type] != 'full') && ![0, 1].include?(content_filenames.size)
324
+ raise Errors::MultipleContentFiles.new(meta_filenames, basename)
325
325
  end
326
326
 
327
327
  all[basename] = []
@@ -2,22 +2,23 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @api private
5
- class UglifyJS < Nanoc::Filter
5
+ class Terser < Nanoc::Filter
6
+ identifier :terser
6
7
  identifier :uglify_js
7
8
 
8
- requires 'uglifier'
9
+ requires 'terser'
9
10
 
10
- # Runs the content through [UglifyJS](https://github.com/mishoo/UglifyJS2/).
11
- # This method optionally takes options to pass directly to Uglifier.
11
+ # Runs the content through [terser](https://github.com/ahorek/terser-ruby).
12
+ # This method optionally takes options to pass directly to Terser.
12
13
  #
13
14
  # @param [String] content The content to filter
14
15
  #
15
- # @option params [Array] :options ([]) A list of options to pass on to Uglifier
16
+ # @option params [Array] :options ([]) A list of options to pass on to Terser
16
17
  #
17
18
  # @return [String] The filtered content
18
19
  def run(content, params = {})
19
20
  # Add filename to load path
20
- Uglifier.new(params).compile(content)
21
+ ::Terser.new(params).compile(content)
21
22
  end
22
23
  end
23
24
  end
data/lib/nanoc/filters.rb CHANGED
@@ -30,6 +30,6 @@ require_relative 'filters/rubypants'
30
30
  require_relative 'filters/sass'
31
31
  require_relative 'filters/slim'
32
32
  require_relative 'filters/typogruby'
33
- require_relative 'filters/uglify_js'
33
+ require_relative 'filters/terser'
34
34
  require_relative 'filters/xsl'
35
35
  require_relative 'filters/yui_compressor'
data/lib/nanoc/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.12.4'
5
+ VERSION = '4.12.7'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.4
4
+ version: 4.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-15 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.0.2
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,34 +55,37 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '1.0'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.0.2
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: nanoc-cli
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - '='
60
66
  - !ruby/object:Gem::Version
61
- version: 4.12.4
67
+ version: 4.12.7
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - '='
67
73
  - !ruby/object:Gem::Version
68
- version: 4.12.4
74
+ version: 4.12.7
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: nanoc-core
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - '='
74
80
  - !ruby/object:Gem::Version
75
- version: 4.12.4
81
+ version: 4.12.7
76
82
  type: :runtime
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - '='
81
87
  - !ruby/object:Gem::Version
82
- version: 4.12.4
88
+ version: 4.12.7
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: nanoc-deploying
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -191,8 +197,8 @@ files:
191
197
  - lib/nanoc/filters/sass/functions.rb
192
198
  - lib/nanoc/filters/sass/importer.rb
193
199
  - lib/nanoc/filters/slim.rb
200
+ - lib/nanoc/filters/terser.rb
194
201
  - lib/nanoc/filters/typogruby.rb
195
- - lib/nanoc/filters/uglify_js.rb
196
202
  - lib/nanoc/filters/xsl.rb
197
203
  - lib/nanoc/filters/yui_compressor.rb
198
204
  - lib/nanoc/helpers.rb
@@ -237,14 +243,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
243
  requirements:
238
244
  - - ">="
239
245
  - !ruby/object:Gem::Version
240
- version: '2.6'
246
+ version: '2.7'
241
247
  required_rubygems_version: !ruby/object:Gem::Requirement
242
248
  requirements:
243
249
  - - ">="
244
250
  - !ruby/object:Gem::Version
245
251
  version: '0'
246
252
  requirements: []
247
- rubygems_version: 3.3.4
253
+ rubygems_version: 3.3.15
248
254
  signing_key:
249
255
  specification_version: 4
250
256
  summary: A static-site generator with a focus on flexibility.