nanoc-core 4.11.23 → 4.12.0

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: 54d0d10c4eecdb49a2507a9bcee39269b3a1e444968732d27a4f3bdafe7ff484
4
- data.tar.gz: 712ae47087f51a2087f03368b6f8206b4a8e4fc3959e09f5d7412e85862a089b
3
+ metadata.gz: 3785b5628c2b36382f5c6eed88988943304f6d4e8555a4a72c769b11e8f9a21e
4
+ data.tar.gz: cb562257783d0a0d351822b25c19f9172e134a9910b2fd475ec27a2aa6a13321
5
5
  SHA512:
6
- metadata.gz: 7dfaad676897abbe8eaca4478993c4e5856338cb2cafa2df1fef19d6919be0c8cc3f8e0f8e8edec318d6fd5bcc43215ff525398250943422b59c6c0d0a48ff17
7
- data.tar.gz: 260b429bde3ed4c72425410c177b598e9f97239addceff6fecbb42e180c22776377a314c5d7be10e26934431086e2d90134a02d8f0ed8bc0ed01fbffa72a3eba
6
+ metadata.gz: 5386cce963813faa6c3ac38936b8b2ffce7e3fc94297b5f663a4b8b76df9590e62ee891013abfe665f5f2c06bd14cc754b3c56cbf473b38a079a97eab0e11900
7
+ data.tar.gz: a038f93b08e01ecad024545e97fde14627c1522ed546d6f2cfebdb06f348ad3fdc4fbb2743d8dbe0a658333ba996a91d2f559bbfd8dbd7e5045d35f07b3302ba
data/lib/nanoc/core.rb CHANGED
@@ -77,14 +77,6 @@ require_relative 'core/core_ext/array'
77
77
  require_relative 'core/core_ext/hash'
78
78
  require_relative 'core/core_ext/string'
79
79
 
80
- # Tracking issue:
81
- # https://github.com/nanoc/features/issues/24
82
- Nanoc::Core::Feature.define('live_cmd', version: '4.11')
83
-
84
80
  # Tracking issue:
85
81
  # 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')
82
+ Nanoc::Core::Feature.define('toml', version: '4.12')
@@ -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
@@ -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
@@ -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.23'
5
+ VERSION = '4.12.0'
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.23
4
+ version: 4.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-16 00:00:00.000000000 Z
11
+ date: 2021-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -314,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
314
  - !ruby/object:Gem::Version
315
315
  version: '0'
316
316
  requirements: []
317
- rubygems_version: 3.2.5
317
+ rubygems_version: 3.2.11
318
318
  signing_key:
319
319
  specification_version: 4
320
320
  summary: Core of Nanoc