nanoc-core 4.11.21 → 4.12.2

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: a9f63cf9ed0953520b811eb964d1b71cad082bc07f945c5b9c838a3730dc9cc2
4
- data.tar.gz: 58e44db73eb2a9fdd8959964802b78570e15ddc2e4ae8afd2a5da9161da06c61
3
+ metadata.gz: c4a5b22f92ecd2425faeae4cbb597dee48846a8507e5c00673478c4146d99b60
4
+ data.tar.gz: b384739256cd987cbbdead7820fcfa3b48a0dff9aacbc632b48bdf9daf77305c
5
5
  SHA512:
6
- metadata.gz: b4d4b9458fc23a57bb961c0ed9ff31dd82b43f243cf92d2c45424efda54d3ccacab16be0fd36805f606958eb9167b6537c178ff23c15947f2a2f667bd9901f40
7
- data.tar.gz: 4668c6c8188d5c885829421d4d4e3564146f9f935576be13daed38410ca7537781545d2f44f4c3a44fdb1c145d1331baf84526b37732f85cdfb9e1e77ce3ccdd
6
+ metadata.gz: 4c06b89e2b6e699c07cf8a3da87755d15b03e05f368a1823eaa31165822dc258221c08048505a23e64cf412cbafda1425eaf2b6a93fee833351bf1f7ed4caa2c
7
+ data.tar.gz: a0108e0a31c98c277a5306d55ec0f666b2e87717a9f0355813c5d66a5410392bbc145a4a8a6b13f8fb1be849a1c1275804c9ac53ae60f0e350d33d6dd8a23516
data/lib/nanoc/core.rb CHANGED
@@ -16,7 +16,6 @@ require 'ddmetrics'
16
16
  require 'ddplugin'
17
17
  require 'hamster'
18
18
  require 'slow_enumerator_tools'
19
- require 'tomlrb'
20
19
  require 'tty-platform'
21
20
  require 'zeitwerk'
22
21
 
@@ -39,7 +38,7 @@ module Nanoc
39
38
  #
40
39
  # @api private
41
40
  def self.version_information
42
- "Nanoc #{Nanoc::VERSION} © 2007–2019 Denis Defreyne.\n" \
41
+ "Nanoc #{Nanoc::VERSION} © 2007–2021 Denis Defreyne.\n" \
43
42
  "Running #{RUBY_ENGINE} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} with RubyGems #{Gem::VERSION}.\n"
44
43
  end
45
44
 
@@ -76,15 +75,3 @@ loader.eager_load
76
75
  require_relative 'core/core_ext/array'
77
76
  require_relative 'core/core_ext/hash'
78
77
  require_relative 'core/core_ext/string'
79
-
80
- # Tracking issue:
81
- # https://github.com/nanoc/features/issues/24
82
- Nanoc::Core::Feature.define('live_cmd', version: '4.11')
83
-
84
- # Tracking issue:
85
- # https://github.com/nanoc/features/issues/40
86
- Nanoc::Core::Feature.define('toml', version: '4.11')
87
-
88
- # Tracking issue:
89
- # https://github.com/nanoc/features/issues/20
90
- Nanoc::Core::Feature.define('binary_compiled_content_cache', version: '4.11')
@@ -11,7 +11,7 @@ module Nanoc
11
11
 
12
12
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
13
13
  def initialize(config:)
14
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'binary_content'), 1)
14
+ super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'binary_content'), 2)
15
15
 
16
16
  @cache = {}
17
17
  end
@@ -49,6 +49,11 @@ module Nanoc
49
49
  rep_cache = @cache[rep.item.identifier][rep.name]
50
50
 
51
51
  content.each do |snapshot, binary_content|
52
+ # Check
53
+ if Nanoc::Core::ContractsSupport.enabled? && !File.file?(binary_content.filename)
54
+ raise Nanoc::Core::Errors::InternalInconsistency, "Binary content at #{binary_content.filename.inspect} does not exist, but is expected to."
55
+ end
56
+
52
57
  filename = build_filename(rep, snapshot)
53
58
  rep_cache[snapshot] = filename
54
59
 
@@ -57,12 +62,8 @@ module Nanoc
57
62
  next if binary_content.filename == filename
58
63
 
59
64
  # Copy
60
- #
61
- # NOTE: hardlinking is not an option in this case, because hardlinking
62
- # would make it possible for the content to be (inadvertently)
63
- # changed outside of Nanoc.
64
65
  FileUtils.mkdir_p(File.dirname(filename))
65
- FileUtils.cp(binary_content.filename, filename)
66
+ smart_cp(binary_content.filename, filename)
66
67
  end
67
68
  end
68
69
 
@@ -123,6 +124,26 @@ module Nanoc
123
124
  string_to_path_component(snapshot_name.to_s),
124
125
  )
125
126
  end
127
+
128
+ # NOTE: Similar to ItemRepWriter#smart_cp (but without hardlinking)
129
+ def smart_cp(from, to)
130
+ # NOTE: hardlinking is not an option in this case, because hardlinking
131
+ # would make it possible for the content to be (inadvertently)
132
+ # changed outside of Nanoc.
133
+
134
+ # Try clonefile
135
+ if defined?(Clonefile)
136
+ FileUtils.rm_f(to)
137
+ begin
138
+ res = Clonefile.always(from, to)
139
+ return if res
140
+ rescue Clonefile::UnsupportedPlatform, Errno::ENOTSUP, Errno::EXDEV, Errno::EINVAL
141
+ end
142
+ end
143
+
144
+ # Fall back to old-school copy
145
+ FileUtils.cp(from, to)
146
+ end
126
147
  end
127
148
  end
128
149
  end
@@ -34,7 +34,7 @@ module Nanoc
34
34
  if res
35
35
  start = Time.now
36
36
  sleep 0.05 until File.file?(res) || Time.now - start > FILE_APPEAR_TIMEOUT
37
- raise Nanoc::Core::Errors::InternalInconsistency, "File did not apear in time: #{res}" unless File.file?(res)
37
+ raise Nanoc::Core::Errors::InternalInconsistency, "File raw_path did not appear in time (#{FILE_APPEAR_TIMEOUT}s): #{res}" unless File.file?(res)
38
38
  end
39
39
 
40
40
  res
@@ -36,12 +36,7 @@ module Nanoc
36
36
  end
37
37
 
38
38
  def compiled_content_cache_class
39
- feature_name = Nanoc::Core::Feature::BINARY_COMPILED_CONTENT_CACHE
40
- if Nanoc::Core::Feature.enabled?(feature_name)
41
- Nanoc::Core::CompiledContentCache
42
- else
43
- Nanoc::Core::TextualCompiledContentCache
44
- end
39
+ Nanoc::Core::CompiledContentCache
45
40
  end
46
41
  end
47
42
  end
@@ -29,12 +29,7 @@ module Nanoc
29
29
 
30
30
  # @return [String]
31
31
  def self.config_filename_for_cwd
32
- filenames =
33
- if Nanoc::Core::Feature.enabled?(Nanoc::Core::Feature::TOML)
34
- %w[nanoc.yaml config.yaml nanoc.toml]
35
- else
36
- %w[nanoc.yaml config.yaml]
37
- end
32
+ filenames = %w[nanoc.yaml config.yaml]
38
33
  candidate = filenames.find { |f| File.file?(f) }
39
34
  candidate && File.expand_path(candidate)
40
35
  end
@@ -59,14 +54,7 @@ module Nanoc
59
54
  end
60
55
 
61
56
  def load_file(filename)
62
- case File.extname(filename)
63
- when '.yaml'
64
- YAML.load_file(filename)
65
- when '.toml'
66
- Tomlrb.load_file(filename)
67
- else
68
- raise Nanoc::Core::Errors::InternalInconsistency, 'Unhandled config file extension'
69
- end
57
+ YAML.load_file(filename)
70
58
  end
71
59
 
72
60
  # @api private
@@ -96,7 +96,8 @@ module Nanoc
96
96
  false
97
97
  end
98
98
 
99
- @_contracts_support__should_enable = contracts_loadable && !ENV.key?('DISABLE_CONTRACTS')
99
+ # FIXME: Do something better with contracts on Ruby 3.x
100
+ @_contracts_support__should_enable = contracts_loadable && !RUBY_VERSION.start_with?('3') && !ENV.key?('DISABLE_CONTRACTS')
100
101
 
101
102
  if @_contracts_support__should_enable
102
103
  # FIXME: ugly
@@ -11,7 +11,7 @@ module Nanoc
11
11
 
12
12
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
13
13
  def initialize(config:)
14
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'compiled_content'), 2)
14
+ super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'compiled_content'), 3)
15
15
 
16
16
  @cache = {}
17
17
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.11.21'
5
+ VERSION = '4.12.2'
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.11.21
4
+ version: 4.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-18 00:00:00.000000000 Z
11
+ date: 2021-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.0'
111
- - !ruby/object:Gem::Dependency
112
- name: tomlrb
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.2'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.2'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: tty-platform
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -299,23 +285,23 @@ homepage: https://nanoc.ws/
299
285
  licenses:
300
286
  - MIT
301
287
  metadata: {}
302
- post_install_message:
288
+ post_install_message:
303
289
  rdoc_options: []
304
290
  require_paths:
305
291
  - lib
306
292
  required_ruby_version: !ruby/object:Gem::Requirement
307
293
  requirements:
308
- - - "~>"
294
+ - - ">="
309
295
  - !ruby/object:Gem::Version
310
- version: '2.4'
296
+ version: '2.6'
311
297
  required_rubygems_version: !ruby/object:Gem::Requirement
312
298
  requirements:
313
299
  - - ">="
314
300
  - !ruby/object:Gem::Version
315
301
  version: '0'
316
302
  requirements: []
317
- rubygems_version: 3.2.2
318
- signing_key:
303
+ rubygems_version: 3.2.18
304
+ signing_key:
319
305
  specification_version: 4
320
306
  summary: Core of Nanoc
321
307
  test_files: []