mores 0.2.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 5f48b9b021f0ed8beefabb1e22879bb2a1724ad4
4
- data.tar.gz: 46351eb0e184e6d34f1c6c8a41699993dbaaf47b
3
+ metadata.gz: 56db0243472baf8e65ff96edd88956f16cf605fa
4
+ data.tar.gz: 95eed517c10f3be24f9d59a4e06c581bdc01f678
5
5
  SHA512:
6
- metadata.gz: 403e5ff2f0a145cdbe80f6745877124960475ecaa7ca2af40c889e89a20acde6f078a9e8c2b88aeb7206dc636d6e10b926f5b64721c2414f11d00327c7517892
7
- data.tar.gz: 0fd000095d08cca21cbdafad88ab32cce09f60f54e56f8518366c4e70f555bf279c087fc7c6a1fac25e5a872e9155ec8751a42df4dc785ae148827e4bf0814fd
6
+ metadata.gz: 4952f2d0e315fa61105302ceec5a40970e55e5d8e882093fa109358fac69608e5a47bccbbb750adf500b37f919f1b758d604772cb6e30a4bc6057d13cabe6276
7
+ data.tar.gz: ba792a2bedeb40272972f89835ebda4dfa958263fb6703a2137e4ed5b361b133c799f86c309d3eff95a22dffb9e5b2f0ab00c6625021fe4ad133a8282fb87ada
@@ -15,6 +15,17 @@ module Mores::Patch::FileUtils
15
15
  false
16
16
  end
17
17
 
18
+ def safe_write(path, string)
19
+ [path, File.write(path, string, mode: File::CREAT | File::EXCL | File::WRONLY)]
20
+ rescue Errno::EEXIST
21
+ path_fmt ||= File.basename(path, '.*').tap do |base|
22
+ break path.insert path.rindex(base) + base.length, '%s'
23
+ end
24
+ suffix ||= '_0'
25
+ path = path_fmt % suffix.next!
26
+ retry
27
+ end
28
+
18
29
  private
19
30
 
20
31
  def stream_blksize(*streams)
data/lib/mores/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mores
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mores
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Petter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-19 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler