file_pool 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
1
  module FilePool
2
- # Version 0.3.2
3
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
4
3
  end
data/lib/file_pool.rb CHANGED
@@ -74,21 +74,26 @@ module FilePool
74
74
  # === Return Value:
75
75
  #
76
76
  # :: *String* containing a new unique ID for the file added.
77
- def self.add! path
77
+ def self.add! orig_path
78
78
  newid = uuid
79
79
  target = path newid
80
80
 
81
81
  if @@crypted_mode
82
82
  FileUtils.mkpath(id2dir_secured newid)
83
- path = crypt(path)
83
+ path = crypt(orig_path)
84
84
  else
85
+ path = orig_path
85
86
  FileUtils.mkpath(id2dir newid)
86
87
  end
87
88
 
88
89
  if !@@copy_source and (File.stat(path).dev == File.stat(File.dirname(target)).dev)
89
90
  FileUtils.link(path, target)
90
91
  else
91
- FileUtils.copy(path, target)
92
+ FileUtils.copy(path, target)
93
+ end
94
+
95
+ # don't chmod if orginal file is same as target (hard-linked)
96
+ if File.stat(orig_path).ino != File.stat(File.dirname(target)).ino
92
97
  FileUtils.chmod(@@mode, target) if @@mode
93
98
  FileUtils.chown(@@owner, @@group, target)
94
99
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_pool
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "robokopp (Robert Anni\xC3\xA9s)"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2018-03-23 00:00:00 +01:00
18
+ date: 2018-03-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency