rxfreadwrite 0.2.4 → 0.2.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: 94f9a14707d151f06a1f227ad5d379c7f89c5420f624fac7fc535eb3e329db48
4
- data.tar.gz: ae350d38c82672a5a8ea7079ad3ef5af520573e9e323460be43aa9303efdf26e
3
+ metadata.gz: a413b0dff84c4e2bcbad1dd82fc0050ee3528a90c8ec47cd0cc5c80dec1d61cb
4
+ data.tar.gz: 8a348a14dcafca0f419327e67ffe4a2bdbfc684125778726805c45dd64f75cba
5
5
  SHA512:
6
- metadata.gz: 54024ecbfa16c5f1b4376d7ac607a873ca7fc30a28ba28170632ddbb0525cfed5607f70f70a0553d041d986d2cbfc13917f7c56388ff84ad8b19fe996703b8c9
7
- data.tar.gz: d9281807a0a2fb3d6fd8723027005af9e3cd18407f810c20d6504fdbc38de406d7b6c9d8e9ef9ea74a070d5bd2f7cc622de8e12d20d8825e2fe5b1a85a79e5de
6
+ metadata.gz: 2f13199d4ac7d9cde364173b822281c80f73445806413c7fd6d2172de1a1bbe2ea5f3e4ce3981305b55f5ee266e397267ca04e0f66b397e5bbb1580275fc4884
7
+ data.tar.gz: ecfc56805572a2dd2571c4bdf866effb587b0f85583579ae99a5a7f2009f11b7acfd6572f87255d6b4bbe9b9a1273a72f5b99619b6ddc0efba0bb31fb6396a3a
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rxfreadwrite.rb CHANGED
@@ -40,6 +40,7 @@ module RXFReadWriteModule
40
40
 
41
41
  end
42
42
 
43
+ def FileX.exists?(s) RXFReadWrite.exists?(s) end
43
44
  def FileX.mkdir(s) RXFReadWrite.mkdir(s) end
44
45
  def FileX.mkdir_p(s) RXFReadWrite.mkdir_p(s) end
45
46
  def FileX.pwd() RXFReadWrite.pwd() end
@@ -67,29 +68,62 @@ end
67
68
  class RXFReadWrite < RXFReader
68
69
  using ColouredText
69
70
 
71
+ @@fs = :local
72
+
73
+ # identifies the working file system
74
+ def self.fs()
75
+ @@fs
76
+ end
70
77
 
71
78
  def self.chdir(x)
72
79
 
73
- # We can use @fs within chdir() to flag the current file system.
80
+ # We can use @@fs within chdir() to flag the current file system.
74
81
  # Allowing us to use relative paths with FileX operations instead
75
82
  # of explicitly stating the path each time. e.g. touch 'foo.txt'
76
83
  #
77
84
 
78
85
  if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
79
86
 
80
- @fs = :local
87
+ @@fs = :local
81
88
  FileUtils.chdir x
82
89
 
83
90
  elsif x[/^dfs:\/\//]
84
91
 
85
92
  host = x[/(?<=dfs:\/\/)[^\/]+/]
86
- @fs = 'dfs://' + host
93
+ @@fs = 'dfs://' + host
87
94
  DfsFile.chdir x
88
95
 
89
96
  end
90
97
 
91
98
  end
92
99
 
100
+ def self.exists?(filename)
101
+
102
+ type = self.filetype(filename)
103
+
104
+ filex = case type
105
+ when :file
106
+ File
107
+ when :dfs
108
+ DfsFile
109
+ else
110
+ nil
111
+ end
112
+
113
+ return nil unless filex
114
+
115
+ filex.exists? filename
116
+
117
+ end
118
+
119
+ def self.filetype(x)
120
+
121
+ return :string if x.lines.length > 1
122
+ return :dfs if @@fs[0..2] == 'dfs'
123
+ RXFReader.filetype(x)
124
+
125
+ end
126
+
93
127
  def self.glob(s)
94
128
 
95
129
  if s[/^dfs:\/\//] then
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rxfreadwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  gnYmJHVhKvNaFwL4ryulhkA+n8o3Ve6Kzo/AGlO2+Ge6H0bqIUbS8UisqDa7IwlY
36
36
  tvleW582+lzMrpAfWdGb4VFX
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-23 00:00:00.000000000 Z
38
+ date: 2022-02-28 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rxfreader
metadata.gz.sig CHANGED
Binary file