atomos 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/atomos.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfbb3fc3db361c21f5e625049181be7ca4970fcf11e7b9cd4aaabf0da2e66d7d
|
4
|
+
data.tar.gz: 9cd5e507898abc17b46812778c40b12d8c230f72d38d32667cef127a2561ff81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97dff47b26198b24b0e3643dd7b88a62f117e6d4019904efd647fed024f0d867edfde3c4e0343c2f39bf87257fdabec10e44cec7288630103e5127ad8d322d3b
|
7
|
+
data.tar.gz: eccdcebc770810c367ee1788c8e99737bf43f94490d106cce3ca33a5259bca4ca23a008d31f368a4d2c242769e1647abe32783645ecbea8da840ba7f244b779b
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/atomos.rb
CHANGED
@@ -5,6 +5,7 @@ require 'atomos/version'
|
|
5
5
|
module Atomos
|
6
6
|
module_function
|
7
7
|
|
8
|
+
# rubocop:disable Metrics/MethodLength
|
8
9
|
def atomic_write(dest, contents = nil, tmpdir: nil, &block)
|
9
10
|
unless contents.nil? ^ block.nil?
|
10
11
|
raise ArgumentError, 'must provide either contents or a block'
|
@@ -20,11 +21,14 @@ module Atomos
|
|
20
21
|
retval = yield tmpfile
|
21
22
|
end
|
22
23
|
|
24
|
+
tmpfile.close
|
25
|
+
|
23
26
|
File.rename(tmpfile.path, dest)
|
24
27
|
|
25
28
|
retval
|
26
29
|
end
|
27
30
|
end
|
31
|
+
# rubocop:enable Metrics/MethodLength
|
28
32
|
|
29
33
|
def self.default_tmpdir_for_file(dest, tmpdir)
|
30
34
|
tmpdir ||= begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Giddins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.7.
|
116
|
+
rubygems_version: 2.7.7
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A simple gem to atomically write files
|