plezi 0.14.6 → 0.14.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 +6 -0
- data/bin/ws_shootout +8 -0
- data/exe/plezi +3 -2
- data/lib/plezi/version.rb +1 -1
- data/plezi.gemspec +2 -2
- data/resources/client.js +5 -13
- data/resources/ctrlr.rb +1 -1
- data/resources/mini_app.rb +3 -1
- data/resources/mini_welcome_page.html +7 -6
- data/resources/routes.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a8e174219fac070cbd73f2fa53f858edeab9aa8
|
4
|
+
data.tar.gz: 9ac861a092def65bb48ae3c86fc1491d1c47a51e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2033fbcdcae672753ad07ff8c0c80688728766ab1da4e6b35326f21318051124cf6f12429362ec80644211628c2231ff34e7d0a65667c2043842904db7a99e17
|
7
|
+
data.tar.gz: 342cf32db1bc7233b5f55ee8308b93af181646dc9804414b95e221470684b57d1b97185b156d5c032d25bbf63cae5c3a5d2930c105fe43e1b2cceab64b72612c
|
data/CHANGELOG.md
CHANGED
data/bin/ws_shootout
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
Dir.chdir(File.expand_path(File.join('..', '..', 'lib'), __FILE__))
|
9
9
|
require 'bundler/setup'
|
10
10
|
require 'plezi'
|
11
|
+
|
11
12
|
class ShootoutApp
|
12
13
|
# the default HTTP response
|
13
14
|
def index
|
@@ -19,12 +20,19 @@ class ShootoutApp
|
|
19
20
|
if cmd == 'echo'
|
20
21
|
write({type: 'echo', payload: payload}.to_json)
|
21
22
|
else
|
23
|
+
# data = {type: 'broadcast', payload: payload}.to_json
|
24
|
+
# broadcast :push2client, data
|
22
25
|
ShootoutApp.write2everyone({type: 'broadcast', payload: payload}.to_json)
|
23
26
|
write({type: "broadcastResult", payload: payload}.to_json)
|
24
27
|
end
|
25
28
|
rescue
|
26
29
|
puts "Incoming message format error - not JSON?"
|
27
30
|
end
|
31
|
+
|
32
|
+
def push2client data
|
33
|
+
write data
|
34
|
+
end
|
35
|
+
|
28
36
|
end
|
29
37
|
|
30
38
|
Plezi.route '*', ShootoutApp
|
data/exe/plezi
CHANGED
@@ -72,8 +72,8 @@ module Builder
|
|
72
72
|
app_tree['Gemfile'] << IO.read(Root.join('resources', 'gemfile'))
|
73
73
|
app_tree['Gemfile'] << "\n\nruby '#{RUBY_VERSION}'\n"
|
74
74
|
app_tree['rakefile'] ||= IO.read(Root.join('resources', 'rakefile'))
|
75
|
-
app_tree['
|
76
|
-
app_tree['
|
75
|
+
app_tree['controllers'] ||= {}
|
76
|
+
app_tree['controllers']['example.rb'] ||= IO.read(Root.join('resources', 'ctrlr.rb')).gsub('appname', app_name)
|
77
77
|
app_tree['views'] ||= {}
|
78
78
|
app_tree['views']['welcome.html.erb'] ||= IO.read(Root.join('resources', 'mini_welcome_page.html')).gsub('appname', app_name)
|
79
79
|
app_tree['views']['404.html.erb'] ||= IO.read(Root.join('resources', '404.erb'))
|
@@ -83,6 +83,7 @@ module Builder
|
|
83
83
|
app_tree['public']['javascripts'] ||= {}
|
84
84
|
app_tree['public']['javascripts']['client.js'] ||= IO.read(Root.join('resources', 'client.js')).gsub('appname', app_name)
|
85
85
|
app_tree['public']['javascripts']['simple-client.js'] ||= IO.read(Root.join('resources', 'simple-client.js')).gsub('appname', app_name)
|
86
|
+
app_tree['test'] ||= {}
|
86
87
|
|
87
88
|
begin
|
88
89
|
Dir.mkdir app_name
|
data/lib/plezi/version.rb
CHANGED
data/plezi.gemspec
CHANGED
@@ -27,12 +27,12 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_dependency 'iodine', '~> 0.
|
30
|
+
spec.add_dependency 'iodine', '~> 0.3', '>= 0.3.0'
|
31
31
|
spec.add_dependency 'rack', '>= 2.0.0'
|
32
32
|
spec.add_dependency 'bundler', '~> 1.14'
|
33
33
|
# spec.add_dependency 'redcarpet', '> 3.3.0'
|
34
34
|
# spec.add_dependency 'slim', '> 3.0.0'
|
35
35
|
|
36
|
-
spec.add_development_dependency 'rake', '~>
|
36
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
37
37
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
38
38
|
end
|
data/resources/client.js
CHANGED
@@ -176,8 +176,7 @@ PleziClient.prototype.___dispatch =
|
|
176
176
|
console.log(this);
|
177
177
|
}
|
178
178
|
|
179
|
-
PleziClient.prototype.reconnect =
|
180
|
-
function() {
|
179
|
+
PleziClient.prototype.reconnect = function() {
|
181
180
|
this.connected = NaN;
|
182
181
|
this.ws = new WebSocket(this.url);
|
183
182
|
// lets us access the client from the callbacks
|
@@ -190,21 +189,14 @@ PleziClient.prototype.___dispatch =
|
|
190
189
|
this.ws.onerror = this.___on_error;
|
191
190
|
// The Websocket onmessage callback
|
192
191
|
this.ws.onmessage = this.___on_message;
|
193
|
-
}
|
192
|
+
};
|
194
193
|
|
195
|
-
|
196
|
-
function() {
|
194
|
+
PleziClient.prototype.close = function() {
|
197
195
|
this.autoreconnect = false;
|
198
196
|
this.ws.close();
|
199
|
-
}
|
197
|
+
};
|
200
198
|
|
201
|
-
|
202
|
-
(self.location.protocol.match(/https/) ? 'wss'
|
203
|
-
: 'ws') +
|
204
|
-
'://' + self.location.hostname +
|
205
|
-
(self.location.port == ''
|
206
|
-
? ''
|
207
|
-
: (':' + self.location.port));
|
199
|
+
PleziClient.origin = document.location.origin.replace(/^http/i, "ws");
|
208
200
|
|
209
201
|
PleziClient.prototype.sendraw =
|
210
202
|
function(data) {
|
data/resources/ctrlr.rb
CHANGED
data/resources/mini_app.rb
CHANGED
@@ -12,7 +12,9 @@ require 'bundler'
|
|
12
12
|
Bundler.require(:default, ENV['ENV'].to_s.to_sym)
|
13
13
|
|
14
14
|
# Load all the code from a subfolder called 'app'
|
15
|
-
Dir[File.join '{
|
15
|
+
Dir[File.join '{controllers}', '**', '*.rb'].each { |file| load File.expand_path(file) }
|
16
|
+
# Load all the code from a subfolder called 'lib'
|
17
|
+
Dir[File.join '{lib}', '**', '*.rb'].each { |file| load File.expand_path(file) }
|
16
18
|
|
17
19
|
## Logging
|
18
20
|
Iodine::Rack.log = 1 if Iodine::Rack.log.nil?
|
@@ -75,7 +75,7 @@ h1 a:hover, h2 a:hover, h3 a:hover
|
|
75
75
|
{
|
76
76
|
color: #EBD7A6;
|
77
77
|
}
|
78
|
-
p
|
78
|
+
p, li
|
79
79
|
{
|
80
80
|
font-size: 1em;
|
81
81
|
padding: 0 1em;
|
@@ -103,7 +103,7 @@ a:hover
|
|
103
103
|
|
104
104
|
#wrapper p{ padding: 0 2%;}
|
105
105
|
.bold { font-weight: bold; }
|
106
|
-
#wrapper
|
106
|
+
#wrapper li{ padding: 0 1em;}
|
107
107
|
pre
|
108
108
|
{
|
109
109
|
border-radius: 20px;
|
@@ -250,12 +250,13 @@ function send_text()
|
|
250
250
|
<li>
|
251
251
|
<p class="bold">Reviewing the sample code and feeding <a href="http://www.plezi.io/">Plezi</a> your code:</p>
|
252
252
|
<ul>
|
253
|
-
<li>Review and update your first Controller in <span class="bold">'appname/
|
253
|
+
<li>Review and update your first Controller in <span class="bold">'appname/controllers/example.rb'</span>.</li>
|
254
254
|
<li>Edit or delete this file (appname/views/welcome.html.erb).</li>
|
255
|
-
<li>Write new controllers and code, maybe adding sub-folders to 'appname/app'.</li>
|
256
255
|
<li>Set up your routes in the 'appname/routes.rb' file.</li>
|
257
|
-
<li>
|
258
|
-
<li>
|
256
|
+
<li>Write new controllers that tanslate between your application's API and the internet layer.</li>
|
257
|
+
<li>Save the actual application logic in the 'appname/lib' folder, seperating it from the network layer.</li>
|
258
|
+
<li>Add WebSocket support, just because it's easy and fun.</li>
|
259
|
+
<li>Write a beautiful client to access appname through the web.</li>
|
259
260
|
<li>Update the error templates at 'appname/views/' to use your app's layout.</li>
|
260
261
|
</ul>
|
261
262
|
</li>
|
data/resources/routes.rb
CHANGED
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.14.
|
4
|
+
version: 0.14.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iodine
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.3'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.3.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.3'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.3.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rack
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '12.0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '12.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: minitest
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.6.
|
168
|
+
rubygems_version: 2.6.11
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
171
|
summary: The Plezi.io Ruby Framework for real time web applications.
|