plezi 0.10.14 → 0.10.15

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: 2487750b4f8cbcb1de42a7bc91e065da2f94c212
4
- data.tar.gz: 7f39f9de1020bc8f3d80113b2dc01d7c59c9d706
3
+ metadata.gz: ac2ec66d7213346b5414d5e6dda9bfee10d135c5
4
+ data.tar.gz: 0631b6f21c1f5576ccd6cbc88fafcdb8d47a1638
5
5
  SHA512:
6
- metadata.gz: c97f85a27d0cce6a6d1df74e31ed9c8fef44377cfb9f0646d097f8917d80137dcddbe951631b2ab2126827595ad9028b53c01ffa3e1d3e1662440c710754ceb3
7
- data.tar.gz: 79c93625fcc681835f0db3c87919fa4e4a906a4f4747c42ef3093155ac02489e3d834b2307c1b621a9a5cff43ea0481ecdab6f26b18488ef3dd8068d86ee94a4
6
+ metadata.gz: eea85e77d2bdf4fe1aaa6877e4945d35834c3c98d42f3b1a10381a7601765e6795273a45ef5eef971f5e6541f8e7ce0a985f4ae298e1cfd3b498f3b162480eae
7
+ data.tar.gz: 60750c0fea68213ebdc91c1930032e8c7317b5bd4757946139af3d7ffe59f1dee35c3b57917aabd42d909fd0f1c598f1242282115c6b874626847839a4ea99c6
@@ -1,5 +1,9 @@
1
1
  #Change Log
2
2
 
3
+ Change log v.0.10.15
4
+
5
+ **Fix**: Fixed the autostart feature that was diabled to to changed in the GRHttp server.
6
+
3
7
  Change log v.0.10.14
4
8
 
5
9
  **Deprecation notice**: Setting the public root folder is now done using the option `public` instead of the option `root`.
data/bin/plezi CHANGED
@@ -49,8 +49,12 @@ class AppTemplate
49
49
  app_tree["Gemfile"] ||= ''
50
50
  app_tree["Gemfile"] << "source 'https://rubygems.org'\n\n####################\n# core gems\n\n# include the basic plezi framework and server\ngem 'plezi', '~> #{Plezi::VERSION}'\n"
51
51
  app_tree["Gemfile"] << "\n\n\nruby '#{RUBY_VERSION}'\n"
52
- app_tree["404.html.erb"] ||= IO.read(::File.expand_path(File.join("..", "..", "resources" ,"404.erb"), __FILE__))
53
- app_tree["500.html.erb"] ||= IO.read(::File.expand_path(File.join("..", "..", "resources" ,"500.erb"), __FILE__))
52
+ app_tree["templates"] ||= {}
53
+ app_tree["templates"]["404.html.erb"] ||= IO.read(::File.expand_path(File.join("..", "..", "resources" ,"404.erb"), __FILE__))
54
+ app_tree["templates"]["500.html.erb"] ||= IO.read(::File.expand_path(File.join("..", "..", "resources" ,"500.erb"), __FILE__))
55
+ app_tree["templates"]["welcome.html.erb"] ||= IO.read(::File.expand_path(File.join("..", "..", "resources" ,"mini_welcome_page.html"), __FILE__)).gsub('appname', ARGV[1])
56
+ app_tree["assets"] ||= {}
57
+ app_tree["assets"]["websocket.js"] ||= IO.read(::File.expand_path(File.join("..", "..", "resources" ,"websockets.js"), __FILE__)).gsub('appname', ARGV[1])
54
58
  finalize
55
59
  end
56
60
 
@@ -136,4 +136,4 @@ end
136
136
  Encoding.default_internal = 'utf-8'
137
137
  Encoding.default_external = 'utf-8'
138
138
 
139
- NO_PLEZI_AUTO_START = true if defined?(::Rack)
139
+ NO_PLEZI_AUTO_START = true if defined?(::Rack::Builder)
@@ -1,3 +1,3 @@
1
1
  module Plezi
2
- VERSION = "0.10.14"
2
+ VERSION = "0.10.15"
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "grhttp", "~> 0.0.17"
21
+ spec.add_dependency "grhttp", "~> 0.0.19"
22
22
  spec.add_development_dependency "bundler", "~> 1.7"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
 
@@ -34,11 +34,8 @@
34
34
  class MyController
35
35
  # HTTP
36
36
  def index
37
- "Hello World!\r\n\r\nThis appname mini-app is an example hello world and websocket chatroom.\r\n
38
- \r\nplease visit http://www.websocket.org/echo.html and connect to: ws://localhost:3000/nickname"
39
- end
40
- def websockets
41
- redirect_to "http://www.websocket.org/echo.html"
37
+ # return response << "Hello World!" # for a hello world app
38
+ render :welcome
42
39
  end
43
40
  # Websockets
44
41
  def on_message data
@@ -62,9 +59,9 @@ end
62
59
  # start a web service to listen on the first default port (3000 or the port set by the command-line).
63
60
  # you can change some of the default settings here.
64
61
  listen host: :default,
62
+ assets: Root.join('assets').to_s,
63
+ templates: Root.join('templates').to_s,
65
64
  # public: Root.join('public').to_s,
66
- # assets: Root.join('assets').to_s,
67
- # templates: Root.join('templates').to_s,
68
65
  ssl: false
69
66
 
70
67
  ## Optional stuff:
@@ -0,0 +1,268 @@
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <title>appname - Feed Me!</title>
4
+ <meta content="width=device-width, initial-scale=1, maximum-scale=2.0, user-scalable=yes, minimal-ui=yes" name="viewport">
5
+ <link href='http://fonts.googleapis.com/css?family=Shadows+Into+Light|Architects+Daughter' rel='stylesheet' type='text/css'>
6
+ <style type="text/css">
7
+ /*
8
+ med-blue: #44518E
9
+ dark-gray: #424A70
10
+ blue: #1B2864
11
+ light-blue: #818ECE
12
+ light-gray: #99A3CE
13
+ */
14
+ body, html
15
+ {
16
+ background-color: #99A3CE;
17
+ padding: 0; margin: 0;
18
+ width: 100%;
19
+ font-size: 1em;
20
+ }
21
+
22
+ h1
23
+ {
24
+ font-family: 'Shadows Into Light', cursive;
25
+ background-color: #1B2864;
26
+ color: #99A3CE;
27
+ text-align: center;
28
+ border-bottom: 4px solid #424A70;
29
+ margin: 0 0 1em 0;
30
+ padding: 0.4em 0;
31
+ width: 100%;
32
+ }
33
+ h2
34
+ {
35
+ background-color: #44518E;
36
+ color: #C6CCE7;
37
+ text-align: left;
38
+ margin: 0 0 1em 0;
39
+ padding: 0.5em 5%;
40
+ border-radius: 20px 20px 0 0;
41
+ font-family: 'Architects Daughter', cursive;
42
+ border-bottom: 3px solid #424A70;
43
+ font-size: 1.2em;
44
+ }
45
+ h3
46
+ {
47
+ font-family: 'Architects Daughter', cursive;
48
+ background-color: #44518E;
49
+ color: #C6CCE7;
50
+ text-align: left;
51
+ margin: 0 0 1em 0;
52
+ padding: 0.5em 5%;
53
+ border-radius: 1em 1em 0 0;
54
+ border-bottom: 2px solid #424A70;
55
+ font-size: 1.1em;
56
+ }
57
+ h2:before {
58
+ content: "|||";
59
+ color: #99A3CE;
60
+ padding-right: 0.3em;
61
+ margin-left: -0.5em;
62
+ }
63
+ h3:before {
64
+ content: "|||||";
65
+ color: #99A3CE;
66
+ padding-right: 0.3em;
67
+ margin-left: -1em;
68
+ }
69
+ h1 a, h2 a, h3 a
70
+ {
71
+ color: #EBCD86;
72
+ }
73
+ h1 a:hover, h2 a:hover, h3 a:hover
74
+ {
75
+ color: #EBD7A6;
76
+ }
77
+ p
78
+ {
79
+ font-size: 1em;
80
+ padding: 0 1em;
81
+ margin: 0.5em 0;
82
+ }
83
+ a
84
+ {
85
+ color: #D0AC54;
86
+ text-decoration: none;
87
+ }
88
+ a:hover
89
+ {
90
+ color: #927121;
91
+ text-decoration: underline;
92
+ }
93
+ #wrapper
94
+ {
95
+ background-color: #fff;
96
+ margin: 1em 5%;
97
+ padding: 0 0 2%;
98
+ border-radius: 20px;
99
+ min-height: 50%;
100
+ color: #007;
101
+ }
102
+
103
+ #wrapper p{ padding: 0 2%;}
104
+ .bold { font-weight: bold; }
105
+ #wrapper ol li{ padding: 0 2%;}
106
+ pre
107
+ {
108
+ border-radius: 20px;
109
+ padding: 0.5em 0;
110
+ background-color: #444;
111
+ color: #ddd;
112
+ }
113
+ input[type=text]
114
+ {
115
+ width: 60%;
116
+ font-size: 1.1em;
117
+ display: inline-block;
118
+ background-color: #fff;
119
+ color: #424A70;
120
+ border-radius: 0.5em;
121
+ border: 1px solid #424A70;
122
+ outline: none;
123
+ box-sizing: border-box;
124
+ padding: 0 1em;
125
+ }
126
+ input[type=submit]
127
+ {
128
+ font-size: 1.1em;
129
+ color: #424A70;
130
+ border-radius: 0.5em;
131
+ box-sizing: border-box;
132
+ border: 1px solid #424A70;
133
+ background-color: #fff;
134
+ padding: 0 0.4em;
135
+ }
136
+ input[type=submit]:hover
137
+ {
138
+ background-color: #818ECE; color:#fff;
139
+ }
140
+ input[type=submit]:active
141
+ {
142
+ background-color: #1B2864; color:#fff;
143
+ }
144
+
145
+ #monitor
146
+ {
147
+ margin: 0 5%; padding: 0.5em 3em;
148
+ box-sizing: border-box;
149
+ width: 90%;
150
+ font-size: 1.1em;
151
+ display: inline-block;
152
+ background-color: #C6CCE7;
153
+ color: #424A70;
154
+ border-radius: 0.5em;
155
+ border: 1px solid #424A70;
156
+ }
157
+ #monitor p
158
+ {
159
+ text-align: center;
160
+ }
161
+ .system_message { color: #1B2864; font-style: italic;}
162
+ @media screen and (max-width: 680px)
163
+ {
164
+ input[type=submit], input[type=text] {
165
+ font-size: 1em;
166
+ }
167
+ input[type=text] { width: 100%;}
168
+ #monitor
169
+ {
170
+ margin: 0 3%; padding: 0.5em 1em;
171
+ }
172
+ ul {padding: 0 1em;}
173
+ }
174
+
175
+ </style>
176
+ <script type="text/javascript">
177
+ // Your websocket URI should be an absolute path. The following sets the base URI.
178
+ // remember to update to the specific controller's path to your websocket URI.
179
+ var ws_controller_path = '/' // window.location.pathname; // change to '/controller/path'
180
+ var ws_uri = (window.location.protocol.match(/https/) ? 'wss' : 'ws') + '://' + window.document.location.host + ws_controller_path
181
+ // websocket variable.
182
+ var websocket = NaN
183
+ // count failed attempts
184
+ var websocket_fail_count = 0
185
+
186
+ function init_websocket()
187
+ {
188
+ websocket = new WebSocket(ws_uri);
189
+ websocket.onopen = function(e) {
190
+ //restart fail count
191
+ websocket_fail = 0
192
+ // what do you want to do now?
193
+ var msg = document.createElement("li");
194
+ msg.className = 'system_message'
195
+ msg.innerHTML = "Connected.";
196
+ document.getElementById("output").appendChild(msg);
197
+ };
198
+
199
+ websocket.onclose = function(e) {
200
+ // what do you want to do now?
201
+ if(websocket_fail == 0) {
202
+ var msg = document.createElement("li");
203
+ msg.className = 'system_message'
204
+ msg.innerHTML = "Disconnected.";
205
+ document.getElementById("output").appendChild(msg);
206
+ };
207
+ // you probably want to reopen the websocket if it closes (unless the issue repeats).
208
+ if(websocket_fail <= 5) {websocket_fail += 1; init_websocket(); };
209
+ };
210
+ websocket.onerror = function(e) {
211
+ // what do you want to do now?
212
+ };
213
+ websocket.onmessage = function(e) {
214
+ // what do you want to do now?
215
+ console.log(e.data);
216
+ var msg = document.createElement("li");
217
+ msg.innerHTML = e.data;
218
+ document.getElementById("output").appendChild(msg);
219
+ // to use JSON, use:
220
+ // msg = JSON.parse(e.data); // remember to use JSON also in your Plezi controller.
221
+ };
222
+ }
223
+ window.addEventListener("load", init_websocket, false);
224
+ function send_text()
225
+ {
226
+ var msg = document.getElementById("input").value;
227
+ document.getElementById("input").value = '';
228
+ websocket.send(msg);
229
+ return false;
230
+ }
231
+ </script>
232
+ </head>
233
+ <body>
234
+ <h1>Welcome to <a href="https://github.com/boazsegev/plezi">Plezi</a></h1>
235
+ <div id="wrapper">
236
+ <h2>Congratulations, <a href='/'>appname</a> is running - What's next?</h2>
237
+ <p><span class="bold">Congratulations</span>, you're now running appname and it has so much potential!</p>
238
+ <p>appname started out <a href="https://github.com/boazsegev/plezi">Plezi</a> and it's your quest to feed it your code and make sure appname grows strong and happy.</p>
239
+ <p>You're the master of this quest, and your next steps might include:</p>
240
+ <ol><li><p class="bold">Deciding which gems to use:</p>
241
+ <ul>
242
+ <li>edit Gemfile in the appname folder.</li>
243
+ </ul>
244
+ </li>
245
+ <li>
246
+ <p class="bold">Reviewing the sample code and feeding <a href="https://github.com/boazsegev/plezi">Plezi</a> your code:</p>
247
+ <ul>
248
+ <li>Review and update MyController in your 'appname.rb'.</li>
249
+ <li>Delete this file (appname/templates/welcome.html.erb).</li>
250
+ <li>Write your own controller and code, using a sub-foler as suggested in the 'appname.rb' file.</li>
251
+ <li>Set up your routes in the 'appname.rb' file.</li>
252
+ <li>Edit the javascript for the client in your 'appname/websockets.js' file.</li>
253
+ </ul>
254
+ </li>
255
+ <li>
256
+ <p><span class="bold">Having fun</span> and submitting any issues you discover to the <a href="https://github.com/boazsegev/plezi">Plezi Github Project.</a></p>
257
+ </li>
258
+ </ol>
259
+ <p class="bold">Good Luck!</p>
260
+ <h3> Did you try our websocket broadcast? </h3>
261
+ <p>Your appname app can send <span class="bold">WebSocket</span> broadcasts (and unicasts). Why not try them out? You can even try them across multiple windows.</p>
262
+ <form onsubmit='send_text(); return false;' id='monitor'>
263
+ <p><input type='text' id='input' placeholder='Your message' /> <input type='submit' value='Broadcast'/> </p>
264
+ <ul id='output'>
265
+ </ul>
266
+ </form>
267
+ </div>
268
+ </body>
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.10.14
4
+ version: 0.10.15
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-07-27 00:00:00.000000000 Z
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grhttp
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.17
19
+ version: 0.0.19
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.17
26
+ version: 0.0.19
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,7 @@ files:
111
111
  - resources/i18n_config.rb
112
112
  - resources/mini_app.rb
113
113
  - resources/mini_exec.rb
114
+ - resources/mini_welcome_page.html
114
115
  - resources/oauth_config.rb
115
116
  - resources/plezi_websockets.html
116
117
  - resources/rakefile