plezi 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/bin/plezi +1 -1
- data/lib/plezi/common/dsl.rb +13 -9
- data/lib/plezi/helpers/magic_helpers.rb +4 -0
- data/lib/plezi/version.rb +1 -1
- data/resources/config.ru +3 -3
- data/resources/controller.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4c8828c427f149b793363c7fee35cc22b23a02d
|
4
|
+
data.tar.gz: 00cec3276546ec102eddb67e62de3b90a4a4a595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c747627876d08a48dbe328418aebf0edee57f8a7d484298e17ca65b76f1f55a50e72483fb4ce8044973ba6c01a0fb31f63e4500b0701dfc4228dacf11e374a7
|
7
|
+
data.tar.gz: 1e636b886ec198c3874848eb471123d341edffa1700a44ea2032bb12213eb3b844d3ba3d734c6b28ac5b9a7a484bc4ff37514fad270c44549f60467dfca358a6
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
***
|
4
4
|
|
5
|
+
Change log v.0.10.3
|
6
|
+
|
7
|
+
**Update**: updated the starting process, so that Plezi's engine (based on GReactor) could be started and restarted if needed.
|
8
|
+
|
9
|
+
**Fix**: the startup process ignored the `max_thread` settings. This is now fixed.
|
10
|
+
|
11
|
+
***
|
12
|
+
|
5
13
|
Change log v.0.10.2
|
6
14
|
|
7
15
|
**Fix**: fixed an issue where the Redis connection couldn't broadcast due to limited acess to the controller's methods.
|
data/bin/plezi
CHANGED
@@ -220,7 +220,7 @@ if ARGV[0] == 'new' || ARGV[0] == 'n' || ARGV[0] == "force"
|
|
220
220
|
#########
|
221
221
|
## set up building environment
|
222
222
|
require 'plezi/version'
|
223
|
-
|
223
|
+
NO_PLEZI_AUTO_START = true
|
224
224
|
ARGV[1] = ARGV[1].gsub /[^a-zA-Z0-9]/, '_'
|
225
225
|
if Dir.exists?(ARGV[1]) && ARGV[0] != "force"
|
226
226
|
puts ""
|
data/lib/plezi/common/dsl.rb
CHANGED
@@ -125,6 +125,16 @@ module Plezi
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
128
|
+
|
129
|
+
def self.start
|
130
|
+
return GReactor.start if GReactor.running?
|
131
|
+
Object.const_set("NO_PLEZI_AUTO_START", true) unless defined?(NO_PLEZI_AUTO_START)
|
132
|
+
puts "Starting Plezi #{Plezi::VERSION} Services using the GRHttp #{GRHttp::VERSION} server."
|
133
|
+
puts "Press ^C to exit."
|
134
|
+
GReactor.on_shutdown { puts "Plezi shutdown. It was fun to serve you." }
|
135
|
+
GReactor.start Plezi::Settings.max_threads
|
136
|
+
GReactor.join { puts "\r\nStarting shutdown sequesnce. Press ^C to force quit."}
|
137
|
+
end
|
128
138
|
end
|
129
139
|
|
130
140
|
Encoding.default_internal = 'utf-8'
|
@@ -212,18 +222,12 @@ end
|
|
212
222
|
# it is recommended that you DO NOT CALL this method.
|
213
223
|
# if any post shut-down actions need to be performed, use Plezi.on_shutdown instead.
|
214
224
|
def start_services
|
215
|
-
return 0 if
|
216
|
-
Object.const_set "NO_PLEZI_AUTO_START", true
|
225
|
+
return 0 if defined?(NO_PLEZI_AUTO_START)
|
217
226
|
undef listen
|
218
227
|
undef host
|
219
228
|
undef route
|
220
229
|
undef shared_route
|
221
|
-
|
222
|
-
puts "Starting Plezi #{Plezi::VERSION} Services using the GRHttp #{GRHttp::VERSION} server."
|
223
|
-
puts "Press ^C to exit."
|
224
|
-
GReactor.on_shutdown { puts "Plezi shutdown. It was fun to serve you." }
|
225
|
-
GReactor.start unless GReactor.running?
|
226
|
-
GReactor.join { puts "\r\nStarting shutdown sequesnce. Press ^C to force quit."}
|
230
|
+
Plezi.start
|
227
231
|
end
|
228
232
|
|
229
233
|
# restarts the Plezi app with the same arguments as when it was started.
|
@@ -234,7 +238,7 @@ def restart_plezi_app
|
|
234
238
|
end
|
235
239
|
|
236
240
|
# sets to start the services once dsl script is finished loading.
|
237
|
-
at_exit { start_services }
|
241
|
+
at_exit { start_services }
|
238
242
|
|
239
243
|
# sets information to be used when restarting
|
240
244
|
$PL_SCRIPT = $0
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module Plezi
|
2
2
|
|
3
|
+
# use GRHttp's helpers for escaping data etc'.
|
4
|
+
HTTP = GRHttp::HTTP
|
5
|
+
|
3
6
|
module Base
|
7
|
+
# some helper methods used internally.
|
4
8
|
module Helpers
|
5
9
|
# a proc that allows Hashes to search for key-value pairs while also converting keys from objects to symbols and from symbols to strings.
|
6
10
|
#
|
data/lib/plezi/version.rb
CHANGED
data/resources/config.ru
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
# 2. you have better control over Middleware then you could have with Plezi.
|
23
23
|
# ("wait", you might say, "there is no Middleware in Plezi!"... "Ahhh", I will answer, "so much to discover...")
|
24
24
|
|
25
|
-
|
25
|
+
NO_PLEZI_AUTO_START = true
|
26
26
|
|
27
27
|
# load all framework and gems
|
28
28
|
load ::File.expand_path(File.join("..", "environment.rb"), __FILE__)
|
@@ -31,7 +31,7 @@ load ::File.expand_path(File.join("..", "environment.rb"), __FILE__)
|
|
31
31
|
load ::File.expand_path(File.join("..", "routes.rb"), __FILE__)
|
32
32
|
|
33
33
|
# start the plezi EM, to make sure that the plezi async code doesn't break.
|
34
|
-
|
34
|
+
GReactor.start Plezi::Settings.max_threads
|
35
35
|
|
36
36
|
# run the Rack app
|
37
|
-
run Plezi::DSL
|
37
|
+
run Plezi::Base::DSL
|
data/resources/controller.rb
CHANGED
@@ -119,6 +119,7 @@ class SampleController
|
|
119
119
|
# the demo content simply broadcasts the message.
|
120
120
|
def on_message data
|
121
121
|
# broadcast sends an asynchronous message to all sibling instances, but not to self.
|
122
|
+
data = Plezi::HTTP.escape data
|
122
123
|
broadcast :_print_out, data
|
123
124
|
response << "You said: #{data}"
|
124
125
|
end
|