rxfreadwrite 0.1.2 → 0.2.0
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 +119 -36
- data.tar.gz.sig +0 -0
- metadata +24 -4
- 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: 5ce3e2d94948e994649b37b42b231ff4a153b9966b34df1a52b5a4ab384dfe15
|
4
|
+
data.tar.gz: 62b36ab4f5b3a394ad8e022c5bea9cc6f6457411858c4d370c5653a14c6c6977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37ea0d264edf3531b18e335b693d6e452d7f7a492e97dbf94211a321a751c53ed9b1880ebc1366fceb1992934e710ba8a733f7bc444675e5c9a6f3ae15a1a01
|
7
|
+
data.tar.gz: fe40d75490bdab065e8146f1de7e60a0b0b0f8c9c636f9bf22cbe80777d013e97a56dec7062a8d223bba4339a2a44d934d0e6d628917dabab7bd12a4ed6f0060
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rxfreadwrite.rb
CHANGED
@@ -3,81 +3,164 @@
|
|
3
3
|
# file: rxfreadwrite.rb
|
4
4
|
|
5
5
|
require 'rxfreader'
|
6
|
+
require 'drb_fileclient-readwrite'
|
6
7
|
|
7
8
|
|
8
9
|
module RXFReadWriteModule
|
9
10
|
include RXFRead
|
10
11
|
|
11
|
-
|
12
12
|
class DirX
|
13
13
|
|
14
|
-
def self.
|
14
|
+
def self.chdir(s) RXFReadWrite.chdir(s) end
|
15
|
+
def self.glob(s) RXFReadWrite.glob(s) end
|
16
|
+
def self.mkdir(s) RXFReadWrite.mkdir(s) end
|
17
|
+
def self.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
|
15
18
|
|
16
19
|
end
|
17
20
|
|
18
|
-
def FileX.
|
21
|
+
def FileX.chdir(s) RXFReadWrite.chdir(s) end
|
22
|
+
def FileX.mkdir(s) RXFReadWrite.mkdir(s) end
|
23
|
+
def FileX.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
|
24
|
+
def FileX.rm(s) RXFReadWrite.rm(s) end
|
25
|
+
|
26
|
+
def FileX.rm_r(s, force: false)
|
27
|
+
RXFReadWrite.rm_r(s, force: force)
|
28
|
+
end
|
29
|
+
|
30
|
+
def FileX.touch(s, mtime: Time.now)
|
31
|
+
RXFReadWrite.touch(s, mtime: mtime)
|
32
|
+
end
|
33
|
+
|
34
|
+
def FileX.write(x, s)
|
35
|
+
RXFReadWrite.write(x, s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
class RXFReadWriteException < Exception
|
41
|
+
end
|
42
|
+
|
43
|
+
class RXFReadWrite < RXFReader
|
44
|
+
using ColouredText
|
45
|
+
|
46
|
+
|
47
|
+
def self.chdir(x)
|
48
|
+
|
49
|
+
# We can use @fs within chdir() to flag the current file system.
|
50
|
+
# Allowing us to use relative paths with FileX operations instead
|
51
|
+
# of explicitly stating the path each time. e.g. touch 'foo.txt'
|
52
|
+
#
|
53
|
+
|
54
|
+
if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
|
55
|
+
|
56
|
+
@fs = :local
|
57
|
+
FileUtils.chdir x
|
19
58
|
|
20
|
-
|
59
|
+
elsif x[/^dfs:\/\//]
|
21
60
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
61
|
+
host = x[/(?<=dfs:\/\/)[^\/]+/]
|
62
|
+
@fs = 'dfs://' + host
|
63
|
+
DfsFile.chdir x
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.glob(s)
|
70
|
+
|
71
|
+
if s[/^dfs:\/\//] then
|
72
|
+
DfsFile.glob(s)
|
27
73
|
else
|
28
|
-
|
74
|
+
Dir.glob(s)
|
29
75
|
end
|
30
76
|
|
31
|
-
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.mkdir(x)
|
32
80
|
|
33
|
-
|
81
|
+
if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
|
82
|
+
FileUtils.mkdir x
|
83
|
+
elsif x[/^dfs:\/\//]
|
84
|
+
DfsFile.mkdir x
|
85
|
+
end
|
34
86
|
|
35
87
|
end
|
36
88
|
|
89
|
+
def self.mkdir_p(x)
|
37
90
|
|
38
|
-
|
91
|
+
if x[/^dfs:\/\//] then
|
92
|
+
DfsFile.mkdir_p x
|
93
|
+
else
|
94
|
+
FileUtils.mkdir_p x
|
95
|
+
end
|
39
96
|
|
40
|
-
|
97
|
+
end
|
41
98
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
when
|
46
|
-
|
47
|
-
when /^file:\/\//
|
48
|
-
:file
|
99
|
+
def self.rm(filename)
|
100
|
+
|
101
|
+
case filename[/^\w+(?=:\/\/)/]
|
102
|
+
when 'dfs'
|
103
|
+
DfsFile.rm filename
|
49
104
|
else
|
50
105
|
|
51
|
-
if File.
|
52
|
-
|
106
|
+
if File.basename(filename) =~ /\*/ then
|
107
|
+
|
108
|
+
Dir.glob(filename).each do |file|
|
109
|
+
|
110
|
+
begin
|
111
|
+
FileUtils.rm file
|
112
|
+
rescue
|
113
|
+
puts ('RXFReadWrite#rm: ' + file + ' is a Directory').warning
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
53
118
|
else
|
54
|
-
|
119
|
+
FileUtils.rm filename
|
55
120
|
end
|
56
121
|
|
57
122
|
end
|
58
|
-
end
|
59
123
|
|
60
|
-
def FileX.write(x, s)
|
61
|
-
RXFReadWrite.write(x, s)
|
62
124
|
end
|
63
|
-
end
|
64
125
|
|
126
|
+
def self.rm_r(filename, force: false)
|
65
127
|
|
66
|
-
|
67
|
-
|
128
|
+
case filename[/^\w+(?=:\/\/)/]
|
129
|
+
when 'dfs'
|
130
|
+
DfsFile.rm_r filename, force: force
|
131
|
+
else
|
68
132
|
|
69
|
-
|
70
|
-
using ColouredText
|
133
|
+
if File.basename(filename) =~ /\*/ then
|
71
134
|
|
72
|
-
|
135
|
+
Dir.glob(filename).each do |file|
|
73
136
|
|
74
|
-
|
75
|
-
|
137
|
+
begin
|
138
|
+
FileUtils.rm_r file, force: force
|
139
|
+
rescue
|
140
|
+
puts ('RXFReadWrite#rm_r: ' + file + ' is a Directory').warning
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
else
|
146
|
+
FileUtils.rm_r filename, force: force
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.touch(filename, mtime: Time.now)
|
154
|
+
|
155
|
+
case filename[/^\w+(?=:\/\/)/]
|
156
|
+
when 'dfs'
|
157
|
+
DfsFile.touch filename, mtime: mtime
|
76
158
|
else
|
77
|
-
|
159
|
+
FileUtils.touch filename, mtime: mtime
|
78
160
|
end
|
79
161
|
|
80
162
|
end
|
163
|
+
|
81
164
|
def self.write(location, s=nil)
|
82
165
|
|
83
166
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,10 +35,30 @@ cert_chain:
|
|
35
35
|
gnYmJHVhKvNaFwL4ryulhkA+n8o3Ve6Kzo/AGlO2+Ge6H0bqIUbS8UisqDa7IwlY
|
36
36
|
tvleW582+lzMrpAfWdGb4VFX
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-02-
|
38
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rxfreader
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.2'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.2.1
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.2'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.2.1
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: drb_fileclient-readwrite
|
42
62
|
requirement: !ruby/object:Gem::Requirement
|
43
63
|
requirements:
|
44
64
|
- - "~>"
|
@@ -46,7 +66,7 @@ dependencies:
|
|
46
66
|
version: '0.1'
|
47
67
|
- - ">="
|
48
68
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.1.
|
69
|
+
version: 0.1.0
|
50
70
|
type: :runtime
|
51
71
|
prerelease: false
|
52
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +76,7 @@ dependencies:
|
|
56
76
|
version: '0.1'
|
57
77
|
- - ">="
|
58
78
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.1.
|
79
|
+
version: 0.1.0
|
60
80
|
description:
|
61
81
|
email: digital.robertson@gmail.com
|
62
82
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|