plezi 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/plezi/eventmachine/io.rb +1 -0
- data/lib/plezi/handlers/controller_magic.rb +3 -5
- data/lib/plezi/server/websocket.rb +8 -5
- data/lib/plezi/server/ws_response.rb +2 -2
- data/lib/plezi/version.rb +1 -1
- data/plezi.gemspec +2 -2
- data/resources/websockets.js +28 -0
- data/test/plezi_tests.rb +1 -1
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39d10feca5a72236133883875628f43ae714a86
|
4
|
+
data.tar.gz: a1accf79bbde62e52e63836158e2e16d32cff059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94655b0900f4c5c69ac17c81cd3ee83af7c19ce8e459bb523766210b92e9c16c2d56977f4537665c19985dd5a77638bc93505abb85af8a515162d167f378017
|
7
|
+
data.tar.gz: dcdff9a3dd5ec25ef4c6d6ffb43714b52552df92e49258744841902371ad094dd1232cf0bd951e2a69b0773557d50bd8e29125c9f36016804354878883780f80
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
***
|
4
4
|
|
5
|
+
Change log v.0.8.7
|
6
|
+
|
7
|
+
**minor performance**: streamlined the ping/pong Websocket process.
|
8
|
+
|
9
|
+
**fix**: fixed an issue with the auto-utilization of the I18n gem, where one request could set the locale for all subsequent requests that are processed by the same thread.
|
10
|
+
|
11
|
+
**deprecation warning**: The current code for default error pages will be changed in version 0.9.0, so that default error pages will follow a different naming convention and would be searched for in a different location. The updated design will be part of the updated `plezi` helper script. Please review your code before upgrading to the 0.9.0 version.
|
12
|
+
|
13
|
+
***
|
14
|
+
|
5
15
|
Change log v.0.8.6
|
6
16
|
|
7
17
|
**fix**: fixed an issue with the plezi helper script that prevented the script from starting the Plezi app or Plezi console.
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ to create a new barebones app using the Plezi framework, run from terminal:
|
|
33
33
|
|
34
34
|
$ plezi new appname
|
35
35
|
|
36
|
-
That's it, now you have a ready to use basic web server (with some demo code),
|
36
|
+
That's it, now you have a ready to use basic web server (with some demo code). If you're on MacOS or linux you can simply double click the `appname` script file in the `appname` folder. Or, from the terminal, you can type:
|
37
37
|
|
38
38
|
$ cd appname
|
39
39
|
$ ./appname # ( or: plezi s )
|
@@ -213,6 +213,7 @@ module Plezi
|
|
213
213
|
Plezi.run_every(3_600) {GC.start; Plezi.info "Refreshing worker threads."; EventMachine.stop; EventMachine.start Plezi.max_threads}
|
214
214
|
# run_every( 1 , Proc.new() { Plezi.info "#{IO_CONNECTION_DIC.length} active connections ( #{ IO_CONNECTION_DIC.select{|k,v| v.protocol.is_a?(WSProtocol)} .length } websockets)." })
|
215
215
|
# run_every 10 , -> {Plezi.info "Cache report: #{CACHE_STORE.length} objects cached." }
|
216
|
+
puts "** Deprecation Warning:\n- The current code for default error pages will be changed in version 0.9.0.\n- Default error pages will follow a different naming and location conventions.\n- The updated design will be part of the updated `plezi` helper script.\nPlease review your code before upgrading to the 0.9.0 version.\n"
|
216
217
|
puts "Services running Plezi version #{Plezi::VERSION}. Press ^C to stop"
|
217
218
|
EventMachine.start Plezi.max_threads
|
218
219
|
|
@@ -203,7 +203,7 @@ module Plezi
|
|
203
203
|
options[:type] ||= 'html'
|
204
204
|
options[:locale] ||= params[:locale].to_sym if params[:locale]
|
205
205
|
# options[:locals] ||= {}
|
206
|
-
I18n.locale = options[:locale] if defined?(I18n) && options[:locale]
|
206
|
+
I18n.locale = options[:locale] || I18n.default_locale if defined?(I18n) # sets the locale to nil for default behavior even if the locale was set by a previous action - removed: # && options[:locale]
|
207
207
|
# find template and create template object
|
208
208
|
filename = template.is_a?(String) ? File.join( host_params[:templates].to_s, template) : (File.join( host_params[:templates].to_s, *template.to_s.split('_')) + (options[:type].empty? ? '': ".#{options[:type]}") + '.slim')
|
209
209
|
return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Slim::Template.new() { IO.read filename } ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Slim) && Plezi.file_exists?(filename)
|
@@ -453,7 +453,7 @@ module Plezi
|
|
453
453
|
true
|
454
454
|
end
|
455
455
|
|
456
|
-
# WebSockets.
|
456
|
+
# WebSockets: fires an event on all of this controller's active websocket connections.
|
457
457
|
#
|
458
458
|
# Class method.
|
459
459
|
#
|
@@ -471,9 +471,7 @@ module Plezi
|
|
471
471
|
__inner_redis_broadcast(nil, nil, method_name, args, &block) || __inner_process_broadcast(nil, nil, method_name.to_sym, args, &block)
|
472
472
|
end
|
473
473
|
|
474
|
-
# WebSockets.
|
475
|
-
#
|
476
|
-
# Class method.
|
474
|
+
# WebSockets: fires an event on a specific websocket connection using it's UUID.
|
477
475
|
#
|
478
476
|
# Use this to unidcast an event to specific websocket connection using it's UUID.
|
479
477
|
#
|
@@ -162,13 +162,16 @@ module Plezi
|
|
162
162
|
@extentions.each {|ex| SUPPORTED_EXTENTIONS[ex[0]][1].call(@parser_data[:body], ex[1..-1]) if SUPPORTED_EXTENTIONS[ex[0]]}
|
163
163
|
|
164
164
|
case @parser_data[:op_code]
|
165
|
-
when 9
|
166
|
-
# handle @parser_data[:op_code] == 9 (ping)
|
167
|
-
Plezi.callback @connection, :send_nonblock, WSResponse.frame_data(@parser_data[:body].pack('C*'), 10) #
|
168
|
-
@parser_op_code = nil if @parser_op_code == 9
|
165
|
+
when 9 # ping
|
166
|
+
# handle @parser_data[:op_code] == 9 (ping)
|
167
|
+
Plezi.callback @connection, :send_nonblock, WSResponse.frame_data(@parser_data[:body].pack('C*'), 10) # "\x8A\x00" can't be used, because body should be returned. # sends pong op_code == 10
|
168
|
+
@parser_op_code = nil if @parser_op_code == 9
|
169
|
+
when 10 #pong
|
170
|
+
# handle @parser_data[:op_code] == 10 (pong)
|
171
|
+
@parser_op_code = nil if @parser_op_code == 10
|
169
172
|
when 8
|
170
173
|
# handle @parser_data[:op_code] == 8 (close)
|
171
|
-
Plezi.callback( @connection, :send_nonblock,
|
174
|
+
Plezi.callback( @connection, :send_nonblock, "\x88\x00" ) { @connection.disconnect }
|
172
175
|
@parser_op_code = nil if @parser_op_code == 8
|
173
176
|
else
|
174
177
|
@message << @parser_data[:body].pack('C*')
|
@@ -64,12 +64,12 @@ module Plezi
|
|
64
64
|
|
65
65
|
# pings the connection
|
66
66
|
def ping
|
67
|
-
service.send_nonblock
|
67
|
+
service.send_nonblock "\x89\x00" # op_code 9
|
68
68
|
self
|
69
69
|
end
|
70
70
|
# pings the connection
|
71
71
|
def pong
|
72
|
-
service.send_nonblock
|
72
|
+
service.send_nonblock "\x8A\x00" # op_code 10
|
73
73
|
self
|
74
74
|
end
|
75
75
|
|
data/lib/plezi/version.rb
CHANGED
data/plezi.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
|
24
|
-
|
25
|
-
spec.post_install_message
|
24
|
+
spec.post_install_message = "** Deprecation Warning:\n- The current code for default error pages will be changed in version 0.9.0.\n- Default error pages will follow a different naming and location conventions.\n- The updated design will be part of the updated `plezi` helper script.\nPlease review your code before upgrading to the 0.9.0 version.\n\nThank you for installing Plezi, the native Ruby Framework for real time web-apps."
|
25
|
+
spec.post_install_message ||= "Thank you for installing Plezi, the native Ruby Framework for real time web-apps."
|
26
26
|
|
27
27
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
// remember to set your websocket uri as an absolute path!
|
3
|
+
var ws_uri = "ws://echo.websocket.org/";
|
4
|
+
var websocket = NaN
|
5
|
+
|
6
|
+
function init_websocket()
|
7
|
+
{
|
8
|
+
websocket = new WebSocket(ws_uri);
|
9
|
+
websocket.onopen = function(e) { on_open(e) };
|
10
|
+
websocket.onclose = function(e) { on_close(e) };
|
11
|
+
websocket.onmessage = function(e) { on_message(e) };
|
12
|
+
websocket.onerror = function(e) { on_error(e) }; }
|
13
|
+
|
14
|
+
function on_open(e) {
|
15
|
+
// what do you want to do now?
|
16
|
+
}
|
17
|
+
function on_close(e) {
|
18
|
+
// you probably want to reopen the websocket if it closes.
|
19
|
+
init_websocket()
|
20
|
+
}
|
21
|
+
function on_message(e) {
|
22
|
+
// what do you want to do now?
|
23
|
+
}
|
24
|
+
function on_error(e) {
|
25
|
+
// what do you want to do now?
|
26
|
+
}
|
27
|
+
}
|
28
|
+
window.addEventListener("load", init, false);
|
data/test/plezi_tests.rb
CHANGED
@@ -299,7 +299,7 @@ module PleziTestTasks
|
|
299
299
|
end
|
300
300
|
def test_500
|
301
301
|
workers = Plezi::EventMachine.count_living_workers
|
302
|
-
|
302
|
+
print " * 500 internal error test: #{RESULTS[ Net::HTTP.get_response(URI.parse "http://localhost:3000/fail" ).code == '500' ]}"
|
303
303
|
# cause 10 more exceptions to be raised... testing thread survival.
|
304
304
|
10.times { putc "."; Net::HTTP.get_response(URI.parse "http://localhost:3000/fail" ).code }
|
305
305
|
putc "\n"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plezi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- resources/rakefile
|
112
112
|
- resources/redis_config.rb
|
113
113
|
- resources/routes.rb
|
114
|
+
- resources/websockets.js
|
114
115
|
- resources/welcome_page.html
|
115
116
|
- test/plezi_tests.rb
|
116
117
|
- websocket chatroom.md
|
@@ -118,8 +119,14 @@ homepage: http://boazsegev.github.io/plezi/
|
|
118
119
|
licenses:
|
119
120
|
- MIT
|
120
121
|
metadata: {}
|
121
|
-
post_install_message:
|
122
|
-
|
122
|
+
post_install_message: |-
|
123
|
+
** Deprecation Warning:
|
124
|
+
- The current code for default error pages will be changed in version 0.9.0.
|
125
|
+
- Default error pages will follow a different naming and location conventions.
|
126
|
+
- The updated design will be part of the updated `plezi` helper script.
|
127
|
+
Please review your code before upgrading to the 0.9.0 version.
|
128
|
+
|
129
|
+
Thank you for installing Plezi, the native Ruby Framework for real time web-apps.
|
123
130
|
rdoc_options: []
|
124
131
|
require_paths:
|
125
132
|
- lib
|