garufa 1.0.1 → 1.1.0.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +13 -2
- data/bin/garufa.pid +1 -1
- data/lib/garufa/api.rb +1 -1
- data/lib/garufa/api/authentication.rb +4 -1
- data/lib/garufa/garufa_app.rb +5 -0
- data/lib/garufa/version.rb +1 -1
- data/test/helper.rb +1 -0
- metadata +33 -19
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Usage
|
|
30
30
|
Start garufa server:
|
31
31
|
|
32
32
|
``` console
|
33
|
-
$ garufa -sv --app_key app-key --secret app-secret
|
33
|
+
$ garufa -sv --app_id app-id --app_key app-key --secret app-secret
|
34
34
|
```
|
35
35
|
|
36
36
|
This will start Garufa, logging to stdout in verbose mode. If you want Garufa
|
@@ -71,7 +71,7 @@ require 'pusher'
|
|
71
71
|
Pusher.host = 'localhost'
|
72
72
|
Pusher.port = 8080
|
73
73
|
|
74
|
-
Pusher.app_id = '
|
74
|
+
Pusher.app_id = 'app-id'
|
75
75
|
Pusher.key = 'app-key'
|
76
76
|
Pusher.secret = 'app-secret'
|
77
77
|
|
@@ -181,6 +181,17 @@ Set `Pusher.port` and `Pusher.ws_port` in the example above to port 80, and
|
|
181
181
|
`Pusher.host` to the name of your app provided by Heroku (something like
|
182
182
|
`random-name-2323.herokuapp.com`).
|
183
183
|
|
184
|
+
Checking number of current connections
|
185
|
+
--------------------------------------
|
186
|
+
|
187
|
+
A simple way to check the number of current connections is using `lsof`. Be sure to
|
188
|
+
set the right path to garufa.pid file.
|
189
|
+
|
190
|
+
|
191
|
+
``` console
|
192
|
+
while :; do echo "$(date '+%H:%M:%S') $(sudo lsof -p `cat /path/to/garufa.pid` | grep ESTABLISHED | wc -l)"; sleep 1; done;
|
193
|
+
```
|
194
|
+
|
184
195
|
Testing and Contributing
|
185
196
|
------------------------
|
186
197
|
|
data/bin/garufa.pid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
4987
|
data/lib/garufa/api.rb
CHANGED
@@ -4,10 +4,13 @@ require 'garufa/config'
|
|
4
4
|
module Garufa
|
5
5
|
module API
|
6
6
|
module Authentication
|
7
|
-
def authenticate
|
7
|
+
def authenticate(app_id)
|
8
8
|
request = Signature::Request.new(req.request_method, req.path, req.params)
|
9
9
|
request.authenticate { |key| Signature::Token.new(key, Garufa::Config[:secret]) }
|
10
10
|
|
11
|
+
if app_id != Garufa::Config[:app_id]
|
12
|
+
halt([400, {}, ["Token validated, but invalid for app #{app_id}"]])
|
13
|
+
end
|
11
14
|
rescue Signature::AuthenticationError
|
12
15
|
halt([401, {}, ['401 Unauthorized']])
|
13
16
|
end
|
data/lib/garufa/garufa_app.rb
CHANGED
@@ -4,6 +4,7 @@ require 'faye/websocket'
|
|
4
4
|
require 'garufa/config'
|
5
5
|
require 'garufa/websocket'
|
6
6
|
require 'garufa/api'
|
7
|
+
require 'garufa/version'
|
7
8
|
|
8
9
|
module Garufa
|
9
10
|
|
@@ -23,12 +24,16 @@ module Garufa
|
|
23
24
|
opts.separator "Pusher options:"
|
24
25
|
|
25
26
|
new_options = {
|
27
|
+
app_id: ['--app_id APP_ID', 'Pusher application ID (required)'],
|
26
28
|
app_key: ['--app_key APP_KEY', 'Pusher application key (required)'],
|
27
29
|
secret: ['--secret SECRET', 'Pusher application secret (required)']
|
28
30
|
}
|
29
31
|
new_options.each do |k, v|
|
30
32
|
opts.on(v.first, v.last) { |value| Garufa::Config[k] = value }
|
31
33
|
end
|
34
|
+
|
35
|
+
opts.separator ""
|
36
|
+
opts.on('-V', '--version', 'Display version and exit') { puts "Garufa version #{Garufa::VERSION}"; exit }
|
32
37
|
end
|
33
38
|
|
34
39
|
def response(env)
|
data/lib/garufa/version.rb
CHANGED
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garufa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1
|
4
|
+
version: 1.1.0.rc.1
|
5
|
+
prerelease: 6
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Juan Manuel Cuello
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: goliath
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - '='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - '='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: faye-websocket
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - '='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - '='
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: cuba
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - '='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - '='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: signature
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - '='
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - '='
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rake
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - '='
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - '='
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,6 +94,7 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: minitest
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
99
|
- - '='
|
88
100
|
- !ruby/object:Gem::Version
|
@@ -90,6 +102,7 @@ dependencies:
|
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - '='
|
95
108
|
- !ruby/object:Gem::Version
|
@@ -105,48 +118,49 @@ files:
|
|
105
118
|
- LICENSE
|
106
119
|
- README.md
|
107
120
|
- Rakefile
|
108
|
-
-
|
109
|
-
- bin/garufa.pid
|
110
|
-
- garufa.gemspec
|
111
|
-
- lib/garufa.rb
|
121
|
+
- lib/garufa/version.rb
|
112
122
|
- lib/garufa/api.rb
|
113
|
-
- lib/garufa/api/authentication.rb
|
114
123
|
- lib/garufa/api/channels.rb
|
115
124
|
- lib/garufa/api/event_handler.rb
|
125
|
+
- lib/garufa/api/authentication.rb
|
116
126
|
- lib/garufa/api/events.rb
|
117
|
-
- lib/garufa/config.rb
|
118
|
-
- lib/garufa/connection.rb
|
119
|
-
- lib/garufa/garufa_app.rb
|
120
|
-
- lib/garufa/message.rb
|
121
127
|
- lib/garufa/subscription.rb
|
128
|
+
- lib/garufa/message.rb
|
129
|
+
- lib/garufa/config.rb
|
122
130
|
- lib/garufa/subscriptions.rb
|
123
|
-
- lib/garufa/version.rb
|
124
131
|
- lib/garufa/websocket.rb
|
125
|
-
-
|
132
|
+
- lib/garufa/garufa_app.rb
|
133
|
+
- lib/garufa/connection.rb
|
134
|
+
- lib/garufa.rb
|
135
|
+
- bin/garufa.pid
|
136
|
+
- bin/garufa
|
137
|
+
- garufa.gemspec
|
126
138
|
- test/helper.rb
|
127
139
|
- test/message.rb
|
128
140
|
- test/subscriptions.rb
|
141
|
+
- test/connection.rb
|
129
142
|
homepage: http://github.com/Juanmcuello/garufa
|
130
143
|
licenses: []
|
131
|
-
metadata: {}
|
132
144
|
post_install_message:
|
133
145
|
rdoc_options: []
|
134
146
|
require_paths:
|
135
147
|
- lib
|
136
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
137
150
|
requirements:
|
138
|
-
- -
|
151
|
+
- - ! '>='
|
139
152
|
- !ruby/object:Gem::Version
|
140
153
|
version: '1.9'
|
141
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
142
156
|
requirements:
|
143
|
-
- -
|
157
|
+
- - ! '>'
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
159
|
+
version: 1.3.1
|
146
160
|
requirements: []
|
147
161
|
rubyforge_project:
|
148
|
-
rubygems_version:
|
162
|
+
rubygems_version: 1.8.23.2
|
149
163
|
signing_key:
|
150
|
-
specification_version:
|
164
|
+
specification_version: 3
|
151
165
|
summary: Websocket server compatible with Pusher.
|
152
166
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: eafc3046e8da58d35b4e830aec82022ae952133c
|
4
|
-
data.tar.gz: cb28d6901cf7deacacaebee1c9e29386406def28
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: ee3baecdd8a39060e2aa452f62c1bc9ff057e6efb2a2dca8a6cc91bf6666f9d0c856aa07bd856068d9d0447c5de3d356ac791e0e0119b8be72ea9602b3862b87
|
7
|
-
data.tar.gz: 377e59dd31c73182b247ce01603ad071a537d08ab747c1d8aff468f00e07b0b528adb792ad757389fd95d3f4ebb1a21e15a02b098ddfa1a6314403d9a5003588
|