rack-rscript 0.5.13 → 0.6.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: 8f7048b6d779c63080e07706a375954ebf06cb5c
4
- data.tar.gz: 91c4353b330f37de876d70ab40a751f902292839
3
+ metadata.gz: 7e91ccd69711661b6bb375ce86441b1524b0be81
4
+ data.tar.gz: d11497571141816831e14fb057e9a69470b134d9
5
5
  SHA512:
6
- metadata.gz: 18db933294f97a1139f6a89522ca96f3f8d82ffdfc106e5eefefcc419d372da93cb2e6b422284f7e51c8da0264e92767171780f719c579bf958ef67339fc714c
7
- data.tar.gz: d3f9d2bfdd9ac0a0ea48f6fc0b1ff372c95b4b4df9d13b872cec6ff6b30ab7dc8b23c7fd768712a19d8d8c0f15dbb5d8f58004f590db2f71fe8740250938cc37
6
+ metadata.gz: 22ef3db250768d04eda444a1ce65db583ca8e3a3a7d4faf2554ce4a15ff134c3fff5a4c098a923e571ac84d5b3dc6b5f4ffa2c74b3ac4df7a3cbaa061b2690e5
7
+ data.tar.gz: 9d06e9f466a75168eba1d2e9c6d3ca4c05055c1fd23df236e40e082ac700c9f74572c390be3f7585570f551c7c7dbe2e76966d4dd41ee11c78797a40b5a55eab
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/rack-rscript.rb CHANGED
@@ -9,6 +9,7 @@ require 'logger'
9
9
  require 'haml'
10
10
  require 'slim'
11
11
  require 'tilt'
12
+ require 'websocket-eventmachine-client'
12
13
 
13
14
  class Redirect
14
15
  attr_reader :to_url
@@ -21,13 +22,16 @@ end
21
22
  class RackRscript
22
23
  include AppRoutes
23
24
 
25
+ attr_reader :ws
26
+
24
27
  def initialize(raw_opts={})
25
28
  @params = {}
26
29
  @templates = {}
27
30
 
28
31
  @rrscript = RScript.new
29
32
 
30
- opts = {logfile: '', logrotate: 'daily', pkg_src: ''}.merge(raw_opts)
33
+ opts = {logfile: '', logrotate: 'daily', pkg_src: '', sps_port: 59000}\
34
+ .merge(raw_opts)
31
35
  @url_base = opts[:pkg_src] # web server serving the RSF files
32
36
  @url_base += '/' unless @url_base[-1] == '/'
33
37
 
@@ -40,6 +44,34 @@ class RackRscript
40
44
 
41
45
  super() # required for app-routes initialize method to exectue
42
46
  default_routes(@env, @params)
47
+
48
+ if opts[:sps_address] then
49
+
50
+ c = WebSocket::EventMachine::Client
51
+
52
+ Thread.new do
53
+
54
+ EM.run do
55
+
56
+ @ws = c.connect(uri: "ws://%s:%s" % [opts[:sps_address], opts[:sps_port]])
57
+
58
+ @ws.onopen do
59
+ puts "Client connected"
60
+ end
61
+
62
+ @ws.onclose do
63
+ puts "Client disconnected"
64
+ end
65
+
66
+ EventMachine.error_handler{ |e|
67
+ puts "Error raised during event loop: #{e.message}"
68
+
69
+ }
70
+
71
+ end
72
+
73
+ end
74
+ end
43
75
  end
44
76
 
45
77
  def call(env)
@@ -49,7 +81,7 @@ class RackRscript
49
81
  log "_: " + env.keys.inspect
50
82
  log Time.now.to_s + "_: " + env.inspect
51
83
  req = Rack::Request.new(env)
52
- log 'params : ' + req.params.inspect
84
+
53
85
  @req_params = req.params
54
86
  default_routes(env,@params)
55
87
  content, content_type, status_code = run_route(request, env['REQUEST_METHOD'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-rscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  oGNzP1rxjANUGW/2lTKop1erzGf0J+T5D99GqIMDOgY0isR8aE/vL7wcicJB/4tg
32
32
  3HU/e1wiHvcI6A==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-02-17 00:00:00.000000000 Z
34
+ date: 2014-02-18 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
@@ -117,6 +117,20 @@ dependencies:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
+ - !ruby/object:Gem::Dependency
121
+ name: websocket-eventmachine-client
122
+ requirement: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ type: :runtime
128
+ prerelease: false
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
120
134
  description:
121
135
  email: james@r0bertson.co.uk
122
136
  executables: []
metadata.gz.sig CHANGED
Binary file