nanoc-core 4.12.6 → 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: d49707fbc3c897e11757663c5d79f8b75349b34ac7e110f2609b59c080214b20
4
- data.tar.gz: d2b88897dd12e0d4cbedbde6a8fde5bcf61613adceb7214589d6f7b3d8fa90fc
3
+ metadata.gz: 1fb5a347a2a973a7c42b1f85746b5267b43c588bf627c4f813c09c3a23b8e7eb
4
+ data.tar.gz: f03ba79aea51348eca0a83c80e3bef8a5853da59981205939b7d417588dd3678
5
5
  SHA512:
6
- metadata.gz: e9c958ab4f52a499a95d483dbea86b8e1e2a0fbe41cddd29a46b13b3dd5c2d95924df6b216798c43cf9565be67084ce4cba19da33ffc7f022b61250f839f1141
7
- data.tar.gz: 1679adcebcdc5380ceac677ad11460db995cd5b8c0491cb484b69c9ae0b6e98aa1a06fb87f662a6653641020120fde2288c8e75e3f94632b422b0d4858d906ef
6
+ metadata.gz: '0211852d5d7069d0dec63609db20a2cf533ba167e71ab08e195e333abea2cb17ecce34b05c4c65cd0be84c1726389caae8f02313188641a980e1aa6622f47619'
7
+ data.tar.gz: d3f7d023ce5855b2e2b67c2e49132b60aaec1f8cc71bf7163b2d1a2492304fccf932a2252e0ea1546c4694a83168395195dae444c530ad641c37d5f45e0a9673
@@ -46,16 +46,16 @@ module Nanoc
46
46
  end
47
47
 
48
48
  # contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
49
- def each
50
- @actions.each { |a| yield(a) }
49
+ def each(&block)
50
+ @actions.each(&block)
51
51
  self
52
52
  end
53
53
 
54
54
  # contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
55
- def map
55
+ def map(&block)
56
56
  self.class.new(
57
57
  @item_rep,
58
- actions: @actions.map { |a| yield(a) },
58
+ actions: @actions.map(&block),
59
59
  )
60
60
  end
61
61
  end
@@ -33,7 +33,7 @@ module Nanoc
33
33
 
34
34
  # @see Object#hash
35
35
  def hash
36
- self.class.hash ^ item.identifier.hash ^ name.hash
36
+ [self.class, item.identifier, name].hash
37
37
  end
38
38
 
39
39
  # @return [Symbol]
@@ -38,16 +38,16 @@ module Nanoc
38
38
  @listener&.to_stop&.call
39
39
  end
40
40
 
41
- def map
42
- self.class.new(enum: @enum.map { |e| yield(e) })
41
+ def map(&block)
42
+ self.class.new(enum: @enum.map(&block))
43
43
  end
44
44
 
45
45
  def to_enum
46
46
  @enum
47
47
  end
48
48
 
49
- def each
50
- @enum.each { |e| yield(e) }
49
+ def each(&block)
50
+ @enum.each(&block)
51
51
  nil
52
52
  end
53
53
  end
@@ -10,8 +10,8 @@ module Nanoc
10
10
  DONE = Object.new
11
11
 
12
12
  contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
13
- def run(rep, is_outdated:)
14
- fiber = fiber_for(rep, is_outdated: is_outdated) { yield }
13
+ def run(rep, is_outdated:, &block)
14
+ fiber = fiber_for(rep, is_outdated: is_outdated, &block)
15
15
  while fiber.alive?
16
16
  res = fiber.resume
17
17
 
@@ -84,11 +84,9 @@ module Nanoc
84
84
  outdatedness_store: @outdatedness_store,
85
85
  )
86
86
 
87
- notify_phrase = Nanoc::Core::CompilationPhases::Notify.new(
87
+ Nanoc::Core::CompilationPhases::Notify.new(
88
88
  wrapped: mark_done_phase,
89
89
  )
90
-
91
- notify_phrase
92
90
  end
93
91
  end
94
92
  end
@@ -4,6 +4,8 @@ module Nanoc
4
4
  module Core
5
5
  # @api private
6
6
  class ConfigLoader
7
+ PERMITTED_YAML_CLASSES = [Symbol, Date, Time].freeze
8
+
7
9
  class NoConfigFileFoundError < ::Nanoc::Core::Error
8
10
  def initialize
9
11
  super('No configuration file found')
@@ -54,7 +56,7 @@ module Nanoc
54
56
  end
55
57
 
56
58
  def load_file(filename)
57
- YAML.load_file(filename)
59
+ YAML.safe_load_file(filename, permitted_classes: PERMITTED_YAML_CLASSES)
58
60
  end
59
61
 
60
62
  # @api private
@@ -45,7 +45,7 @@ module Nanoc
45
45
  NANOC_ENV_DEFAULT = 'default'
46
46
 
47
47
  contract C::KeywordArgs[hash: C::Optional[Hash], env_name: C::Maybe[String], dir: C::AbsolutePathString] => C::Any
48
- def initialize(hash: {}, dir:, env_name: nil)
48
+ def initialize(dir:, hash: {}, env_name: nil)
49
49
  @env_name = env_name
50
50
  @wrapped = hash.__nanoc_symbolize_keys_recursively
51
51
  @dir = dir
@@ -136,8 +136,8 @@ module Nanoc
136
136
  end
137
137
 
138
138
  contract C::Func[C::Any, C::Any => C::Any] => self
139
- def each
140
- @wrapped.each { |k, v| yield(k, v) }
139
+ def each(&block)
140
+ @wrapped.each(&block)
141
141
  self
142
142
  end
143
143
 
@@ -6,7 +6,7 @@ module Nanoc
6
6
  class Ignorer
7
7
  include Singleton
8
8
 
9
- def method_missing(*_args) # rubocop:disable Style/MethodMissingSuper
9
+ def method_missing(*_args)
10
10
  self
11
11
  end
12
12
 
@@ -107,7 +107,7 @@ module Nanoc
107
107
 
108
108
  contract C::None => C::Num
109
109
  def hash
110
- self.class.hash ^ identifier.hash
110
+ [self.class, identifier].hash
111
111
  end
112
112
 
113
113
  contract C::Any => C::Bool
@@ -26,7 +26,7 @@ module Nanoc
26
26
 
27
27
  # @see Object#hash
28
28
  def hash
29
- self.class.hash ^ identifier.hash
29
+ [self.class, identifier].hash
30
30
  end
31
31
 
32
32
  # @return [Nanoc::Core::Identifier]
@@ -88,7 +88,7 @@ module Nanoc
88
88
 
89
89
  contract C::None => C::Num
90
90
  def hash
91
- self.class.hash ^ to_s.hash
91
+ [self.class, to_s].hash
92
92
  end
93
93
 
94
94
  contract C::Any => C::Maybe[C::Num]
@@ -149,10 +149,10 @@ module Nanoc
149
149
 
150
150
  extname = File.extname(@string)
151
151
 
152
- if !extname.empty?
153
- @string[0..-extname.size - 1]
154
- else
152
+ if extname.empty?
155
153
  @string
154
+ else
155
+ @string[0..-extname.size - 1]
156
156
  end
157
157
  end
158
158
 
@@ -171,10 +171,10 @@ module Nanoc
171
171
  # The identifier, as string, with all extensions removed
172
172
  def without_exts
173
173
  extname = exts.join('.')
174
- if !extname.empty?
175
- @string[0..-extname.size - 2]
176
- else
174
+ if extname.empty?
177
175
  @string
176
+ else
177
+ @string[0..-extname.size - 2]
178
178
  end
179
179
  end
180
180
 
@@ -80,15 +80,15 @@ module Nanoc
80
80
  # contract C::ArrayOf[Class], C_OBJ_MAYBE_REP, Nanoc::Core::OutdatednessStatus => C::Maybe[Nanoc::Core::OutdatednessStatus]
81
81
  def apply_rules(rules, obj, status = Nanoc::Core::OutdatednessStatus.new)
82
82
  rules.inject(status) do |acc, rule|
83
- if !acc.useful_to_apply?(rule)
84
- acc
85
- else
83
+ if acc.useful_to_apply?(rule)
86
84
  reason = rule.instance.call(obj, @outdatedness_checker)
87
85
  if reason
88
86
  acc.update(reason)
89
87
  else
90
88
  acc
91
89
  end
90
+ else
91
+ acc
92
92
  end
93
93
  end
94
94
  end
@@ -26,7 +26,7 @@ module Nanoc
26
26
  end
27
27
 
28
28
  def hash
29
- self.class.hash ^ filter_name.hash ^ params.hash
29
+ [self.class, filter_name, params].hash
30
30
  end
31
31
 
32
32
  def ==(other)
@@ -24,7 +24,7 @@ module Nanoc
24
24
  end
25
25
 
26
26
  def hash
27
- self.class.hash ^ layout_identifier.hash ^ params.hash
27
+ [self.class, layout_identifier, params].hash
28
28
  end
29
29
 
30
30
  def ==(other)
@@ -34,7 +34,7 @@ module Nanoc
34
34
  end
35
35
 
36
36
  def hash
37
- self.class.hash ^ snapshot_names.hash ^ paths.hash
37
+ [self.class, snapshot_names, paths].hash
38
38
  end
39
39
 
40
40
  def ==(other)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.12.6'
5
+ VERSION = '4.12.7'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.6
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-05-28 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: concurrent-ruby
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.5'
97
+ - !ruby/object:Gem::Dependency
98
+ name: psych
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: slow_enumerator_tools
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -294,14 +308,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
308
  requirements:
295
309
  - - ">="
296
310
  - !ruby/object:Gem::Version
297
- version: '2.6'
311
+ version: '2.7'
298
312
  required_rubygems_version: !ruby/object:Gem::Requirement
299
313
  requirements:
300
314
  - - ">="
301
315
  - !ruby/object:Gem::Version
302
316
  version: '0'
303
317
  requirements: []
304
- rubygems_version: 3.3.14
318
+ rubygems_version: 3.3.15
305
319
  signing_key:
306
320
  specification_version: 4
307
321
  summary: Core of Nanoc