drb_fileclient-readwrite 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/drb_fileclient-readwrite.rb +46 -24
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 3e0f345936168e8e3b2cc92f3160b5bebdfaccec295d54bfb9168a7053487956
|
4
|
+
data.tar.gz: f58a10be3a0b86cfc7e473d97c891760caa0e0805db39bcf855e3e9e9858c669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba4ce2c1df040c36bce549232eebde9fc70e40ef1d607c3243337f8c1b0dd457e2b4c67929265def1d05b2083d104877cffd3b384c8d1f65650618a233e799c
|
7
|
+
data.tar.gz: aacb4828d3cf6b2a6855fed502a3731234b0f5f81290ba58610c16dad26563af60bd1d6391fdf0062c2309f2ae6ade904a18606f6b1fd219dadf4b5dff3b3fa3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -8,6 +8,26 @@ require 'drb_fileclient-reader'
|
|
8
8
|
class DRbFileClientReadWrite < DRbFileClientReader
|
9
9
|
using ColouredText
|
10
10
|
|
11
|
+
def chdir(raw_path)
|
12
|
+
|
13
|
+
return Dir.chdir raw_path unless @directory or raw_path =~ /^dfs:\/\//
|
14
|
+
|
15
|
+
if raw_path[0] == '/' then
|
16
|
+
directory = raw_path[1..-1]
|
17
|
+
elsif raw_path =~ /^dfs:\/\//
|
18
|
+
@file, directory = parse_path(raw_path)
|
19
|
+
else
|
20
|
+
directory = File.join(@directory, raw_path)
|
21
|
+
end
|
22
|
+
|
23
|
+
if @file.exists? directory then
|
24
|
+
@directory = directory
|
25
|
+
else
|
26
|
+
'No such file or directory'
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
11
31
|
def glob(s)
|
12
32
|
|
13
33
|
if s =~ /^dfs:\/\// then
|
@@ -19,43 +39,43 @@ class DRbFileClientReadWrite < DRbFileClientReader
|
|
19
39
|
@file.glob s2
|
20
40
|
|
21
41
|
end
|
22
|
-
|
42
|
+
|
23
43
|
def mkdir(name)
|
24
|
-
|
44
|
+
|
25
45
|
return FileUtils.mkdir name unless @directory or name =~ /^dfs:\/\//
|
26
|
-
|
46
|
+
|
27
47
|
@file, path = parse_path(name)
|
28
48
|
@file.mkdir path
|
29
49
|
end
|
30
|
-
|
50
|
+
|
31
51
|
def mkdir_p(raw_path)
|
32
|
-
|
52
|
+
|
33
53
|
unless @directory or raw_path =~ /^dfs:\/\// then
|
34
|
-
return FileUtils.mkdir_p raw_path
|
35
|
-
end
|
36
|
-
|
54
|
+
return FileUtils.mkdir_p raw_path
|
55
|
+
end
|
56
|
+
|
37
57
|
if raw_path =~ /^dfs:\/\// then
|
38
58
|
@file, filepath = parse_path(raw_path)
|
39
59
|
else
|
40
60
|
filepath = File.join(@directory, raw_path)
|
41
61
|
end
|
42
|
-
|
62
|
+
|
43
63
|
@file.mkdir_p filepath
|
44
64
|
end
|
45
|
-
|
65
|
+
|
46
66
|
def rm(path)
|
47
|
-
|
67
|
+
|
48
68
|
return FileUtils.rm path unless @directory or path =~ /^dfs:\/\//
|
49
|
-
|
69
|
+
|
50
70
|
if path =~ /^dfs:\/\// then
|
51
71
|
@file, path2 = parse_path( path)
|
52
72
|
else
|
53
73
|
path2 = File.join(@directory, path)
|
54
74
|
end
|
55
|
-
|
75
|
+
|
56
76
|
@file.rm path2
|
57
|
-
|
58
|
-
end
|
77
|
+
|
78
|
+
end
|
59
79
|
|
60
80
|
def rm_r(path, force: false)
|
61
81
|
|
@@ -88,24 +108,27 @@ class DRbFileClientReadWrite < DRbFileClientReader
|
|
88
108
|
@file.touch s2, mtime: mtime
|
89
109
|
|
90
110
|
end
|
91
|
-
|
111
|
+
|
92
112
|
def write(filename=@filename, s)
|
93
|
-
|
113
|
+
|
94
114
|
return File.write filename, s unless @directory or filename =~ /^dfs:\/\//
|
95
|
-
|
115
|
+
|
96
116
|
if filename =~ /^dfs:\/\// then
|
97
117
|
@file, path = parse_path(filename)
|
98
118
|
else
|
99
119
|
path = File.join(@directory, filename)
|
100
120
|
end
|
101
|
-
|
102
|
-
@file.write path, s
|
103
|
-
|
121
|
+
|
122
|
+
@file.write path, s
|
123
|
+
|
104
124
|
end
|
105
125
|
|
106
|
-
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def DfsFile.chdir(path)
|
129
|
+
DRbFileClientReadWrite.new.chdir(path)
|
130
|
+
end
|
107
131
|
|
108
|
-
|
109
132
|
def DfsFile.glob(s)
|
110
133
|
DRbFileClientReadWrite.new.glob(s)
|
111
134
|
end
|
@@ -125,4 +148,3 @@ end
|
|
125
148
|
def DfsFile.write(filename, s)
|
126
149
|
DRbFileClientReadWrite.new.write(filename, s)
|
127
150
|
end
|
128
|
-
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|