drb_fileclient-readwrite 0.1.2 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c11f979d3129017d789fb09a7022af2104de1c2fb35d385128a5cf53afe726c9
4
- data.tar.gz: b93252e86f9579821ef68b2ec9a6c46be15835210d50ffb30dd53b5b9cfa1b15
3
+ metadata.gz: 81c907cd7a0b84106eb65ed0c0cffec5529c5842f000995c8d5504d13db63bc2
4
+ data.tar.gz: e44fec001e94b68e73a9569ecde44fedff79542674ee73769bec909162dadf47
5
5
  SHA512:
6
- metadata.gz: 63e76494d108d9ceca15c7a51764d2f920c9a3f1305dfa7d8cd167324c579d76b6c35c52046d005ff072c7420852a76933c165a55f5bc811ec07c0c1a8345018
7
- data.tar.gz: 25855a03faf8552963945e3a7d765ff8b363fdd936be76159a3b97fc2a394391279d16dfb847577650a9f567d4c4ce2632ebed4457620bfa98aea8145bf8e9ea
6
+ metadata.gz: 90a356f7fecd376992afdf45d49ce2c041913970add9f90f5f16b1065d47c94f42dde9e8c75429eef30edc3f2fa660f178582f4cc84b5b98b0bdd436c74b44cf
7
+ data.tar.gz: ceaf0b22f952a19aed844ba7000533406bc8842fe7ea4524b84ee55a226dbb0e88e114fa008b6c0a9b180581cbc16f56f5c0abf850cdee846cac7cccf2bf900d
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- ʦ1���:Q��UbfK�Di?V����(p[UiXsw�B�.I�ab&Ab=&:���0�&���A!`L~V����F�ȹ����w�5��X 0�jR�
2
- V��a�����i�y����ch�L�E���V�K�c��΍c�h���}����� �Ʀ���!��>s,���K�����^/�Z��Ǻ�L��C��c�v�[��*��՛V�%�o�G��#�F��?�����C��ۅ�Q�P��7�A��~m�,:���;f
3
- �_�~��Z�������Ũ�C5����3/�(��'���c�nb��x���9쓴�];����ujg�� }��-e���
1
+ �L��,|�?
2
+ ���C�� ��
3
+ ��<7]~큀md/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,118 +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 @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 = 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
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
 
38
+ def directory?(filename=@@filename)
39
+
40
+ return File.directory? filename unless @@directory or filename =~ /^dfs:\/\//
41
+
42
+ if filename =~ /^dfs:\/\// then
43
+ @@file, filename2 = parse_path(filename)
44
+ else
45
+
46
+ filename2 = File.join(@@directory, filename)
47
+ end
48
+
49
+ @@file.directory?(filename2)
50
+
51
+ end
52
+
31
53
  def glob(s)
32
54
 
33
55
  if s =~ /^dfs:\/\// then
34
- @file, s2 = parse_path(s)
56
+ @@file, s2 = parse_path(s)
35
57
  else
36
- s2 = File.join(@directory, s)
58
+ s2 = File.join(@@directory, s)
37
59
  end
38
60
 
39
- @file.glob s2
61
+ @@file.glob s2
40
62
 
41
63
  end
42
64
 
43
65
  def mkdir(name)
44
66
 
45
- return FileUtils.mkdir name unless @directory or name =~ /^dfs:\/\//
67
+ return FileUtils.mkdir name unless @@directory or name =~ /^dfs:\/\//
46
68
 
47
- @file, path = parse_path(name)
48
- @file.mkdir path
69
+ @@file, path = parse_path(name)
70
+ @@file.mkdir path
49
71
  end
50
72
 
51
73
  def mkdir_p(raw_path)
52
74
 
53
- unless @directory or raw_path =~ /^dfs:\/\// then
75
+ unless @@directory or raw_path =~ /^dfs:\/\// then
54
76
  return FileUtils.mkdir_p raw_path
55
77
  end
56
78
 
57
79
  if raw_path =~ /^dfs:\/\// then
58
- @file, filepath = parse_path(raw_path)
80
+ @@file, filepath = parse_path(raw_path)
59
81
  else
60
- filepath = File.join(@directory, raw_path)
82
+ filepath = File.join(@@directory, raw_path)
61
83
  end
62
84
 
63
- @file.mkdir_p filepath
85
+ @@file.mkdir_p filepath
86
+ end
87
+
88
+ def pwd()
89
+
90
+ puts 'inside pwd'
91
+ puts '@@directory: ' + @@directory.inspect
92
+ puts '@@file: ' + @@file.inspect
93
+
94
+ return Dir.pwd unless @@directory
95
+
96
+ '/' + @@directory if @@file
97
+
64
98
  end
65
99
 
66
100
  def rm(path)
67
101
 
68
- return FileUtils.rm path unless @directory or path =~ /^dfs:\/\//
102
+ return FileUtils.rm path unless @@directory or path =~ /^dfs:\/\//
69
103
 
70
104
  if path =~ /^dfs:\/\// then
71
- @file, path2 = parse_path( path)
105
+ @@file, path2 = parse_path( path)
72
106
  else
73
- path2 = File.join(@directory, path)
107
+ path2 = File.join(@@directory, path)
74
108
  end
75
109
 
76
- @file.rm path2
110
+ @@file.rm path2
77
111
 
78
112
  end
79
113
 
80
114
  def rm_r(path, force: false)
81
115
 
82
- unless @directory or path =~ /^dfs:\/\// then
116
+ unless @@directory or path =~ /^dfs:\/\// then
83
117
  return FileUtils.rm_r(path, force: force)
84
118
  end
85
119
 
86
120
  if path =~ /^dfs:\/\// then
87
- @file, path2 = parse_path( path)
121
+ @@file, path2 = parse_path( path)
88
122
  else
89
- path2 = File.join(@directory, path)
123
+ path2 = File.join(@@directory, path)
90
124
  end
91
125
 
92
- @file.rm_r(path2, force: force)
126
+ @@file.rm_r(path2, force: force)
93
127
 
94
128
  end
95
129
 
96
130
  def touch(s, mtime: Time.now)
97
131
 
98
- unless @directory or s =~ /^dfs:\/\// then
132
+ unless @@directory or s =~ /^dfs:\/\// then
99
133
  return FileUtils.touch(s, mtime: mtime)
100
134
  end
101
135
 
102
136
  if s =~ /^dfs:\/\// then
103
- @file, s2 = parse_path(s)
137
+ @@file, s2 = parse_path(s)
104
138
  else
105
- s2 = File.join(@directory, s)
139
+ s2 = File.join(@@directory, s)
106
140
  end
107
141
 
108
- @file.touch s2, mtime: mtime
142
+ @@file.touch s2, mtime: mtime
109
143
 
110
144
  end
111
145
 
112
- def write(filename=@filename, s)
146
+ def write(filename=@@filename, s)
113
147
 
114
- return File.write filename, s unless @directory or filename =~ /^dfs:\/\//
148
+ return File.write filename, s unless @@directory or filename =~ /^dfs:\/\//
115
149
 
116
150
  if filename =~ /^dfs:\/\// then
117
- @file, path = parse_path(filename)
151
+ @@file, path = parse_path(filename)
118
152
  else
119
- path = File.join(@directory, filename)
153
+ path = File.join(@@directory, filename)
120
154
  end
121
155
 
122
- @file.write path, s
156
+ @@file.write path, s
123
157
 
124
158
  end
125
159
 
@@ -129,6 +163,10 @@ def DfsFile.chdir(path)
129
163
  DRbFileClientReadWrite.new.chdir(path)
130
164
  end
131
165
 
166
+ def DfsFile.directory?(filename)
167
+ DRbFileClient.new.directory?(filename)
168
+ end
169
+
132
170
  def DfsFile.glob(s)
133
171
  DRbFileClientReadWrite.new.glob(s)
134
172
  end
@@ -141,6 +179,10 @@ def DfsFile.mkdir_p(filename)
141
179
  DRbFileClientReadWrite.new.mkdir_p(filename)
142
180
  end
143
181
 
182
+ def DfsFile.pwd()
183
+ DRbFileClientReadWrite.new.pwd()
184
+ end
185
+
144
186
  def DfsFile.rm(filename)
145
187
  DRbFileClientReadWrite.new.rm(filename)
146
188
  end
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.2
4
+ version: 0.1.5
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-22 00:00:00.000000000 Z
38
+ date: 2022-02-23 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.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.0
59
+ version: 0.1.1
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
metadata.gz.sig CHANGED
Binary file