posix-fileutils 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/posix-fileutils/fileutils.rb +20 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzBjYWRkOGIyMGNjZjU0MTczZjIzNzIyNGVjMzU4NThlYzc3ZjUwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODliZjc0NTQwNjJiMjVjMGIzZDMzNTM3ZmRjZDNlNDA5NmViMmNkOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2EwYjUwZWUxNzQ0OThmZDU2MTRiYWM1ZDNkM2UyZjg0NDUwZmY2ODZhYjg2
|
10
|
+
ZTBmZWYzOTJmNTE5YTBmN2U1NTI4NTQwNjEyNmUwNjc5ZjMwMTYxZjdmNmUw
|
11
|
+
M2Y4MDc2NTE3MGU3YmJlM2MyZDU4YTEwMDdkOTkyYzk0NWEyZDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTdhNjYzYjRmNWM5MjhiNWUwNjc3OGQ3MWMyMDYzNDYyMDIxOWY0ODUzMGY1
|
14
|
+
ZDBjNmU4NWMzOGRmYTEzNzFhMGVjNzk3YWJmNmViNDcyNTAzMjIwMzA4NWZm
|
15
|
+
NDVkMjk5M2ZmNjVkMDJjYzQ1YTkxMWE0OWJmMjVhYzIxYTBjNmU=
|
@@ -17,16 +17,24 @@ class Array
|
|
17
17
|
end
|
18
18
|
|
19
19
|
module Fs
|
20
|
-
|
20
|
+
@defopts = [].to_set
|
21
21
|
@popts = {
|
22
|
-
:cp => [:T,:a,:v,:r]
|
23
|
-
:mv => [:T,:a,:v,:r]
|
24
|
-
:rm => [:v
|
25
|
-
:touch => [:v]
|
26
|
-
:pwd => []
|
27
|
-
:mkdir => [:v,
|
28
|
-
:dsync => [:v,
|
29
|
-
}
|
22
|
+
:cp => [:T,:a,:v,:r ],
|
23
|
+
:mv => [:T,:a,:v,:r ],
|
24
|
+
:rm => [ :v,:r,:f ],
|
25
|
+
:touch => [ :v ],
|
26
|
+
:pwd => [ ],
|
27
|
+
:mkdir => [ :v, :p],
|
28
|
+
:dsync => [ :v, ],
|
29
|
+
}.inject({}) do |h,(k,v)| h[k]=v.to_set; h end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
attr_accessor :defopts
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.popts
|
36
|
+
@popts.clone
|
37
|
+
end
|
30
38
|
|
31
39
|
def self.parse_cp_args src, dst, *opts
|
32
40
|
raise ArgumentError unless !dst.a?
|
@@ -57,7 +65,7 @@ module Fs
|
|
57
65
|
opts_s = '-f '
|
58
66
|
|
59
67
|
[:T, :a, :v, :r].each do |opt|
|
60
|
-
opts_s << "-#{opt.to_s} " if include?(opt) ||
|
68
|
+
opts_s << "-#{opt.to_s} " if include?(opt) || Fs.defopts.include?(opt)
|
61
69
|
end
|
62
70
|
|
63
71
|
opts_s
|
@@ -86,7 +94,7 @@ module Fs
|
|
86
94
|
|
87
95
|
raise ArgumentError unless src.directory? && dst.directory?
|
88
96
|
|
89
|
-
if opts.
|
97
|
+
if opts.include? :d
|
90
98
|
Dir["#{dst.to_s}/**/{*,.*}"].each do |file|
|
91
99
|
file = Pathname.new file
|
92
100
|
next unless file.exist?
|
@@ -144,7 +152,7 @@ module Fs
|
|
144
152
|
opts_s = ''
|
145
153
|
|
146
154
|
@flags.each do |opt|
|
147
|
-
opts_s << "-#{opt.to_s} " if include?(opt) ||
|
155
|
+
opts_s << "-#{opt.to_s} " if include?(opt) || Fs.defopts.include?(opt)
|
148
156
|
end
|
149
157
|
|
150
158
|
opts_s
|