drb_fileclient-readwrite 0.1.4 → 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 +3 -2
- data/lib/drb_fileclient-readwrite.rb +51 -40
- data.tar.gz.sig +0 -0
- metadata +3 -3
- 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: 81c907cd7a0b84106eb65ed0c0cffec5529c5842f000995c8d5504d13db63bc2
|
4
|
+
data.tar.gz: e44fec001e94b68e73a9569ecde44fedff79542674ee73769bec909162dadf47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90a356f7fecd376992afdf45d49ce2c041913970add9f90f5f16b1065d47c94f42dde9e8c75429eef30edc3f2fa660f178582f4cc84b5b98b0bdd436c74b44cf
|
7
|
+
data.tar.gz: ceaf0b22f952a19aed844ba7000533406bc8842fe7ea4524b84ee55a226dbb0e88e114fa008b6c0a9b180581cbc16f56f5c0abf850cdee846cac7cccf2bf900d
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�L��,|�?
|
2
|
+
���C�� ��
|
3
|
+
��<7]~큀m�d/N���Ƿ+�H���؝_�@�åO��z�y�BZ&��#��S���lŽ5%A��]1�B~#d���}, ��riX����F���b�\�9*�|��Q)%�ܨG��?���~�_�A�6�f=�L�v1����&?�o��F�����no��,(+C1W�&|����L�Lmj���ok|�ױ��Y�RߗHQ
|
@@ -8,141 +8,152 @@ require 'drb_fileclient-reader'
|
|
8
8
|
class DRbFileClientReadWrite < DRbFileClientReader
|
9
9
|
using ColouredText
|
10
10
|
|
11
|
+
def initialize()
|
12
|
+
@@directory ||= nil
|
13
|
+
@@file ||= nil
|
14
|
+
end
|
15
|
+
|
11
16
|
def chdir(raw_path)
|
17
|
+
puts 'inside chdir: ' + raw_path
|
12
18
|
|
13
|
-
return Dir.chdir raw_path unless
|
19
|
+
return Dir.chdir raw_path unless @@directory or raw_path =~ /^dfs:\/\//
|
14
20
|
|
15
21
|
if raw_path[0] == '/' then
|
16
22
|
directory = raw_path[1..-1]
|
17
23
|
elsif raw_path =~ /^dfs:\/\//
|
18
|
-
|
24
|
+
@@file, directory = parse_path(raw_path)
|
19
25
|
else
|
20
|
-
directory = File.join(
|
26
|
+
directory = File.join(@@directory, raw_path)
|
21
27
|
end
|
22
28
|
|
23
|
-
if
|
24
|
-
|
29
|
+
if @@file.exists? directory then
|
30
|
+
@@directory = directory
|
31
|
+
puts '@@directory:' + @@directory.inspect
|
25
32
|
else
|
26
33
|
'No such file or directory'
|
27
34
|
end
|
28
35
|
|
29
36
|
end
|
30
37
|
|
31
|
-
def directory?(filename
|
38
|
+
def directory?(filename=@@filename)
|
32
39
|
|
33
|
-
return File.directory? filename unless
|
40
|
+
return File.directory? filename unless @@directory or filename =~ /^dfs:\/\//
|
34
41
|
|
35
42
|
if filename =~ /^dfs:\/\// then
|
36
|
-
|
43
|
+
@@file, filename2 = parse_path(filename)
|
37
44
|
else
|
38
45
|
|
39
|
-
filename2 = File.join(
|
46
|
+
filename2 = File.join(@@directory, filename)
|
40
47
|
end
|
41
48
|
|
42
|
-
|
49
|
+
@@file.directory?(filename2)
|
43
50
|
|
44
51
|
end
|
45
52
|
|
46
53
|
def glob(s)
|
47
54
|
|
48
55
|
if s =~ /^dfs:\/\// then
|
49
|
-
|
56
|
+
@@file, s2 = parse_path(s)
|
50
57
|
else
|
51
|
-
s2 = File.join(
|
58
|
+
s2 = File.join(@@directory, s)
|
52
59
|
end
|
53
60
|
|
54
|
-
|
61
|
+
@@file.glob s2
|
55
62
|
|
56
63
|
end
|
57
64
|
|
58
65
|
def mkdir(name)
|
59
66
|
|
60
|
-
return FileUtils.mkdir name unless
|
67
|
+
return FileUtils.mkdir name unless @@directory or name =~ /^dfs:\/\//
|
61
68
|
|
62
|
-
|
63
|
-
|
69
|
+
@@file, path = parse_path(name)
|
70
|
+
@@file.mkdir path
|
64
71
|
end
|
65
72
|
|
66
73
|
def mkdir_p(raw_path)
|
67
74
|
|
68
|
-
unless
|
75
|
+
unless @@directory or raw_path =~ /^dfs:\/\// then
|
69
76
|
return FileUtils.mkdir_p raw_path
|
70
77
|
end
|
71
78
|
|
72
79
|
if raw_path =~ /^dfs:\/\// then
|
73
|
-
|
80
|
+
@@file, filepath = parse_path(raw_path)
|
74
81
|
else
|
75
|
-
filepath = File.join(
|
82
|
+
filepath = File.join(@@directory, raw_path)
|
76
83
|
end
|
77
84
|
|
78
|
-
|
85
|
+
@@file.mkdir_p filepath
|
79
86
|
end
|
80
87
|
|
81
88
|
def pwd()
|
82
89
|
|
83
|
-
|
90
|
+
puts 'inside pwd'
|
91
|
+
puts '@@directory: ' + @@directory.inspect
|
92
|
+
puts '@@file: ' + @@file.inspect
|
93
|
+
|
94
|
+
return Dir.pwd unless @@directory
|
84
95
|
|
85
|
-
'/' +
|
96
|
+
'/' + @@directory if @@file
|
86
97
|
|
87
98
|
end
|
88
99
|
|
89
100
|
def rm(path)
|
90
101
|
|
91
|
-
return FileUtils.rm path unless
|
102
|
+
return FileUtils.rm path unless @@directory or path =~ /^dfs:\/\//
|
92
103
|
|
93
104
|
if path =~ /^dfs:\/\// then
|
94
|
-
|
105
|
+
@@file, path2 = parse_path( path)
|
95
106
|
else
|
96
|
-
path2 = File.join(
|
107
|
+
path2 = File.join(@@directory, path)
|
97
108
|
end
|
98
109
|
|
99
|
-
|
110
|
+
@@file.rm path2
|
100
111
|
|
101
112
|
end
|
102
113
|
|
103
114
|
def rm_r(path, force: false)
|
104
115
|
|
105
|
-
unless
|
116
|
+
unless @@directory or path =~ /^dfs:\/\// then
|
106
117
|
return FileUtils.rm_r(path, force: force)
|
107
118
|
end
|
108
119
|
|
109
120
|
if path =~ /^dfs:\/\// then
|
110
|
-
|
121
|
+
@@file, path2 = parse_path( path)
|
111
122
|
else
|
112
|
-
path2 = File.join(
|
123
|
+
path2 = File.join(@@directory, path)
|
113
124
|
end
|
114
125
|
|
115
|
-
|
126
|
+
@@file.rm_r(path2, force: force)
|
116
127
|
|
117
128
|
end
|
118
129
|
|
119
130
|
def touch(s, mtime: Time.now)
|
120
131
|
|
121
|
-
unless
|
132
|
+
unless @@directory or s =~ /^dfs:\/\// then
|
122
133
|
return FileUtils.touch(s, mtime: mtime)
|
123
134
|
end
|
124
135
|
|
125
136
|
if s =~ /^dfs:\/\// then
|
126
|
-
|
137
|
+
@@file, s2 = parse_path(s)
|
127
138
|
else
|
128
|
-
s2 = File.join(
|
139
|
+
s2 = File.join(@@directory, s)
|
129
140
|
end
|
130
141
|
|
131
|
-
|
142
|
+
@@file.touch s2, mtime: mtime
|
132
143
|
|
133
144
|
end
|
134
145
|
|
135
|
-
def write(filename
|
146
|
+
def write(filename=@@filename, s)
|
136
147
|
|
137
|
-
return File.write filename, s unless
|
148
|
+
return File.write filename, s unless @@directory or filename =~ /^dfs:\/\//
|
138
149
|
|
139
150
|
if filename =~ /^dfs:\/\// then
|
140
|
-
|
151
|
+
@@file, path = parse_path(filename)
|
141
152
|
else
|
142
|
-
path = File.join(
|
153
|
+
path = File.join(@@directory, filename)
|
143
154
|
end
|
144
155
|
|
145
|
-
|
156
|
+
@@file.write path, s
|
146
157
|
|
147
158
|
end
|
148
159
|
|
@@ -169,7 +180,7 @@ def DfsFile.mkdir_p(filename)
|
|
169
180
|
end
|
170
181
|
|
171
182
|
def DfsFile.pwd()
|
172
|
-
|
183
|
+
DRbFileClientReadWrite.new.pwd()
|
173
184
|
end
|
174
185
|
|
175
186
|
def DfsFile.rm(filename)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drb_fileclient-readwrite
|
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
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '0.1'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.1.
|
49
|
+
version: 0.1.1
|
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.1'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.1.
|
59
|
+
version: 0.1.1
|
60
60
|
description:
|
61
61
|
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|