drb_fileclient-readwrite 0.1.3 → 0.1.6

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: b75b32f3dacb08f9e07f4e372e8fdefdd593f5091c79a9eea168d92d75e859d4
4
- data.tar.gz: fa8f294001ea716daeacac43a9c27ecbd66b30ad9bbb4ecd53968c9eeb8eaebd
3
+ metadata.gz: cdee5be8a5a8f50bb64bac4b20be6580f95273a95b95efe1fa662df3c5937a9b
4
+ data.tar.gz: 9bc4201c35a3ae9745c0fb2c8be06237add99f6dea64c38ea51d1dab76d2b058
5
5
  SHA512:
6
- metadata.gz: b935abfca5cb54d65bc2fecf8fc4545b6e1c185276d44c9fe517d798b675cd34494aac872098d79710c6489cacd65eab186ef60f84506e1c470961b780694a60
7
- data.tar.gz: 21edf6b3edc0a65fb5aee6252a3de64097bfa7d34265b3ceae181ceb0b2255f1e4dacaea425e307503d4906a501263299533298236299fb3377b13115dc2afac
6
+ metadata.gz: 308835d9b6ef51e7ab8f02cc1943057d8168bfaa34d30d1c00d264c8de158d8ec055cb2bfd8f213d98279b5ff05626bed9f8ef7b08fb4f60dd8462fad7fc6405
7
+ data.tar.gz: 0e2d3ee0d6ec2c0429497b924be7adc7185f7800c6a785f04452ea8ba378dea54b83902c87bcc66aa0a94c90938fa8f939af0f41853386dc4b1f69c5a20eb158
checksums.yaml.gz.sig CHANGED
Binary file
@@ -8,133 +8,173 @@ 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
+ @@uri_prefix ||= nil
15
+ end
16
+
11
17
  def chdir(raw_path)
12
18
 
13
- return Dir.chdir raw_path unless @directory or raw_path =~ /^dfs:\/\//
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
- @file, directory = parse_path(raw_path)
24
+ @@file, directory, @@uri_prefix = parse_path(raw_path)
19
25
  else
20
- directory = File.join(@directory, raw_path)
26
+ directory = File.join(@@directory, raw_path)
21
27
  end
22
28
 
23
- if @file.exists? directory then
24
- @directory = directory
29
+ if @@file.exists? directory then
30
+ @@directory = directory
25
31
  else
26
32
  'No such file or directory'
27
33
  end
28
34
 
29
35
  end
30
36
 
31
- def directory?(filename=@filename)
37
+ def directory?(filename=@@filename)
32
38
 
33
- return File.directory? filename unless @directory or filename =~ /^dfs:\/\//
39
+ return File.directory? filename unless @@directory or filename =~ /^dfs:\/\//
34
40
 
35
41
  if filename =~ /^dfs:\/\// then
36
- @file, filename2 = parse_path(filename)
42
+ @@file, filename2 = parse_path(filename)
37
43
  else
38
44
 
39
- filename2 = File.join(@directory, filename)
45
+ filename2 = File.join(@@directory, filename)
40
46
  end
41
47
 
42
- @file.directory?(filename2)
48
+ @@file.directory?(filename2)
43
49
 
44
50
  end
45
51
 
46
52
  def glob(s)
47
53
 
48
54
  if s =~ /^dfs:\/\// then
49
- @file, s2 = parse_path(s)
55
+ @@file, s2 = parse_path(s)
50
56
  else
51
- s2 = File.join(@directory, s)
57
+ s2 = File.join(@@directory, s)
52
58
  end
53
59
 
54
- @file.glob s2
60
+ @@file.glob s2
55
61
 
56
62
  end
57
63
 
58
- def mkdir(name)
64
+ def mkdir(raw_path)
65
+
66
+ unless @@directory or raw_path =~ /^dfs:\/\// then
67
+ return FileUtils.mkdir raw_path
68
+ end
69
+
70
+ if raw_path =~ /^dfs:\/\// then
71
+ @@file, filepath = parse_path(raw_path)
72
+ else
59
73
 
60
- return FileUtils.mkdir name unless @directory or name =~ /^dfs:\/\//
74
+ if @@uri_prefix then
75
+ @@file, filepath = parse_path(File.join(@@uri_prefix, @@directory,
76
+ raw_path))
77
+ else
78
+ filepath = File.join(@@directory, raw_path)
79
+ end
61
80
 
62
- @file, path = parse_path(name)
63
- @file.mkdir path
81
+ end
82
+
83
+ @@file.mkdir filepath
64
84
  end
65
85
 
66
86
  def mkdir_p(raw_path)
67
87
 
68
- unless @directory or raw_path =~ /^dfs:\/\// then
88
+ unless @@directory or raw_path =~ /^dfs:\/\// then
69
89
  return FileUtils.mkdir_p raw_path
70
90
  end
71
91
 
72
92
  if raw_path =~ /^dfs:\/\// then
73
- @file, filepath = parse_path(raw_path)
93
+ @@file, filepath = parse_path(raw_path)
74
94
  else
75
- filepath = File.join(@directory, raw_path)
95
+
96
+ if @@uri_prefix then
97
+ @@file, filepath = parse_path(File.join(@@uri_prefix, @@directory,
98
+ raw_path))
99
+ else
100
+ filepath = File.join(@@directory, raw_path)
101
+ end
102
+
76
103
  end
77
104
 
78
- @file.mkdir_p filepath
105
+ puts 'drb_fileclient-readwrite inside mkdir_p: ' + filepath.inspect
106
+ @@file.mkdir_p filepath
107
+ end
108
+
109
+ def pwd()
110
+
111
+ puts 'inside pwd'
112
+ puts '@@directory: ' + @@directory.inspect
113
+ puts '@@file: ' + @@file.inspect
114
+
115
+ return Dir.pwd unless @@directory
116
+
117
+ '/' + @@directory if @@file
118
+
79
119
  end
80
120
 
81
121
  def rm(path)
82
122
 
83
- return FileUtils.rm path unless @directory or path =~ /^dfs:\/\//
123
+ return FileUtils.rm path unless @@directory or path =~ /^dfs:\/\//
84
124
 
85
125
  if path =~ /^dfs:\/\// then
86
- @file, path2 = parse_path( path)
126
+ @@file, path2 = parse_path( path)
87
127
  else
88
- path2 = File.join(@directory, path)
128
+ path2 = File.join(@@directory, path)
89
129
  end
90
130
 
91
- @file.rm path2
131
+ @@file.rm path2
92
132
 
93
133
  end
94
134
 
95
135
  def rm_r(path, force: false)
96
136
 
97
- unless @directory or path =~ /^dfs:\/\// then
137
+ unless @@directory or path =~ /^dfs:\/\// then
98
138
  return FileUtils.rm_r(path, force: force)
99
139
  end
100
140
 
101
141
  if path =~ /^dfs:\/\// then
102
- @file, path2 = parse_path( path)
142
+ @@file, path2 = parse_path( path)
103
143
  else
104
- path2 = File.join(@directory, path)
144
+ path2 = File.join(@@directory, path)
105
145
  end
106
146
 
107
- @file.rm_r(path2, force: force)
147
+ @@file.rm_r(path2, force: force)
108
148
 
109
149
  end
110
150
 
111
151
  def touch(s, mtime: Time.now)
112
152
 
113
- unless @directory or s =~ /^dfs:\/\// then
153
+ unless @@directory or s =~ /^dfs:\/\// then
114
154
  return FileUtils.touch(s, mtime: mtime)
115
155
  end
116
156
 
117
157
  if s =~ /^dfs:\/\// then
118
- @file, s2 = parse_path(s)
158
+ @@file, s2 = parse_path(s)
119
159
  else
120
- s2 = File.join(@directory, s)
160
+ s2 = File.join(@@directory, s)
121
161
  end
122
162
 
123
- @file.touch s2, mtime: mtime
163
+ @@file.touch s2, mtime: mtime
124
164
 
125
165
  end
126
166
 
127
- def write(filename=@filename, s)
167
+ def write(filename=@@filename, s)
128
168
 
129
- return File.write filename, s unless @directory or filename =~ /^dfs:\/\//
169
+ return File.write filename, s unless @@directory or filename =~ /^dfs:\/\//
130
170
 
131
171
  if filename =~ /^dfs:\/\// then
132
- @file, path = parse_path(filename)
172
+ @@file, path = parse_path(filename)
133
173
  else
134
- path = File.join(@directory, filename)
174
+ path = File.join(@@directory, filename)
135
175
  end
136
176
 
137
- @file.write path, s
177
+ @@file.write path, s
138
178
 
139
179
  end
140
180
 
@@ -145,7 +185,7 @@ def DfsFile.chdir(path)
145
185
  end
146
186
 
147
187
  def DfsFile.directory?(filename)
148
- DRbFileClient.new.directory?(filename)
188
+ DRbFileClientReadWrite.new.directory?(filename)
149
189
  end
150
190
 
151
191
  def DfsFile.glob(s)
@@ -160,6 +200,10 @@ def DfsFile.mkdir_p(filename)
160
200
  DRbFileClientReadWrite.new.mkdir_p(filename)
161
201
  end
162
202
 
203
+ def DfsFile.pwd()
204
+ DRbFileClientReadWrite.new.pwd()
205
+ end
206
+
163
207
  def DfsFile.rm(filename)
164
208
  DRbFileClientReadWrite.new.rm(filename)
165
209
  end
data.tar.gz.sig CHANGED
@@ -1,6 +1 @@
1
- _w�z&I���L�
2
- �6]�}mT\�_7�rTf/�l�]j`���r|TK�D� ����̩˨�G
3
- ��Z��Rn9v���L��5��F?�2Q���X��ĺ�
4
- ��2��Ԕ�I��!0Ӆ+��j�F!�Q�/n�ea�h�s�{o
5
- k���?��D�>�0���W
6
- o���9��U��j%��*<?p����<Q4��;U���ކd_s�#W5�^�Z�x�3�Uw�V�s���%��x��G;CJ}X�&&�������p��ۤ��*�p��>�e8�aY�l���)/@��Iә��pQ�A�l�r>h�g6XPm��W!z~ ]?�L�(c�,��&�L�8~f��_9(���?�
1
+ ŧU�^h~L��:K��4��6��D'�ŕL��/~�-]'���6��k1�����S}��<�D��*Ml�
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.3
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ILzVBTpjvSiaWCjFvxvVJFct97WGSbaR2jPvZ03xyAONtWdKkv2yceiyfAMaldSQ
36
36
  eftJvciSPh0DHzyI46OGIkLX
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-23 00:00:00.000000000 Z
38
+ date: 2022-02-25 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: drb_fileclient-reader
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '0.1'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.1.0
49
+ version: 0.1.3
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.0
59
+ version: 0.1.3
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
metadata.gz.sig CHANGED
Binary file