rxfreader 0.2.1 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rxfreader.rb +61 -41
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 439ac6839199c6d53cb40bbf2a56a73666ecd8c3119a141249284c6dd3c4d2d3
|
4
|
+
data.tar.gz: b67ef02d5fe587838eb6b9647e422b57e4c4528ced5d44b9238a110a26803d7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5498c3ad23d1afd698c6d72800b505c28ec78ab5643d99b8f0b7d45cd1845289adabe01941c4f5b0cc2c304de51144975f0730e92cedb56593f6feb6776296
|
7
|
+
data.tar.gz: b087e28234b235fb6110a328a0ed3a752ff4482c58974c8922fa560acd851d98c4426806d5265b10548b26761d85dbfeb889254026a9cf63ec5136a30d1497e8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rxfreader.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
# file: rxfreader.rb
|
4
4
|
|
5
|
-
|
5
|
+
require 'net/http'
|
6
|
+
require 'uri'
|
6
7
|
require 'gpd-request'
|
7
8
|
require 'rest-client'
|
8
9
|
require 'drb_fileclient-reader'
|
@@ -15,61 +16,61 @@ module RXFRead
|
|
15
16
|
|
16
17
|
class FileX
|
17
18
|
|
18
|
-
def self.exists?(
|
19
|
+
def self.exists?(s) RXFReader.exists?(s) end
|
20
|
+
def self.filetype(s) RXFReader.filetype(s) end
|
21
|
+
def self.read(s) RXFReader.read(s).first end
|
19
22
|
|
20
|
-
|
23
|
+
end
|
21
24
|
|
22
|
-
|
23
|
-
when :file
|
24
|
-
File
|
25
|
-
when :dfs
|
26
|
-
DfsFile
|
27
|
-
else
|
28
|
-
nil
|
29
|
-
end
|
25
|
+
end
|
30
26
|
|
31
|
-
return nil unless filex
|
32
27
|
|
33
|
-
|
28
|
+
class RXFReaderException < Exception
|
29
|
+
end
|
34
30
|
|
35
|
-
|
31
|
+
class RXFReader
|
32
|
+
using ColouredText
|
36
33
|
|
34
|
+
def self.exists?(filename)
|
37
35
|
|
38
|
-
|
36
|
+
type = self.filetype(filename)
|
39
37
|
|
40
|
-
|
38
|
+
filex = case type
|
39
|
+
when :file
|
40
|
+
File
|
41
|
+
when :dfs
|
42
|
+
DfsFile
|
43
|
+
else
|
44
|
+
nil
|
45
|
+
end
|
41
46
|
|
42
|
-
|
43
|
-
when /^https?:\/\//
|
44
|
-
:http
|
45
|
-
when /^dfs:\/\//
|
46
|
-
:dfs
|
47
|
-
when /^file:\/\//
|
48
|
-
:file
|
49
|
-
else
|
47
|
+
return nil unless filex
|
50
48
|
|
51
|
-
|
52
|
-
:file
|
53
|
-
else
|
54
|
-
:text
|
55
|
-
end
|
49
|
+
filex.exists? filename
|
56
50
|
|
57
|
-
|
58
|
-
end
|
51
|
+
end
|
59
52
|
|
60
|
-
|
61
|
-
RXFReader.read(x).first
|
62
|
-
end
|
53
|
+
def self.filetype(x)
|
63
54
|
|
64
|
-
|
65
|
-
end
|
55
|
+
return :string if x.lines.length > 1
|
66
56
|
|
57
|
+
case x
|
58
|
+
when /^https?:\/\//
|
59
|
+
:http
|
60
|
+
when /^dfs:\/\//
|
61
|
+
:dfs
|
62
|
+
when /^file:\/\//
|
63
|
+
:file
|
64
|
+
else
|
67
65
|
|
68
|
-
|
69
|
-
|
66
|
+
if File.exists?(x) then
|
67
|
+
:file
|
68
|
+
else
|
69
|
+
:text
|
70
|
+
end
|
70
71
|
|
71
|
-
|
72
|
-
|
72
|
+
end
|
73
|
+
end
|
73
74
|
|
74
75
|
def self.read(x, h={})
|
75
76
|
|
@@ -79,7 +80,11 @@ class RXFReader
|
|
79
80
|
|
80
81
|
raise RXFReaderException, 'nil found, expected a string' if x.nil?
|
81
82
|
|
82
|
-
if x.
|
83
|
+
if x.class.to_s =~ /Rexle$/ then
|
84
|
+
|
85
|
+
[x.xml, :rexle]
|
86
|
+
|
87
|
+
elsif x.strip[/^<(\?xml|[^\?])/] then
|
83
88
|
|
84
89
|
[x, :xml]
|
85
90
|
|
@@ -131,4 +136,19 @@ class RXFReader
|
|
131
136
|
end
|
132
137
|
end
|
133
138
|
|
139
|
+
def reveal(uri_str, a=[])
|
140
|
+
|
141
|
+
response = Net::HTTP.get_response(URI.parse(uri_str))
|
142
|
+
url = case response
|
143
|
+
when Net::HTTPRedirection then response['location']
|
144
|
+
end
|
145
|
+
|
146
|
+
return a << uri_str if url.nil?
|
147
|
+
|
148
|
+
reveal(url, a << uri_str)
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
|
134
154
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rxfreader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ZhYGFOGLCyFBzNWg6gwMKjzpzDZB/H0+GTRB2c3+7DVuJWqyC5SbGnVLkT4Q8+B6
|
36
36
|
Ws39Z48SRONdDWtHwAiUtnU+
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: gpd-request
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
version: '0.1'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.1.
|
89
|
+
version: 0.1.3
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '0.1'
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.1.
|
99
|
+
version: 0.1.3
|
100
100
|
description:
|
101
101
|
email: digital.robertson@gmail.com
|
102
102
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|