pusher-hackathon 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -10
- data/bin/pusher-hackathon +31 -5
- data/lib/hackathon/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599d72e505a7df27ea5e727fcc0b0b3faabbff36
|
4
|
+
data.tar.gz: 6999ef849424eeb25e92f27911d2f1f5585c3299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07b6ba02b841dc8513fd648e699fd4e4aa487b7d09a92242b14e10a0b9db62e73654d52eb0b5ff0d0b05dd811efd8b3a0c0aea4989cfd86ca79b1771db73c5d4
|
7
|
+
data.tar.gz: f702eca43a82266f3b595aa62054d80acb091694862ddb1773947eb017d77586427d2edafd7862101c77a50128481d8503a949ece7b80403ea37ef43d2d60c15
|
data/README.md
CHANGED
@@ -6,22 +6,23 @@ Setting up a server that authenticates private- and presence-channels for hackat
|
|
6
6
|
|
7
7
|
$ gem install pusher-hackathon
|
8
8
|
|
9
|
-
##
|
10
|
-
|
11
|
-
Simply run the `pusher-hackathon` command, with your app's `id`, `key`, and `secret` as options. If you wish, you can choose to specify a `port`.
|
9
|
+
## Quick Deploy
|
12
10
|
|
13
|
-
$ pusher-hackathon
|
11
|
+
$ pusher-hackathon deploy --id your_app_id \
|
14
12
|
--secret your_app_secret \
|
15
|
-
--key your_app_key
|
16
|
-
[--port your_port]
|
13
|
+
--key your_app_key
|
17
14
|
|
18
|
-
This will
|
15
|
+
This will open up a Heroku dashboard. Click OK and in 20 seconds you'll have your own authentication app.
|
16
|
+
|
17
|
+
Boom, job done! Now get hacking!
|
18
|
+
|
19
|
+
## Usage
|
19
20
|
|
20
|
-
|
21
|
+
In your Javascript code, make the Pusher connection point to this server's `pusher/auth` endpoint for authentication. For presence-channels, you can also specify information to be associated with a channel member. A `user_id` is required, and `user_info` is optional.
|
21
22
|
|
22
23
|
```js
|
23
24
|
var pusher = new Pusher('APP_KEY', {
|
24
|
-
authEndpoint: "http://
|
25
|
+
authEndpoint: "http://yourapp.herokuapp.com/pusher/auth", // 9090 can be substituted for the port you specified.
|
25
26
|
|
26
27
|
auth: {
|
27
28
|
params: {
|
@@ -32,7 +33,16 @@ var pusher = new Pusher('APP_KEY', {
|
|
32
33
|
});
|
33
34
|
```
|
34
35
|
|
35
|
-
|
36
|
+
### Local Usage
|
37
|
+
|
38
|
+
Simply run the `pusher-hackathon` command, with your app's `id`, `key`, and `secret` as options. If you wish, you can choose to specify a `port`.
|
39
|
+
|
40
|
+
$ pusher-hackathon run --id your_app_id \
|
41
|
+
--secret your_app_secret \
|
42
|
+
--key your_app_key \
|
43
|
+
[--port your_port]
|
44
|
+
|
45
|
+
This will set up a Sinatra server for you. The default port it will be running on is `9090`.
|
36
46
|
|
37
47
|
## Contributing
|
38
48
|
|
data/bin/pusher-hackathon
CHANGED
@@ -7,16 +7,22 @@ require_relative '../lib/hackathon'
|
|
7
7
|
program :version, PusherHackathon::VERSION
|
8
8
|
program :description, 'A command-line tool to set up Pusher private- and presence-channel authentication for hackathons.'
|
9
9
|
|
10
|
-
|
11
|
-
c.syntax = 'pusher-hackathon run [options]'
|
12
|
-
c.summary = 'Run your authentication endpoint on localhost'
|
13
|
-
c.description = ''
|
14
|
-
c.example 'description', 'pusher-hackathon run --id your_app_id --key your_app_key --secret your_app_secret'
|
10
|
+
def parse_opts(c)
|
15
11
|
c.option '--key STRING', String, 'Your Pusher App Key'
|
16
12
|
c.option '--secret STRING',String, 'Your Pusher App Secret'
|
17
13
|
c.option '--id STRING', String,'Your Pusher App Id'
|
18
14
|
c.option '--port STRING', String, '[optional] The port you wish to run the endpoint on'
|
19
15
|
c.option '--url STRING', String, 'Your Pusher URL'
|
16
|
+
end
|
17
|
+
|
18
|
+
command :run do |c|
|
19
|
+
c.syntax = 'pusher-hackathon run [options]'
|
20
|
+
c.summary = 'Run your authentication endpoint on localhost'
|
21
|
+
c.description = ''
|
22
|
+
c.example 'description', 'pusher-hackathon run --id your_app_id --key your_app_key --secret your_app_secret'
|
23
|
+
|
24
|
+
parse_opts(c)
|
25
|
+
|
20
26
|
c.action do |args, options|
|
21
27
|
unless options.url || (options.key && options.secret && options.id)
|
22
28
|
puts "Type: `pusher-hackathon run --id your_app_id --key your_app_key --secret your_app_secret`"
|
@@ -27,4 +33,24 @@ command :run do |c|
|
|
27
33
|
PusherHackathon::AuthApp.run!
|
28
34
|
end
|
29
35
|
end
|
36
|
+
end
|
37
|
+
|
38
|
+
command :deploy do |c|
|
39
|
+
c.syntax = 'pusher-hackathon deploy [options]'
|
40
|
+
c.summary = 'Run your authentication endpoint on heroku'
|
41
|
+
c.description = ''
|
42
|
+
c.example 'description', 'pusher-hackathon deploy --url your_pusher_url'
|
43
|
+
|
44
|
+
parse_opts(c)
|
45
|
+
|
46
|
+
c.action do |args, options|
|
47
|
+
unless options.url || (options.key && options.secret && options.id)
|
48
|
+
puts "Type: `pusher-hackathon deploy --id your_app_id --key your_app_key --secret your_app_secret`"
|
49
|
+
else
|
50
|
+
require 'uri'
|
51
|
+
url = options.url || "https://#{options.key}:#{options.secret}@api.pusherapp.com/apps/#{options.app_id}"
|
52
|
+
url = URI.encode(url, /\W/)
|
53
|
+
`open 'https://heroku.com/deploy?template=https://github.com/jpatel531/pusher-auth&env[PUSHER_URL]=#{url}'`
|
54
|
+
end
|
55
|
+
end
|
30
56
|
end
|
data/lib/hackathon/version.rb
CHANGED