nanoc-core 4.13.3 → 4.13.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e6c97176b06fc6e36cbe73c77589ec6c745b053b40616da81f36b639869d0f6
4
- data.tar.gz: 407d91dcc36e7435debe7bfd52356cb88b09f5cf23c8d4b539b5497432cbba83
3
+ metadata.gz: 0d269d49a75092d2131bb9862da8891db100ba3706aae5a6e7cb1948e4b6ff08
4
+ data.tar.gz: 9834b81f364302d18b02d541f600a61b14e6cb54cf3e6ae04b083d0301446fcb
5
5
  SHA512:
6
- metadata.gz: 86b66a9cd073606a2a001f1e0ae2ef6f8ba1ece1756791eebf1a609d723714552e759319b84bd34570b63bf6575c9116cf4adc932a8ba230e44a9c4732a3bdb8
7
- data.tar.gz: 14c58ee6fa75b9e1a1101bcad88f261334f6e1eda10bddf423a8d9769b4f27795e683c3a5a614f19a30db37bc6b9d89b69940079371682777ad0d59b3d28d167
6
+ metadata.gz: 3254f48b180e12a753793abde204b252fdb1166cf654692df6f48ea815d0c0e3fdef07af398b1905236cec9c8872e94f9c49ef49c797693dfcdf131ef12b7702
7
+ data.tar.gz: d35cb237c18e1b1349d46623c7790493ec689c1437ddfb86992559b32ff8f5f9ec2a5316acbd46dfc7267bb1d0b6ea4abebef64e9f5fbc73675704fee308640a
@@ -92,10 +92,6 @@ module Nanoc
92
92
  end
93
93
  end
94
94
 
95
- def use_clonefile?
96
- defined?(Clonefile)
97
- end
98
-
99
95
  private
100
96
 
101
97
  def dirname
@@ -136,13 +132,11 @@ module Nanoc
136
132
  # changed outside of Nanoc.
137
133
 
138
134
  # Try clonefile
139
- if use_clonefile?
140
- FileUtils.rm_f(to)
141
- begin
142
- res = Clonefile.always(from, to)
143
- return if res
144
- rescue Clonefile::UnsupportedPlatform, Errno::ENOTSUP, Errno::EXDEV, Errno::EINVAL
145
- end
135
+ FileUtils.rm_f(to)
136
+ begin
137
+ res = Clonefile.always(from, to)
138
+ return if res
139
+ rescue Clonefile::UnsupportedPlatform, Errno::ENOTSUP, Errno::EXDEV, Errno::EINVAL
146
140
  end
147
141
 
148
142
  # Fall back to old-school copy
@@ -41,7 +41,7 @@ module Nanoc
41
41
  end
42
42
 
43
43
  def outdated?(rep)
44
- if @outdatedness_store.include?(rep)
44
+ if @outdatedness_store.include?(rep) # rubocop:disable Style/RedundantCondition
45
45
  # We determined previously that this rep is outdated.
46
46
  true
47
47
  else
@@ -106,6 +106,9 @@
106
106
  "type": "object",
107
107
  "additionalProperties": false,
108
108
  "properties": {
109
+ "user_agent" : {
110
+ "type": "string"
111
+ },
109
112
  "exclude": {
110
113
  "type": "array",
111
114
  "items": {
@@ -44,28 +44,10 @@ module Nanoc
44
44
 
45
45
  contract C_ARGS => C::Any
46
46
  def initialize(raw_content: false, attributes: false, compiled_content: false, path: false)
47
+ @raw_content = raw_content
48
+ @attributes = attributes
47
49
  @compiled_content = compiled_content
48
50
  @path = path
49
-
50
- @attributes =
51
- case attributes
52
- when Set
53
- attributes
54
- when Array
55
- Set.new(attributes)
56
- else
57
- attributes
58
- end
59
-
60
- @raw_content =
61
- case raw_content
62
- when Set
63
- raw_content
64
- when Array
65
- Set.new(raw_content)
66
- else
67
- raw_content
68
- end
69
51
  end
70
52
 
71
53
  contract C::None => String
@@ -77,7 +59,7 @@ module Nanoc
77
59
  s << (compiled_content? ? 'c' : '_')
78
60
  s << (path? ? 'p' : '_')
79
61
 
80
- if @raw_content.is_a?(Set)
62
+ if @raw_content.is_a?(Set) || @raw_content.is_a?(Array)
81
63
  @raw_content.each do |elem|
82
64
  s << '; raw_content('
83
65
  s << elem.inspect
@@ -85,7 +67,7 @@ module Nanoc
85
67
  end
86
68
  end
87
69
 
88
- if @attributes.is_a?(Set)
70
+ if @attributes.is_a?(Set) || @attributes.is_a?(Array)
89
71
  @attributes.each do |elem|
90
72
  s << '; attr('
91
73
  s << elem.inspect
@@ -110,7 +92,7 @@ module Nanoc
110
92
  contract C::None => C::Bool
111
93
  def raw_content?
112
94
  case @raw_content
113
- when Set
95
+ when Array, Set
114
96
  !@raw_content.empty?
115
97
  else
116
98
  @raw_content
@@ -120,7 +102,7 @@ module Nanoc
120
102
  contract C::None => C::Bool
121
103
  def attributes?
122
104
  case @attributes
123
- when Set
105
+ when Array, Set
124
106
  !@attributes.empty?
125
107
  else
126
108
  @attributes
@@ -168,7 +150,7 @@ module Nanoc
168
150
  when false
169
151
  own
170
152
  else
171
- own + other
153
+ Set.new(own + other)
172
154
  end
173
155
  end
174
156
  end
@@ -146,10 +146,10 @@ module Nanoc
146
146
  # Returns the required libraries for this filter.
147
147
  # @return [Enumerable<String>] This filter’s list of library names that are required
148
148
  def requires(*requires)
149
- if requires.any?
150
- @requires = requires
151
- else
149
+ if requires.empty?
152
150
  @requires || []
151
+ else
152
+ @requires = requires
153
153
  end
154
154
  end
155
155
 
@@ -79,13 +79,11 @@ module Nanoc
79
79
 
80
80
  def smart_cp(from, to)
81
81
  # Try clonefile
82
- if defined?(Clonefile)
83
- FileUtils.rm_f(to)
84
- begin
85
- res = Clonefile.always(from, to)
86
- return if res
87
- rescue Clonefile::UnsupportedPlatform, Errno::ENOTSUP, Errno::EXDEV, Errno::EINVAL
88
- end
82
+ FileUtils.rm_f(to)
83
+ begin
84
+ res = Clonefile.always(from, to)
85
+ return if res
86
+ rescue Clonefile::UnsupportedPlatform, Errno::ENOTSUP, Errno::EXDEV, Errno::EINVAL
89
87
  end
90
88
 
91
89
  # Try with hardlink
@@ -45,7 +45,7 @@ module Nanoc
45
45
  contract C_OBJ => C::IterOf[Reasons::Generic]
46
46
  def outdatedness_reasons_for(obj)
47
47
  basic_reasons = basic_outdatedness_statuses.fetch(obj).reasons
48
- if basic_reasons.any?
48
+ if !basic_reasons.empty?
49
49
  basic_reasons
50
50
  elsif outdated_due_to_dependencies?(obj)
51
51
  [Reasons::DependenciesOutdated]
@@ -134,7 +134,7 @@ module Nanoc
134
134
 
135
135
  def attributes_unaffected?(status, dependency)
136
136
  reason = status.reasons.find { |r| r.is_a?(Nanoc::Core::OutdatednessReasons::AttributesModified) }
137
- reason && dependency.props.attribute_keys.any? && (dependency.props.attribute_keys & reason.attributes).empty?
137
+ reason && !dependency.props.attribute_keys.empty? && (dependency.props.attribute_keys & reason.attributes).empty?
138
138
  end
139
139
 
140
140
  def raw_content_prop_causes_outdatedness?(objects, raw_content_prop)
@@ -175,7 +175,7 @@ module Nanoc
175
175
  def attributes_prop_causes_outdatedness?(objects, attributes_prop)
176
176
  return false unless attributes_prop
177
177
 
178
- unless attributes_prop.is_a?(Set)
178
+ unless attributes_prop.is_a?(Set) || attributes_prop.is_a?(Array)
179
179
  raise(
180
180
  Nanoc::Core::Errors::InternalInconsistency,
181
181
  'expected attributes_prop to be a Set',
@@ -184,7 +184,7 @@ module Nanoc
184
184
 
185
185
  pairs = attributes_prop.select { |a| a.is_a?(Array) }.to_h
186
186
 
187
- unless pairs.any?
187
+ if pairs.empty?
188
188
  raise(
189
189
  Nanoc::Core::Errors::InternalInconsistency,
190
190
  'expected attributes_prop not to be empty',
@@ -28,7 +28,7 @@ module Nanoc
28
28
  attributes = Set.new(old_checksums.keys) + Set.new(new_checksums.keys)
29
29
  changed_attributes = attributes.reject { |a| old_checksums[a] == new_checksums[a] }
30
30
 
31
- if changed_attributes.any?
31
+ unless changed_attributes.empty?
32
32
  Nanoc::Core::OutdatednessReasons::AttributesModified.new(changed_attributes)
33
33
  end
34
34
  else
@@ -29,6 +29,11 @@ module Nanoc
29
29
  raise NotImplementedError
30
30
  end
31
31
 
32
+ contract C::Any => C::Bool
33
+ def ===(other)
34
+ match?(other)
35
+ end
36
+
32
37
  def captures(_identifier)
33
38
  raise NotImplementedError
34
39
  end
@@ -70,7 +70,7 @@ module Nanoc
70
70
 
71
71
  def code_snippets_from_config(config)
72
72
  config[:lib_dirs].flat_map do |lib|
73
- Dir["#{lib}/**/*.rb"].sort.map do |filename|
73
+ Dir["#{File.expand_path(lib)}/**/*.rb"].sort.map do |filename|
74
74
  Nanoc::Core::CodeSnippet.new(
75
75
  read_code_snippet_contents(filename),
76
76
  filename,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.13.3'
5
+ VERSION = '4.13.4'
6
6
  end
7
7
  end
data/lib/nanoc/core.rb CHANGED
@@ -10,6 +10,7 @@ require 'yaml'
10
10
  require 'zlib'
11
11
 
12
12
  # External gems
13
+ require 'clonefile'
13
14
  require 'concurrent-ruby'
14
15
  require 'json_schema'
15
16
  require 'ddmetrics'
@@ -20,13 +21,6 @@ require 'slow_enumerator_tools'
20
21
  require 'tty-platform'
21
22
  require 'zeitwerk'
22
23
 
23
- # External gems (optional)
24
- begin
25
- require 'clonefile'
26
- rescue LoadError
27
- # ignore
28
- end
29
-
30
24
  module Nanoc
31
25
  module Core
32
26
  # Similar to `nil` except that it can only be compared against using
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.13.3
4
+ version: 4.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: base64
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0.2'
26
+ - !ruby/object:Gem::Dependency
27
+ name: clonefile
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.5.3
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.5.3
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: concurrent-ruby
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -303,8 +316,7 @@ licenses:
303
316
  - MIT
304
317
  metadata:
305
318
  rubygems_mfa_required: 'true'
306
- source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.13.3/nanoc-core
307
- post_install_message:
319
+ source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.13.4/nanoc-core
308
320
  rdoc_options: []
309
321
  require_paths:
310
322
  - lib
@@ -319,8 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
331
  - !ruby/object:Gem::Version
320
332
  version: '0'
321
333
  requirements: []
322
- rubygems_version: 3.5.22
323
- signing_key:
334
+ rubygems_version: 3.6.7
324
335
  specification_version: 4
325
336
  summary: Core of Nanoc
326
337
  test_files: []