drb_fileclient 0.2.3 → 0.3.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.tar.gz.sig +0 -0
- data/lib/drb_fileclient.rb +32 -1
- 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: aac348c86f08cf6f20fd37f2f04e125ce315528d121933e443f64245203977be
|
4
|
+
data.tar.gz: fd32cc6aed4ade30ef24be66b4dc1ff8a479f2bdb08051657f49b40be790524f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 178d73ea28d13d710cafd3342ff635d46d2bfb7a7ccaec458954f776753e1aedbeb89c851dcc7f16f4c4894c6d79b129f0c876a551da79d2b136dfb1b94b60c3
|
7
|
+
data.tar.gz: e6732e09f650c4b8ddb25697de21d37c66c5b2ea2a237f9c0ddff90a78b3501ab96c26f1c75e40bdd403f3a037e2c58d8d4269b6bbff36cc0ce1d16bc8ebf30e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/drb_fileclient.rb
CHANGED
@@ -23,6 +23,8 @@ class DRbFileClient
|
|
23
23
|
|
24
24
|
def chdir(raw_path)
|
25
25
|
|
26
|
+
return Dir.chdir raw_path unless @directory or raw_path =~ /^dfs:\/\//
|
27
|
+
|
26
28
|
directory = if raw_path[0] == '/' then
|
27
29
|
raw_path[1..-1]
|
28
30
|
elsif raw_path =~ /^dfs:\/\//
|
@@ -41,6 +43,10 @@ class DRbFileClient
|
|
41
43
|
|
42
44
|
def cp(raw_path, raw_path2)
|
43
45
|
|
46
|
+
unless @directory or raw_path =~ /^dfs:\/\// then
|
47
|
+
return FileUtils.cp raw_path, raw_path2
|
48
|
+
end
|
49
|
+
|
44
50
|
path, path2 = if raw_path =~ /^dfs:\/\// then
|
45
51
|
[parse_path(raw_path), parse_path(raw_path2)]
|
46
52
|
else
|
@@ -52,6 +58,8 @@ class DRbFileClient
|
|
52
58
|
|
53
59
|
def exists?(filename=@filename)
|
54
60
|
|
61
|
+
return File.exists? filename unless @directory or filename =~ /^dfs:\/\//
|
62
|
+
|
55
63
|
filename2 = if filename =~ /^dfs:\/\// then
|
56
64
|
parse_path(filename)
|
57
65
|
else
|
@@ -59,22 +67,36 @@ class DRbFileClient
|
|
59
67
|
File.join(@directory, filename)
|
60
68
|
end
|
61
69
|
|
62
|
-
@file.exists?(filename2)
|
70
|
+
@file.exists?(filename2)
|
63
71
|
|
64
72
|
end
|
65
73
|
|
74
|
+
alias exist? exists?
|
75
|
+
|
66
76
|
def mkdir(name)
|
77
|
+
|
78
|
+
return FileUtils.mkdir name unless @directory or name =~ /^dfs:\/\//
|
79
|
+
|
67
80
|
path = parse_path(name)
|
68
81
|
@file.mkdir path
|
69
82
|
end
|
70
83
|
|
71
84
|
def mkdir_p(raw_path)
|
85
|
+
|
86
|
+
unless @directory or raw_path =~ /^dfs:\/\// then
|
87
|
+
return FileUtils.mkdir_p raw_path
|
88
|
+
end
|
89
|
+
|
72
90
|
path = parse_path(raw_path)
|
73
91
|
@file.mkdir_p path
|
74
92
|
end
|
75
93
|
|
76
94
|
def mv(raw_path, raw_path2)
|
77
95
|
|
96
|
+
unless @directory or raw_path =~ /^dfs:\/\// then
|
97
|
+
return FileUtils.mv raw_path, raw_path2
|
98
|
+
end
|
99
|
+
|
78
100
|
path, path2 = if raw_path =~ /^dfs:\/\// then
|
79
101
|
[parse_path(raw_path), parse_path(raw_path2)]
|
80
102
|
else
|
@@ -86,12 +108,16 @@ class DRbFileClient
|
|
86
108
|
|
87
109
|
def pwd()
|
88
110
|
|
111
|
+
return Dir.pwd unless @directory
|
112
|
+
|
89
113
|
'/' + @directory if @file
|
90
114
|
|
91
115
|
end
|
92
116
|
|
93
117
|
def read(filename=@filename)
|
94
118
|
|
119
|
+
return File.read filename, s unless @directory or filename =~ /^dfs:\/\//
|
120
|
+
|
95
121
|
path = if filename =~ /^dfs:\/\// then
|
96
122
|
parse_path(filename)
|
97
123
|
else
|
@@ -103,6 +129,8 @@ class DRbFileClient
|
|
103
129
|
|
104
130
|
def rm(path)
|
105
131
|
|
132
|
+
return FileUtils.rm path unless @directory or path =~ /^dfs:\/\//
|
133
|
+
|
106
134
|
path2 = if path =~ /^dfs:\/\// then
|
107
135
|
parse_path( path)
|
108
136
|
else
|
@@ -115,12 +143,15 @@ class DRbFileClient
|
|
115
143
|
|
116
144
|
def write(filename=@filename, s)
|
117
145
|
|
146
|
+
return File.write filename, s unless @directory or filename =~ /^dfs:\/\//
|
147
|
+
|
118
148
|
path = if filename =~ /^dfs:\/\// then
|
119
149
|
parse_path(filename)
|
120
150
|
else
|
121
151
|
File.join(@directory, filename)
|
122
152
|
end
|
123
153
|
|
154
|
+
|
124
155
|
@file.write path, s
|
125
156
|
|
126
157
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|