drb_fileclient 0.2.3 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea9cc771c048915a82829d8345a4cdae23b9f2aab572a874f324b3d8d69bde09
4
- data.tar.gz: 1f52d8f7bdbfe796c83ecc876967e3037c2727312f9deb55f55d28e428281f22
3
+ metadata.gz: aac348c86f08cf6f20fd37f2f04e125ce315528d121933e443f64245203977be
4
+ data.tar.gz: fd32cc6aed4ade30ef24be66b4dc1ff8a479f2bdb08051657f49b40be790524f
5
5
  SHA512:
6
- metadata.gz: dec077dc8a983eae80ac378dfc8676d5d06cda7885894e9babc852f4a37af3c3bf5e7c24f87a85b67dc8e81b5591ed3270c2f18d3ef87aed8492124580c645b4
7
- data.tar.gz: 59b140c1071ae5bb3a930580e8446e468b1f562dd604d5d40ca9d5278b519205e3a85daf92f73f6d5868b88cfd2274c156cab36f6f7a961ae58ce3a918a60626
6
+ metadata.gz: 178d73ea28d13d710cafd3342ff635d46d2bfb7a7ccaec458954f776753e1aedbeb89c851dcc7f16f4c4894c6d79b129f0c876a551da79d2b136dfb1b94b60c3
7
+ data.tar.gz: e6732e09f650c4b8ddb25697de21d37c66c5b2ea2a237f9c0ddff90a78b3501ab96c26f1c75e40bdd403f3a037e2c58d8d4269b6bbff36cc0ce1d16bc8ebf30e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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) if @directory
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb_fileclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file