rxfhelper 0.6.1 → 0.7.0

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
  SHA1:
3
- metadata.gz: 54be0980feef27333d4ced08e75cb236df8cc9d5
4
- data.tar.gz: d174bf50c955e16dee638b6004ca3340dabd5635
3
+ metadata.gz: 87673c4a0a96ee5aa758c10dcdd818a2846d4a8e
4
+ data.tar.gz: bf717498111b850d98b715352829fd5ba8df06de
5
5
  SHA512:
6
- metadata.gz: 28b21ccf156bd6ea9041fee40f3427ca1a1d6ebe9f0da916ede98ff5818e3c307f4f8d6ec869786138179eda337665ad472778528c2bac22a8b24e84f0488b6d
7
- data.tar.gz: d167e87e7b5b047a2856161e233e00dc6d6c5744d4098f7be68bd04ce185167c95b1181af58f1c16d15d37f76fd428de79b4df74ec7f6bc5b0b362f6a7fc84aa
6
+ metadata.gz: 478cdf4efa2dd219c7467875cec879421234380f6cd6be46593c7ec033402f3c8c11778ccd63fa47724ca17196534d9b4f94c31c3882a1c1e8059a91f70dbf2b
7
+ data.tar.gz: 343a0144e352df8a56a3a1923b72f689e4352af9c39c2a991befa00e2c0f5458bc5c6e9492a808747eb0cadad600079522abfa8b34c4991f30154994160555be
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -6,6 +6,60 @@ require 'rsc'
6
6
  require 'gpd-request'
7
7
  require 'drb_fileclient'
8
8
 
9
+
10
+ module RXFHelperModule
11
+
12
+ class FileX
13
+
14
+ def self.exists?(filename)
15
+
16
+ type = self.filetype(filename)
17
+
18
+ filex = case type
19
+ when :file
20
+ File
21
+ when :dfs
22
+ DfsFile
23
+ else
24
+ nil
25
+ end
26
+
27
+ return nil unless filex
28
+
29
+ filex.exists? filename
30
+
31
+ end
32
+
33
+ def self.filetype(x)
34
+
35
+ return :string if x.lines.length > 1
36
+
37
+ case x
38
+ when /^rse:\/\//
39
+ :rse
40
+ when /^https?:\/\//
41
+ :http
42
+ when /^dfs:\/\//
43
+ :dfs
44
+ when /^file:\/\//
45
+ :file
46
+ else
47
+
48
+ if File.exists?(x) then
49
+ :file
50
+ else
51
+ :text
52
+ end
53
+
54
+ end
55
+ end
56
+
57
+ def self.read(x) RXFHelper.read(x).first end
58
+ def self.write(x, s) RXFHelper.write(x, s) end
59
+
60
+ end
61
+ end
62
+
9
63
  class URL
10
64
 
11
65
  def self.join(*a)
@@ -21,6 +75,7 @@ end
21
75
  #
22
76
  class RXFHelper
23
77
 
78
+
24
79
  def self.get(x)
25
80
 
26
81
  raise RXFHelperException, 'nil found, expected a string' if x.nil?
@@ -62,14 +117,7 @@ class RXFHelper
62
117
 
63
118
  elsif x[/^dfs:\/\//] then
64
119
 
65
- host = x[/(?<=^dfs:\/\/)[^\/:]+/]
66
- port = x[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
67
- filename = x[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
68
-
69
- # read the file using the drb_fileclient
70
- file = DRbFileClient.new host: host, port: port
71
-
72
- [file.read(filename), :dfs]
120
+ [DfsFile.read(x), :dfs]
73
121
 
74
122
  elsif x[/^rse:\/\//] then
75
123
  [RSC.new.get(x), :rse]
@@ -92,13 +140,7 @@ class RXFHelper
92
140
  case uri
93
141
  when /^dfs:\/\//
94
142
 
95
- host = uri[/(?<=^dfs:\/\/)[^\/:]+/]
96
- port = uri[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
97
- filename = uri[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
98
-
99
- # write the file using the drb_fileclient
100
- file = DRbFileClient.new host: host, port: port
101
- file.write filename, s
143
+ DfsFile.write filename, s
102
144
 
103
145
  when /^rse:\/\//
104
146
  RSC.new.post(uri, s)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rxfhelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  8rLqizynNftXvmwVftEH2yQKlc6bsltIk+l2sNVht38tWANd/Zs0H6abD5zkVp2e
32
32
  h6ZEatzAI88gwQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2018-03-22 00:00:00.000000000 Z
34
+ date: 2018-05-26 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rsc
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.3'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.3.1
45
+ version: 0.3.2
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: '0.3'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.3.1
55
+ version: 0.3.2
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: gpd-request
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -79,20 +79,20 @@ dependencies:
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.1'
82
+ version: '0.2'
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 0.1.1
85
+ version: 0.2.0
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: '0.1'
92
+ version: '0.2'
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 0.1.1
95
+ version: 0.2.0
96
96
  description:
97
97
  email: james@jamesrobertson.eu
98
98
  executables: []
metadata.gz.sig CHANGED
Binary file