nanoc-core 4.11.19 → 4.11.20

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: a5609a4d82cab318b327443ab017ec28ace7a23f0766176df6e289c7c757138e
4
- data.tar.gz: 4646c4338db2b0fe0a46b0b604205796c154d51c7f5f77c5b59d2031fd806877
3
+ metadata.gz: ac94fc2464196846d4d6b38fb9a3ee02d0566aaa16f4f192e63f7989af937dc0
4
+ data.tar.gz: 0ba05d8ccb6d2cb10a8ec2909bb9bd99dee5203272c24cd02fdc6c6d4041dd17
5
5
  SHA512:
6
- metadata.gz: d387e1b5fbd4ed31ac03f6eb0510238f4e8e92a615b1c38351fa2e7c1f785e7f2d9ac013c51c48a1f0f6e32a02c8b49d20f9a48e324ed07bc45c054246cdda62
7
- data.tar.gz: 6789e6da893cb64eb032c110f244de514c56143df96c8865b2a2903ffcbbbb2a242c60ee46eca40fb3bb1e77e11c1febdc7ebbe675d428ce9e41e419f5683f0d
6
+ metadata.gz: b76254a60ba5cc2d94f0dc6a01498b51fa22c068ba6ee93c6434cee1105a29922f664c08090b155b18a9016b065fb854f60dc38a57f2effa6b1a6a1c1d94aeee
7
+ data.tar.gz: 314da571f7e0b49544152e66dc1bc9b30ae49911b0f8aeaf863d23731294ffe33e7b21977a2238f619396119ab6b7a635453e80544ccaf0193e7a94495d34313
@@ -9,6 +9,7 @@ require 'tmpdir'
9
9
  require 'yaml'
10
10
 
11
11
  # External gems
12
+ require 'clonefile'
12
13
  require 'concurrent-ruby'
13
14
  require 'json_schema'
14
15
  require 'ddmemoize'
@@ -62,11 +62,7 @@ module Nanoc
62
62
 
63
63
  # Write
64
64
  if is_modified
65
- begin
66
- FileUtils.ln(temp_path, raw_path, force: true)
67
- rescue Errno::EXDEV, Errno::EACCES
68
- FileUtils.cp(temp_path, raw_path)
69
- end
65
+ smart_cp(temp_path, raw_path)
70
66
  end
71
67
 
72
68
  item_rep.modified = is_modified
@@ -80,6 +76,26 @@ module Nanoc
80
76
  def temp_filename
81
77
  Nanoc::Core::TempFilenameFactory.instance.create(TMP_TEXT_ITEMS_DIR)
82
78
  end
79
+
80
+ def smart_cp(from, to)
81
+ # Try clonefile
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
87
+ end
88
+
89
+ # Try with hardlink
90
+ begin
91
+ FileUtils.ln(from, to, force: true)
92
+ return
93
+ rescue Errno::EXDEV, Errno::EACCES
94
+ end
95
+
96
+ # Fall back to old-school copy
97
+ FileUtils.cp(from, to)
98
+ end
83
99
  end
84
100
  end
85
101
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.11.19'
5
+ VERSION = '4.11.20'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.19
4
+ version: 4.11.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-16 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: clonefile
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.2
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: concurrent-ruby
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -314,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
328
  - !ruby/object:Gem::Version
315
329
  version: '0'
316
330
  requirements: []
317
- rubygems_version: 3.1.4
331
+ rubygems_version: 3.2.2
318
332
  signing_key:
319
333
  specification_version: 4
320
334
  summary: Core of Nanoc