plezi 0.14.2 → 0.14.3

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: 46dea93c274cc8c463747a8d91e46c4af6852a86
4
- data.tar.gz: 56b9726006f702548770d2ea7beebbec6564ad8c
3
+ metadata.gz: 6ddd8b8186ab951cdd13190a403826c0cbe91981
4
+ data.tar.gz: 5dcfc9e0bacc74de928eabe54a03916eec97743c
5
5
  SHA512:
6
- metadata.gz: 30312ea6a47f7e8d9dc53a5c8c552046da2c064bdab79f15699507e8bd8628a9ce0c9fc47ea31d19073e271ec9394082e5066f301f5115ffeb10dfe08a31e59f
7
- data.tar.gz: 0d275aa94313f9fe2bfe87a29eba26f31ad37ec9226c27a982fb86522404576aa65810f5575f211f160ed7d561de5bf12af3ce694e82f153d03b6e1e4e9212ef
6
+ metadata.gz: 4d68a58f2895b7dcdb345adf54d5c0e721706ec02fe8cd4b516bfcdf48ca2c7214a96a2c1ca0cd0f4697d86c1b082ba83fa4dceabd0df1221ce3547cdf470f2b
7
+ data.tar.gz: 67d8deb352baea686243f1a3ef56873afce60596127f59332da185a2db998a59d0172dd5bdedfdedbbbf6705f5c4c2014229b20854110a2d6309732573439712
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ***
4
4
 
5
+ Change log v.0.14.3
6
+
7
+ **Dependencies**: added the missing `bundler` and `rack >= 2.0.0` dependencies. Since the bundler gem is often installed by default, it took me a while to realize it was missing from the dependency list. Rack was also easy to miss (being as common).
8
+
9
+ **Update**: minor tweaks to the cookie jar, allowing a unified `to_s` method and unified `keys`/`values` methods.
10
+
11
+ **Update**: added an Iodine worker process default to prevent auto-forking unless Redis is used for Websocket scaling. Plezi will default to a single process even though Iodine will default to the number of CPU cores / 2.
12
+
13
+ **minor fix**: fixed small issues with the app template (old text was updated).
14
+
15
+ ***
16
+
5
17
  Change log v.0.14.2
6
18
 
7
19
  **Dependencies**: updates to dependency version requirements.
data/README.md CHANGED
@@ -24,15 +24,15 @@ Plezi will provide the following features over plain Rack:
24
24
 
25
25
  * Raw Websocket connections.
26
26
 
27
- Non-RESTful public Controller methods will be automatically published as valid HTTP routes, allowing the Controller to feel like an intuitive "virtual folder" with RESTful features.
27
+ Websocket connections are now route specific, routing the websocket callbacks to the Controller that "owns" the route.
28
28
 
29
- * An (optional) Auto-Dispatch to map JSON websocket "events" to Controller functions (handlers).
29
+ * Auto-Dispatch (optional) to automatically map JSON websocket "events" to Controller functions (handlers).
30
30
 
31
31
  * Automatic (optional) scaling using Redis.
32
32
 
33
33
  * An extensible template rendering abstraction engine, supports Slim, Markdown (using RedCarpet) and ERB out of the box.
34
34
 
35
- * Belated, extensible, asset baking (a fallback for when the application's assets weren't baked before deployment).
35
+ * Belated, extensible, asset baking (optional fallback for when the application's assets weren't baked before deployment).
36
36
 
37
37
  It's possible to define an asset route (this isn't the default) to bake assets on the fly.
38
38
 
@@ -19,10 +19,12 @@ module Plezi
19
19
  at_exit do
20
20
  next if @plezi_autostart == false
21
21
  ::Iodine::Rack.app = ::Plezi.app
22
- ::Iodine.threads ||= 16
23
22
  ::Iodine.start
24
23
  end
25
24
  end
26
25
  true
27
26
  end
28
27
  end
28
+
29
+ ::Iodine.threads ||= 16
30
+ ::Iodine.processes ||= 1 unless ENV['PL_REDIS_URL'.freeze]
@@ -93,6 +93,7 @@ module Plezi
93
93
  content_disposition << "; filename=#{::File.basename(options[:filename])}" if options[:filename]
94
94
 
95
95
  response['content-type'.freeze] = (options[:mime] ||= options[:filename] && Rack::Mime.mime_type(::File.extname(options[:filename])))
96
+ response.delete('content-type'.freeze) unless response['content-type'.freeze]
96
97
  response['content-disposition'.freeze] = content_disposition
97
98
  true
98
99
  end
@@ -36,5 +36,19 @@ module Plezi
36
36
  super
37
37
  end
38
38
  end
39
+ # Writes a line dlimited string of all the existing and the new cookies. i.e.:
40
+ # name1=value1
41
+ # name2=value2
42
+ def to_s
43
+ (@request ? (self.to_a + request.cookies.to_a) : self.to_a).map! {|pair| pair.join('=') } .join ("\n")
44
+ end
45
+ # Returns an array with all the keys of any available cookies (both existing and new cookies).
46
+ def keys
47
+ (@request ? (super + request.cookies.keys) : super)
48
+ end
49
+ # Returns an array with all the values of any available cookies (both existing and new cookies).
50
+ def values
51
+ (@request ? (super + request.cookies.values) : super)
52
+ end
39
53
  end
40
54
  end
data/lib/plezi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plezi
2
- VERSION = '0.14.2'.freeze
2
+ VERSION = '0.14.3'.freeze
3
3
  end
data/plezi.gemspec CHANGED
@@ -27,11 +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.2', '>= 0.2.1'
30
+ spec.add_dependency 'iodine', '~> 0.2', '>= 0.2.7'
31
+ spec.add_dependency 'rack', '>= 2.0.0'
32
+ spec.add_dependency 'bundler', '~> 1.13'
31
33
  # spec.add_dependency 'redcarpet', '> 3.3.0'
32
34
  # spec.add_dependency 'slim', '> 3.0.0'
33
35
 
34
- spec.add_development_dependency 'bundler', '~> 1.12'
35
36
  spec.add_development_dependency 'rake', '~> 10.0'
36
37
  spec.add_development_dependency 'minitest', '~> 5.0'
37
38
  end
@@ -45,7 +45,7 @@ h2
45
45
  }
46
46
  h3
47
47
  {
48
- font-family: 'Architects Daughter', cursive;
48
+ font-family: 'Architects Daughter', cursive;
49
49
  background-color: #44518E;
50
50
  color: #C6CCE7;
51
51
  text-align: left;
@@ -79,7 +79,7 @@ p
79
79
  {
80
80
  font-size: 1em;
81
81
  padding: 0 1em;
82
- margin: 0.5em 0;
82
+ margin: 0.5em 0;
83
83
  }
84
84
  a
85
85
  {
@@ -153,7 +153,7 @@ input[type=submit]:active
153
153
  background-color: #C6CCE7;
154
154
  color: #424A70;
155
155
  border-radius: 0.5em;
156
- border: 1px solid #424A70;
156
+ border: 1px solid #424A70;
157
157
  }
158
158
  #monitor p
159
159
  {
@@ -225,7 +225,7 @@ function init_websocket()
225
225
  // msg = JSON.parse(e.data); // remember to use JSON also in your Plezi controller.
226
226
  };
227
227
  }
228
- window.addEventListener("load", init_websocket, false);
228
+ window.addEventListener("load", init_websocket, false);
229
229
  function send_text()
230
230
  {
231
231
  var msg = document.getElementById("input").value;
@@ -250,11 +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 MyController in your 'appname.rb'.</li>
254
- <li>Edit or delete this file (appname/templates/welcome.html.erb).</li>
255
- <li>Write your own controller and code, maybe using a sub-folder as suggested in the 'appname.rb' file.</li>
256
- <li>Set up your routes in the 'appname.rb' file.</li>
257
- <li>Edit the javascript for the client in your 'appname/websockets.js' file and link to it from your html.</li>
253
+ <li>Review and update your first Controller in <span class="bold">'appname/app/my_controller.rb'</span>.</li>
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
+ <li>Set up your routes in the 'appname/routes.rb' file.</li>
257
+ <li>Add WebSocket support to appname using 'appname/public/javascripts/client.js'.</li>
258
+ <li>Create some beautiful layouts for appname.</li>
259
+ <li>Update the error templates at 'appname/views/' to use your app's layout.</li>
258
260
  </ul>
259
261
  </li>
260
262
  <li>
@@ -270,4 +272,4 @@ function send_text()
270
272
  </ul>
271
273
  </form>
272
274
  </div>
273
- </body>
275
+ </body>
data/resources/routes.rb CHANGED
@@ -3,12 +3,19 @@
3
3
  # #
4
4
  # # Add your routes and controllers by order of priority.
5
5
 
6
+ # # A dynamic Websocket Client route can be used to automatically send the
7
+ # # updated Websocket client whenever Plezi is updated.
8
+
9
+ # Plezi.route 'ws/client', :client
10
+
6
11
  # # I18n re-write, i.e.: `/en/home` will be rewriten as `/home`, while setting params['locale'] to "en"
12
+
7
13
  # Plezi.route "/:locale" , /^(#{I18n.available_locales.join "|"})$/ if defined? I18n
8
14
 
9
15
  # # Response format re-write, i.e.: `/xml/home` will use .xml templates automatically
10
16
  # # with :locale a request might look like `/en/json/...`
17
+
11
18
  # Plezi.route "/:format" , /^(html|json|xml)$/
12
19
 
13
- # The root Controller
20
+ # # The root Controller
14
21
  Plezi.route '/', RootController
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.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-24 00:00:00.000000000 Z
11
+ date: 2016-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iodine
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.2'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.2.1
22
+ version: 0.2.7
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,35 @@ dependencies:
29
29
  version: '0.2'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.2.1
32
+ version: 0.2.7
33
+ - !ruby/object:Gem::Dependency
34
+ name: rack
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 2.0.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.0
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: bundler
35
49
  requirement: !ruby/object:Gem::Requirement
36
50
  requirements:
37
51
  - - "~>"
38
52
  - !ruby/object:Gem::Version
39
- version: '1.12'
40
- type: :development
53
+ version: '1.13'
54
+ type: :runtime
41
55
  prerelease: false
42
56
  version_requirements: !ruby/object:Gem::Requirement
43
57
  requirements:
44
58
  - - "~>"
45
59
  - !ruby/object:Gem::Version
46
- version: '1.12'
60
+ version: '1.13'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: rake
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
164
  version: '0'
151
165
  requirements: []
152
166
  rubyforge_project:
153
- rubygems_version: 2.5.1
167
+ rubygems_version: 2.5.2
154
168
  signing_key:
155
169
  specification_version: 4
156
170
  summary: The Plezi.io Ruby Framework for real time web applications.