rxfreadwrite 0.1.1 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rxfreadwrite.rb +93 -36
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4a5e0be2ab188873e5b66442a41c9323cb2cdc147479a4f345e0bf8f65a5169
|
4
|
+
data.tar.gz: 789b30722ba41958c2583339ae81517a6b9e15add206257962e46487cd30fafc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4111afd84565a9548023a8986574548332d3f37f3d7fd09da6ac21df8163ff46feb71142694cd45c001878071d945662ebc29a8b7ba4c6f9976db35c3728c89
|
7
|
+
data.tar.gz: 401e36e30e4f859afa88ef3087a73299546431adb139bb8aef1b04b885d5d41a364784cfcc5c47708d6aeb79c597881ebdf5c864633006c5a3e7717fb5c57396
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rxfreadwrite.rb
CHANGED
@@ -8,76 +8,133 @@ require 'rxfreader'
|
|
8
8
|
module RXFReadWriteModule
|
9
9
|
include RXFRead
|
10
10
|
|
11
|
-
|
12
11
|
class DirX
|
13
12
|
|
14
|
-
def self.glob(s)
|
13
|
+
def self.glob(s) RXFReadWrite.glob(s) end
|
14
|
+
def self.mkdir(s) RXFReadWrite.mkdir(s) end
|
15
|
+
def self.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
|
15
16
|
|
16
17
|
end
|
17
18
|
|
18
|
-
def FileX.
|
19
|
+
def FileX.mkdir(s) RXFReadWrite.mkdir(s) end
|
20
|
+
def FileX.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
|
21
|
+
def FileX.rm(s) RXFReadWrite.rm(s) end
|
22
|
+
|
23
|
+
def FileX.rm_r(s, force: false)
|
24
|
+
RXFReadWrite.rm_r(s, force: force)
|
25
|
+
end
|
19
26
|
|
20
|
-
|
27
|
+
def FileX.touch(s, mtime: Time.now)
|
28
|
+
RXFReadWrite.touch(s, mtime: mtime)
|
29
|
+
end
|
21
30
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
31
|
+
def FileX.write(x, s)
|
32
|
+
RXFReadWrite.write(x, s)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
class RXFReadWriteException < Exception
|
38
|
+
end
|
39
|
+
|
40
|
+
class RXFReadWrite < RXFReader
|
41
|
+
using ColouredText
|
42
|
+
|
43
|
+
def self.glob(s)
|
44
|
+
|
45
|
+
if s[/^dfs:\/\//] then
|
46
|
+
DfsFile.glob(s)
|
27
47
|
else
|
28
|
-
|
48
|
+
Dir.glob(s)
|
29
49
|
end
|
30
50
|
|
31
|
-
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.mkdir(x)
|
32
54
|
|
33
|
-
|
55
|
+
if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
|
56
|
+
FileUtils.mkdir x
|
57
|
+
elsif x[/^dfs:\/\//]
|
58
|
+
DfsFile.mkdir x
|
59
|
+
end
|
34
60
|
|
35
61
|
end
|
36
62
|
|
63
|
+
def self.mkdir_p(x)
|
37
64
|
|
38
|
-
|
65
|
+
if x[/^dfs:\/\//] then
|
66
|
+
DfsFile.mkdir_p x
|
67
|
+
else
|
68
|
+
FileUtils.mkdir_p x
|
69
|
+
end
|
39
70
|
|
40
|
-
|
71
|
+
end
|
41
72
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
when
|
46
|
-
|
47
|
-
when /^file:\/\//
|
48
|
-
:file
|
73
|
+
def self.rm(filename)
|
74
|
+
|
75
|
+
case filename[/^\w+(?=:\/\/)/]
|
76
|
+
when 'dfs'
|
77
|
+
DfsFile.rm filename
|
49
78
|
else
|
50
79
|
|
51
|
-
if File.
|
52
|
-
|
80
|
+
if File.basename(filename) =~ /\*/ then
|
81
|
+
|
82
|
+
Dir.glob(filename).each do |file|
|
83
|
+
|
84
|
+
begin
|
85
|
+
FileUtils.rm file
|
86
|
+
rescue
|
87
|
+
puts ('RXFReadWrite#rm: ' + file + ' is a Directory').warning
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
53
92
|
else
|
54
|
-
|
93
|
+
FileUtils.rm filename
|
55
94
|
end
|
56
95
|
|
57
96
|
end
|
58
|
-
end
|
59
97
|
|
60
|
-
def FileX.write(x, s)
|
61
|
-
RXFReadWrite.write(x, s)
|
62
98
|
end
|
63
|
-
end
|
64
99
|
|
100
|
+
def self.rm_r(filename, force: false)
|
65
101
|
|
66
|
-
|
67
|
-
|
102
|
+
case filename[/^\w+(?=:\/\/)/]
|
103
|
+
when 'dfs'
|
104
|
+
DfsFile.rm_r filename, force: force
|
105
|
+
else
|
68
106
|
|
69
|
-
|
70
|
-
using ColouredText
|
107
|
+
if File.basename(filename) =~ /\*/ then
|
71
108
|
|
72
|
-
|
109
|
+
Dir.glob(filename).each do |file|
|
73
110
|
|
74
|
-
|
75
|
-
|
111
|
+
begin
|
112
|
+
FileUtils.rm_r file, force: force
|
113
|
+
rescue
|
114
|
+
puts ('RXFReadWrite#rm_r: ' + file + ' is a Directory').warning
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
else
|
120
|
+
FileUtils.rm_r filename, force: force
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.touch(filename, mtime: Time.now)
|
128
|
+
|
129
|
+
case filename[/^\w+(?=:\/\/)/]
|
130
|
+
when 'dfs'
|
131
|
+
DfsFile.touch filename, mtime: mtime
|
76
132
|
else
|
77
|
-
|
133
|
+
FileUtils.touch filename, mtime: mtime
|
78
134
|
end
|
79
135
|
|
80
136
|
end
|
137
|
+
|
81
138
|
def self.write(location, s=nil)
|
82
139
|
|
83
140
|
case location
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rxfreadwrite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
gnYmJHVhKvNaFwL4ryulhkA+n8o3Ve6Kzo/AGlO2+Ge6H0bqIUbS8UisqDa7IwlY
|
36
36
|
tvleW582+lzMrpAfWdGb4VFX
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-02-
|
38
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rxfreader
|
metadata.gz.sig
CHANGED
Binary file
|