rxfileio 0.2.1 → 0.2.3
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/rxfileio.rb +8 -75
- data.tar.gz.sig +0 -0
- metadata +5 -5
- 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: '08d1e85a91de04e491f6ddc55f9b7a761c56528f8a05aa2629713067c8bb6dcf'
|
4
|
+
data.tar.gz: c06843254fd4e53b5d948e0f5f7c36d30c2b37f099790a775485bee5a0d8286c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc554443fed2e90df5b85617eb7680bf8896d7e4600e800ad4730ac1a2e1aa737452c143f93d384ada94dc4be94a363eeb5c697c8f68bf23ed23469f149e0eed
|
7
|
+
data.tar.gz: 1790ea0632b76cf409f8159d8c0ed8a0f2232959dc8579a34c41584c00dd878bd3747e9500549f306a5b7ca3bca886639ae4a21c1b221d306eca3cda35819338
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rxfileio.rb
CHANGED
@@ -11,42 +11,13 @@ require 'mymedia_ftp'
|
|
11
11
|
module RXFileIOModule
|
12
12
|
include RXFReadWriteModule
|
13
13
|
|
14
|
-
def
|
15
|
-
def DirX.mkdir(s) RXFileIO.mkdir(s) end
|
16
|
-
def DirX.pwd() RXFileIO.pwd() end
|
17
|
-
|
18
|
-
def FileX.chdir(s) RXFileIO.chdir(s) end
|
19
|
-
|
20
|
-
def FileX.directory?(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.directory? filename
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def FileX.exist?(filename)
|
40
|
-
exists? filename
|
41
|
-
end
|
42
|
-
|
14
|
+
def FileX.exist?(filename) exist?(filename) end
|
43
15
|
def FileX.chmod(num, s) RXFileIO.chmod(num, s) end
|
44
16
|
def FileX.cp(s, s2) RXFileIO.cp(s, s2) end
|
45
17
|
def FileX.ls(s) RXFileIO.ls(s) end
|
46
18
|
def FileX.mkdir(s) RXFileIO.mkdir(s) end
|
47
19
|
def FileX.mkdir_p(s) RXFileIO.mkdir_p(s) end
|
48
20
|
def FileX.mv(s, s2) RXFileIO.mv(s, s2) end
|
49
|
-
def FileX.pwd() RXFileIO.pwd() end
|
50
21
|
def FileX.read(x) RXFileIO.read(x).first end
|
51
22
|
def FileX.rm(s) RXFileIO.rm(s) end
|
52
23
|
|
@@ -73,14 +44,13 @@ end
|
|
73
44
|
class RXFileIO < RXFReadWrite
|
74
45
|
using ColouredText
|
75
46
|
|
76
|
-
@fs = :local
|
77
47
|
|
78
48
|
def self.chmod(permissions, s)
|
79
49
|
|
80
50
|
return unless permissions.is_a? Integer
|
81
51
|
return unless s.is_a? String
|
82
52
|
|
83
|
-
if s[/^dfs:\/\//] or
|
53
|
+
if s[/^dfs:\/\//] or @@fs[0..2] == 'dfs' then
|
84
54
|
DfsFile.chmod permissions, s
|
85
55
|
else
|
86
56
|
FileUtils.chmod permissions, s
|
@@ -112,31 +82,11 @@ class RXFileIO < RXFReadWrite
|
|
112
82
|
end
|
113
83
|
end
|
114
84
|
|
115
|
-
def self.chdir(x)
|
116
|
-
|
117
|
-
# We can use @fs within chdir() to flag the current file system.
|
118
|
-
# Allowing us to use relative paths with FileX operations instead
|
119
|
-
# of explicitly stating the path each time. e.g. touch 'foo.txt'
|
120
|
-
#
|
121
|
-
|
122
|
-
if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
|
123
|
-
|
124
|
-
@fs = :local
|
125
|
-
FileUtils.chdir x
|
126
85
|
|
127
|
-
elsif x[/^dfs:\/\//]
|
128
|
-
|
129
|
-
host = x[/(?<=dfs:\/\/)[^\/]+/]
|
130
|
-
@fs = 'dfs://' + host
|
131
|
-
DfsFile.chdir x
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
136
86
|
|
137
87
|
def self.ls(x='*')
|
138
88
|
|
139
|
-
return Dir[x] if File.
|
89
|
+
return Dir[x] if File.exist?(File.dirname(x))
|
140
90
|
|
141
91
|
case x[/^\w+(?=:\/\/)/]
|
142
92
|
when 'file'
|
@@ -151,19 +101,9 @@ class RXFileIO < RXFReadWrite
|
|
151
101
|
|
152
102
|
end
|
153
103
|
|
154
|
-
def self.mkdir(x)
|
155
|
-
|
156
|
-
if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
|
157
|
-
FileUtils.mkdir x
|
158
|
-
elsif x[/^dfs:\/\//]
|
159
|
-
DfsFile.mkdir x
|
160
|
-
end
|
161
|
-
|
162
|
-
end
|
163
|
-
|
164
104
|
def self.mkdir_p(x)
|
165
105
|
|
166
|
-
if x[/^dfs:\/\//] or
|
106
|
+
if x[/^dfs:\/\//] or @@fs[0..2] == 'dfs' then
|
167
107
|
DfsFile.mkdir_p x
|
168
108
|
else
|
169
109
|
FileUtils.mkdir_p x
|
@@ -175,13 +115,6 @@ class RXFileIO < RXFReadWrite
|
|
175
115
|
DfsFile.mv(s1, s2)
|
176
116
|
end
|
177
117
|
|
178
|
-
|
179
|
-
def self.pwd()
|
180
|
-
|
181
|
-
DfsFile.pwd
|
182
|
-
|
183
|
-
end
|
184
|
-
|
185
118
|
def self.read(x, h={})
|
186
119
|
|
187
120
|
opt = {debug: false}.merge(h)
|
@@ -231,7 +164,7 @@ class RXFileIO < RXFReadWrite
|
|
231
164
|
|
232
165
|
[MyMediaFTP.read(x), :ftp]
|
233
166
|
|
234
|
-
elsif x[/^file:\/\//] or File.
|
167
|
+
elsif x[/^file:\/\//] or File.exist?(x) then
|
235
168
|
|
236
169
|
contents = File.read(File.expand_path(x.sub(%r{^file://}, '')))
|
237
170
|
|
@@ -347,8 +280,8 @@ class RXFileIO < RXFReadWrite
|
|
347
280
|
|
348
281
|
def self.touch(filename, mtime: Time.now)
|
349
282
|
|
350
|
-
if
|
351
|
-
return DfsFile.touch(
|
283
|
+
if @@fs[0..2] == 'dfs' then
|
284
|
+
return DfsFile.touch(@@fs + pwd + '/' + filename, mtime: mtime)
|
352
285
|
end
|
353
286
|
|
354
287
|
case filename[/^\w+(?=:\/\/)/]
|
@@ -391,7 +324,7 @@ class RXFileIO < RXFReadWrite
|
|
391
324
|
|
392
325
|
if not source =~ /:\/\// then
|
393
326
|
|
394
|
-
return true if File.
|
327
|
+
return true if File.exist? source
|
395
328
|
|
396
329
|
else
|
397
330
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rxfileio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
yLO5YIYbN1F1F4bnaaoKLedXnnC+5VCarLA4HblYDwqrZ78CQIBelACSnxeY9gD3
|
36
36
|
oyr0nnshzqXtH7vQD0nI5kqL
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2023-01-20 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rxfreadwrite
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '0.2'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.2.
|
49
|
+
version: 0.2.5
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '0.2'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.2.
|
59
|
+
version: 0.2.5
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: drb_fileclient
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.4.4
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Features remote file operations using the DFS protocol and more.
|
metadata.gz.sig
CHANGED
Binary file
|