rxfreadwrite 0.1.0 → 0.1.4
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 +159 -0
- 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: f590af109926771c33146cd9d67028c7265dc21b1325d73db1030ffe9b986c60
|
4
|
+
data.tar.gz: 98b4786889d566036dd90f2fe2f742f88a9aca70bb1d2a90b494d932e9728bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4fa55f10256f185dbf553ae60b089536481f35211ba69cfe78fed0242f79144c4dd3d31d5af969209e2eb9c8c3ba071ef263009977de7c1a97d4e825e31d1f5
|
7
|
+
data.tar.gz: f79b56d926a4020edebfc687863d38e2ed7d92da233d6e0b36856a9d8d12df9f04e08e7933d9f99687112a26a5bf76e59d40ffa1c38515fd7cd18746cb34f3a2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rxfreadwrite.rb
CHANGED
@@ -8,6 +8,70 @@ require 'rxfreader'
|
|
8
8
|
module RXFReadWriteModule
|
9
9
|
include RXFRead
|
10
10
|
|
11
|
+
|
12
|
+
class DirX
|
13
|
+
|
14
|
+
def self.glob(s) RXFReadWrite.glob(s) end
|
15
|
+
def self.mkdir(s) RXFReadWrite.mkdir(s) end
|
16
|
+
def self.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def FileX.exists?(filename)
|
21
|
+
|
22
|
+
type = FileX.filetype(filename)
|
23
|
+
|
24
|
+
filex = case type
|
25
|
+
when :file
|
26
|
+
File
|
27
|
+
when :dfs
|
28
|
+
DfsFile
|
29
|
+
else
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
return nil unless filex
|
34
|
+
|
35
|
+
filex.exists? filename
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def FileX.filetype(x)
|
41
|
+
|
42
|
+
return :string if x.lines.length > 1
|
43
|
+
|
44
|
+
case x
|
45
|
+
when /^https?:\/\//
|
46
|
+
:http
|
47
|
+
when /^dfs:\/\//
|
48
|
+
:dfs
|
49
|
+
when /^file:\/\//
|
50
|
+
:file
|
51
|
+
else
|
52
|
+
|
53
|
+
if File.exists?(x) then
|
54
|
+
:file
|
55
|
+
else
|
56
|
+
:text
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def FileX.mkdir(s) RXFReadWrite.mkdir(s) end
|
63
|
+
def FileX.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
|
64
|
+
|
65
|
+
def FileX.rm(s) RXFReadWrite.rm(s) end
|
66
|
+
|
67
|
+
def FileX.rm_r(s, force: false)
|
68
|
+
RXFReadWrite.rm_r(s, force: force)
|
69
|
+
end
|
70
|
+
|
71
|
+
def FileX.touch(s, mtime: Time.now)
|
72
|
+
RXFReadWrite.touch(s, mtime: mtime)
|
73
|
+
end
|
74
|
+
|
11
75
|
def FileX.write(x, s)
|
12
76
|
RXFReadWrite.write(x, s)
|
13
77
|
end
|
@@ -20,6 +84,101 @@ end
|
|
20
84
|
class RXFReadWrite < RXFReader
|
21
85
|
using ColouredText
|
22
86
|
|
87
|
+
def self.glob(s)
|
88
|
+
|
89
|
+
if s[/^dfs:\/\//] then
|
90
|
+
DfsFile.glob(s)
|
91
|
+
else
|
92
|
+
Dir.glob(s)
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.mkdir(x)
|
98
|
+
|
99
|
+
if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
|
100
|
+
FileUtils.mkdir x
|
101
|
+
elsif x[/^dfs:\/\//]
|
102
|
+
DfsFile.mkdir x
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.mkdir_p(x)
|
108
|
+
|
109
|
+
if x[/^dfs:\/\//] then
|
110
|
+
DfsFile.mkdir_p x
|
111
|
+
else
|
112
|
+
FileUtils.mkdir_p x
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.rm(filename)
|
118
|
+
|
119
|
+
case filename[/^\w+(?=:\/\/)/]
|
120
|
+
when 'dfs'
|
121
|
+
DfsFile.rm filename
|
122
|
+
else
|
123
|
+
|
124
|
+
if File.basename(filename) =~ /\*/ then
|
125
|
+
|
126
|
+
Dir.glob(filename).each do |file|
|
127
|
+
|
128
|
+
begin
|
129
|
+
FileUtils.rm file
|
130
|
+
rescue
|
131
|
+
puts ('RXFReadWrite#rm: ' + file + ' is a Directory').warning
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
else
|
137
|
+
FileUtils.rm filename
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.rm_r(filename, force: false)
|
145
|
+
|
146
|
+
case filename[/^\w+(?=:\/\/)/]
|
147
|
+
when 'dfs'
|
148
|
+
DfsFile.rm_r filename, force: force
|
149
|
+
else
|
150
|
+
|
151
|
+
if File.basename(filename) =~ /\*/ then
|
152
|
+
|
153
|
+
Dir.glob(filename).each do |file|
|
154
|
+
|
155
|
+
begin
|
156
|
+
FileUtils.rm_r file, force: force
|
157
|
+
rescue
|
158
|
+
puts ('RXFReadWrite#rm_r: ' + file + ' is a Directory').warning
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
else
|
164
|
+
FileUtils.rm_r filename, force: force
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.touch(filename, mtime: Time.now)
|
172
|
+
|
173
|
+
case filename[/^\w+(?=:\/\/)/]
|
174
|
+
when 'dfs'
|
175
|
+
DfsFile.touch filename, mtime: mtime
|
176
|
+
else
|
177
|
+
FileUtils.touch filename, mtime: mtime
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
|
23
182
|
def self.write(location, s=nil)
|
24
183
|
|
25
184
|
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.4
|
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
|