rxfhelper 0.4.3 → 0.5.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: 195986b86e0d60bb9346adfc4925779c669c9d29
4
- data.tar.gz: 872c5ae619b89fc1d2747c69ea6923b7dffab3ad
3
+ metadata.gz: 4b9ea74eba565e4fdb40137c15d852b213d14afc
4
+ data.tar.gz: 95dadb87e008726f89f7c6dd45b9a390ef6df404
5
5
  SHA512:
6
- metadata.gz: b6d8a8edf06a122eca55879da55d84cb89c664d2be684f458926418b221214f111c5348079c1cc7d4c156ca5b20a506cd3f267bde331788982ba0d9eb0fbd6af
7
- data.tar.gz: 2b0d8493c271390ac1a2e6ea6a7f45ebce027ddfa599e2591449768adb12fc353fa30abbddd7254a6ee3b087df2bf9a32ea62121f1713af534de3b26f77ee61e
6
+ metadata.gz: 71c267a3cfc62f077a124b47b5d62f13be47fbd4f4dce23aaac31ea7aef3f5a0f9b2ef4a9b683d87230378478fabc63c9ccfdd79490e39eb78473b3477f7c4d1
7
+ data.tar.gz: 140de327a5bbdf6555ec69b14c9a7503254f278705defdc49b64b9ed003c1f35211bc38de4d3046f14e4ef481bea78ada0b01e08111c3193ac602a63455135f5
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -3,6 +3,7 @@
3
3
  # file: rxfhelper.rb
4
4
 
5
5
  require 'gpd-request'
6
+ require 'drb_fileclient'
6
7
 
7
8
  class URL
8
9
 
@@ -45,7 +46,18 @@ class RXFHelper
45
46
  end
46
47
 
47
48
  [r.body, :url]
49
+
50
+ elsif x[/^dfs:\/\//] then
51
+
52
+ host = x[/(?<=^dfs:\/\/)[^\/:]+/]
53
+ port = x[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
54
+ filename = x[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
48
55
 
56
+ # read the file using the drb_fileclient
57
+ file = DRbFileClient.new host: host, port: port
58
+
59
+ [file.read(filename), :dfs]
60
+
49
61
  elsif x[/^file:\/\//] or File.exists?(x) then
50
62
  [File.read(File.expand_path(x.sub(%r{^file://}, ''))), :file]
51
63
  elsif x =~ /\s/
@@ -59,6 +71,24 @@ class RXFHelper
59
71
  [x, :unknown]
60
72
  end
61
73
  end
74
+
75
+ def self.write(uri, s)
76
+
77
+ case uri
78
+ when /^dfs:\/\//
79
+
80
+ host = uri[/(?<=^dfs:\/\/)[^\/:]+/]
81
+ port = uri[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
82
+ filename = uri[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
83
+
84
+ # write the file using the drb_fileclient
85
+ file = DRbFileClient.new host: host, port: port
86
+ file.write filename, s
87
+
88
+ else
89
+ File.write(uri, s)
90
+ end
91
+ end
62
92
 
63
93
  def self.absolute_url(page_url, item_location)
64
94
 
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.4.3
4
+ version: 0.5.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: 2017-09-25 00:00:00.000000000 Z
34
+ date: 2018-01-24 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gpd-request
@@ -53,6 +53,26 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.3.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: drb_fileclient
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.1.0
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.1'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.0
56
76
  description:
57
77
  email: james@jamesrobertson.eu
58
78
  executables: []
@@ -84,5 +104,5 @@ rubygems_version: 2.6.13
84
104
  signing_key:
85
105
  specification_version: 4
86
106
  summary: Helpful library for primarily reading the contents of a file either from
87
- an HTTP address or a local file.
107
+ an HTTP address, local file, or DRb file system.
88
108
  test_files: []
metadata.gz.sig CHANGED
Binary file