plezi 0.12.7 → 0.12.8
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/README.md +23 -24
- data/lib/plezi/common/renderer.rb +3 -1
- data/lib/plezi/version.rb +1 -1
- data/logo/dark.png +0 -0
- data/logo/light.png +0 -0
- data/logo/sign.png +0 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92408c765d2c38c2c1585e1091fb84b9c082bc5c
|
4
|
+
data.tar.gz: 8238991470cad7a350f725b869e1599fb4b2b18c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46eec031af3a77a791e75c0cf9159d9b2f24a01944d2d527d865c0d4a4a77a893572c7ba01bd229a9e55f4afef5943575f7dda47228612f89c95ddd9c23ccb2
|
7
|
+
data.tar.gz: 1043195255a1ad12772067e5e672ae98d7a80e3de18ee2bbadab1985f7d6d44fe02b5a0e5b010a2d5b7f310f764a9d16ad48cc836a5dcca6b7c92f5cea2238c6
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
***
|
4
4
|
|
5
|
+
Change log v.0.12.8
|
6
|
+
|
7
|
+
**Fix**: Sass cacheing now works as expected, so that repeated calls to the SASS renderer are loaded from the cache without failing.
|
8
|
+
|
9
|
+
***
|
10
|
+
|
5
11
|
Change log v.0.12.7
|
6
12
|
|
7
13
|
**Identity API**: Identity API now allows you to set a higher number of allowable concurrent connections per identity, rather than the original single connection limit. Also, allows limited functionality when Redis isn't defined (registration lifetime is limited to the process lifetime and scaling will not work without Redis).
|
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# [Plezi
|
1
|
+
# [![Plezi - the Ruby framework for realtime web-apps](https://raw.githubusercontent.com/boazsegev/plezi/master/logo/dark.png)](https://github.com/boazsegev/plezi)
|
2
|
+
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/plezi.svg)](http://badge.fury.io/rb/plezi)
|
3
4
|
[![Inline docs](http://inch-ci.org/github/boazsegev/plezi.svg?branch=master)](http://www.rubydoc.info/github/boazsegev/plezi/master)
|
4
5
|
[![GitHub](https://img.shields.io/badge/GitHub-Open%20Source-blue.svg)](https://github.com/boazsegev/plezi)
|
5
6
|
|
6
|
-
Plezi is
|
7
|
+
Plezi is a Ruby framework for realtime web applications. It's name comes from the word "pleasure", since Plezi is a pleasure to work with.
|
7
8
|
|
8
9
|
With Plezi, you can easily:
|
9
10
|
|
10
|
-
1. Create a
|
11
|
+
1. Create a Ruby web application, taking full advantage of RESTful routing, HTTP streaming and scalable Websocket features;
|
11
12
|
|
12
13
|
2. Add Websocket services and RESTful HTTP Streaming to your existing Web-App, (Rails/Sinatra or any other Rack based Ruby app);
|
13
14
|
|
@@ -25,51 +26,46 @@ Or install it yourself as:
|
|
25
26
|
|
26
27
|
$ gem install plezi
|
27
28
|
|
28
|
-
##
|
29
|
+
## Our first Plezi Application
|
29
30
|
|
30
|
-
I love starting small and growing. So,
|
31
|
+
I love starting small and growing. So, for my first Plezi application, I just want the basics. I will run the following in my terminal:
|
31
32
|
|
32
33
|
$ plezi mini appname
|
33
34
|
|
34
|
-
|
35
|
+
If you prefer to have the application template already full blown and ready for heavy lifting, complete with some common settings for common gems and code snippets you can activate, open your terminal and type:
|
35
36
|
|
36
37
|
$ plezi new appname
|
37
38
|
|
38
|
-
That's it, now
|
39
|
+
That's it, we now have a our first Plezi application - it's a websocket chatroom (that's the starter code).
|
39
40
|
|
40
|
-
On MacOS or linux, simply double click the `appname` script file to
|
41
|
+
On MacOS or linux, simply double click the `appname` script file to start the server. Or, from the terminal:
|
41
42
|
|
42
43
|
$ cd appname
|
43
44
|
$ ./appname # ( or: plezi s )
|
44
45
|
|
45
46
|
See it work: [http://localhost:3000/](http://localhost:3000/)
|
46
47
|
|
47
|
-
## So easy, we can an app in the terminal!
|
48
|
+
## So easy, we can code an app in the terminal!
|
48
49
|
|
49
50
|
The Plezi framework was designed with intuitive ease of use in mind.
|
50
51
|
|
51
|
-
Question - what's the shortest "Hello World" web-application when writing for Sinatra or Rails? ... can you write one in your terminal window?
|
52
|
+
Question - what's the shortest "Hello World" web-application when writing for Sinatra or Rails? ... can you write one in your own terminal window?
|
52
53
|
|
53
54
|
In Plezi, it looks like this:
|
54
55
|
|
55
56
|
require 'plezi'
|
56
57
|
route('*') { "Hello World!" }
|
57
|
-
|
58
|
-
Two lines! You can even start a Plezi application from `irb`, by adding the `exit` at the end:
|
59
|
-
|
60
|
-
require 'plezi'
|
61
|
-
route('*') { "Hello World!" }
|
62
58
|
exit # <- this exits the terminal and starts the server
|
63
59
|
|
64
|
-
Now visit [localhost:3000](http://localhost:3000/)
|
60
|
+
Three lines! Now visit [localhost:3000](http://localhost:3000/)
|
65
61
|
|
66
62
|
### Object Oriented design is fun!
|
67
63
|
|
68
|
-
While Plezi allows
|
64
|
+
While Plezi allows us to utilize methods, like we just did, Plezi really shines when we use Controller classes.
|
69
65
|
|
70
66
|
Plezi will automatically map instance methods in any class to routes with complete RESTful routing support.
|
71
67
|
|
72
|
-
Let's
|
68
|
+
Let's copy and paste this into our `irb` terminal:
|
73
69
|
|
74
70
|
require 'plezi'
|
75
71
|
class MyDemo
|
@@ -94,7 +90,7 @@ Now visit [index](http://localhost:3000/) and [foo](http://localhost:3000/foo) o
|
|
94
90
|
|
95
91
|
Did you notice how the controller has natural access to the request's `params`?
|
96
92
|
|
97
|
-
This is because Plezi inherits our controller and adds some magic to it, allowing us to read
|
93
|
+
This is because Plezi inherits our controller and adds some magic to it, allowing us to read _and set_ cookies using the `cookies` Hash based cookie-jar, set or read session data using `session`, look into the `request`, set special headers for the `response`, store self destructing cookies using `flash` and so much more!
|
98
94
|
|
99
95
|
### Can websockets do that?!
|
100
96
|
|
@@ -145,9 +141,9 @@ Here's a websocket chat-room server using Plezi, comeplete with minor authentica
|
|
145
141
|
# try two browsers with the client provided by http://www.websocket.org/echo.html
|
146
142
|
exit
|
147
143
|
|
148
|
-
Broadcasting
|
144
|
+
Broadcasting isn't the only tool Plezi offers, we can also send a message to a specific connection using `unicast`, or send a message to everyone (no matter what controller is handling their connection) using `multicast`...
|
149
145
|
|
150
|
-
...It's even possible to register a unique identity, such as a specific user or even a `session.id`, so their messages are waiting for them even when they're off-line (you decide how long they wait)!
|
146
|
+
...It's even possible to register a unique identity, such as a specific user or even a `session.id`, so their messages are waiting for them even when they're off-line (you decide how long they wait)! We simply use `register_as @user.id` in our `on_open` callback, and than the user can get notifications sent by `notify user.id, :evet_method, *args`.
|
151
147
|
|
152
148
|
### Websocket scaling is as easy as one line of code!
|
153
149
|
|
@@ -191,11 +187,11 @@ Each host has it's own settings for a public folder, asset rendering, templates
|
|
191
187
|
route '/', MyDemo
|
192
188
|
exit
|
193
189
|
|
194
|
-
Plezi supports ERB (i.e. `template.html.erb`), Slim (i.e. `template.html.slim`), Haml (i.e. `template.html.haml`), CoffeeScript (i.e. `
|
190
|
+
Plezi supports ERB (i.e. `template.html.erb`), Slim (i.e. `template.html.slim`), Haml (i.e. `template.html.haml`), CoffeeScript (i.e. `asset.js.coffee`) and Sass (i.e. `asset.css.scss`) right out of the box... and it's even extendible using the `Plezi::Renderer.register` and `Plezi::AssetManager.register`
|
195
191
|
|
196
192
|
## More about Plezi Controller classes
|
197
193
|
|
198
|
-
One of the best things about the Plezi is it's ability to take in any class as a controller class and route to the classes methods with special support for RESTful methods (`index`, `show`, `new`, `save`, `update`, `delete`, `before` and `after`) and for WebSockets (`pre_connect`, `on_open`, `on_message(data)`, `on_close`, `broadcast`, `unicast`, `multicast`, `on_broadcast(data)`).
|
194
|
+
One of the best things about the Plezi is it's ability to take in any class as a controller class and route to the classes methods with special support for RESTful methods (`index`, `show`, `new`, `save`, `update`, `delete`, `before` and `after`) and for WebSockets (`pre_connect`, `on_open`, `on_message(data)`, `on_close`, `broadcast`, `unicast`, `multicast`, `on_broadcast(data)`, `register_as(identity)`, `notify`).
|
199
195
|
|
200
196
|
Here is a Hello World using a Controller class (run in `irb`):
|
201
197
|
|
@@ -712,7 +708,7 @@ The following is safe:
|
|
712
708
|
global_hash[:change] = "safe"
|
713
709
|
end
|
714
710
|
|
715
|
-
However,
|
711
|
+
However, the following is unsafe:
|
716
712
|
|
717
713
|
# set data
|
718
714
|
Plezi.cache_data :global_hash, Hash.new
|
@@ -732,3 +728,6 @@ Feel free to fork or contribute. right now I am one person, but together we can
|
|
732
728
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
733
729
|
4. Push to the branch (`git push origin my-new-feature`)
|
734
730
|
5. Create a new Pull Request
|
731
|
+
|
732
|
+
[![Plezi](https://raw.githubusercontent.com/boazsegev/plezi/master/logo/sign.png)](https://github.com/boazsegev/plezi)
|
733
|
+
|
@@ -51,8 +51,10 @@ module Plezi
|
|
51
51
|
Plezi.cache_data filename, eng.dependencies
|
52
52
|
css, map = eng.render_with_sourcemap("#{File.basename(filename, '.*'.freeze)}.map".freeze)
|
53
53
|
Plezi.cache_data filename.sub(/\.s[ac]ss$/, '.map'.freeze), map.to_json( css_uri: File.basename(filename, '.*'.freeze) )
|
54
|
-
css
|
54
|
+
Plezi.cache_data "#{filename}.css", css
|
55
|
+
return css
|
55
56
|
end
|
57
|
+
Plezi.get_cached("#{filename}.css")
|
56
58
|
end
|
57
59
|
|
58
60
|
def refresh_sass? sass
|
data/lib/plezi/version.rb
CHANGED
data/logo/dark.png
ADDED
Binary file
|
data/logo/light.png
ADDED
Binary file
|
data/logo/sign.png
ADDED
Binary file
|
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.12.
|
4
|
+
version: 0.12.8
|
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-11-
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iodine
|
@@ -100,6 +100,9 @@ files:
|
|
100
100
|
- lib/plezi/oauth.rb
|
101
101
|
- lib/plezi/oauth/auth_controller.rb
|
102
102
|
- lib/plezi/version.rb
|
103
|
+
- logo/dark.png
|
104
|
+
- logo/light.png
|
105
|
+
- logo/sign.png
|
103
106
|
- plezi.gemspec
|
104
107
|
- resources/404.erb
|
105
108
|
- resources/404.haml
|