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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6145ba3bc310006ca6980f1f3c0ff4f353f1f474
4
- data.tar.gz: c48efe0cb7f8c9c98c765cc7df5d443948424095
3
+ metadata.gz: 599d72e505a7df27ea5e727fcc0b0b3faabbff36
4
+ data.tar.gz: 6999ef849424eeb25e92f27911d2f1f5585c3299
5
5
  SHA512:
6
- metadata.gz: 769a8da7422a41875add139b0eeccae04353505d6ac9774a9f79d87a612fb2b36047b5c42d8593db997710ad6f60767ab893a88804b75219743bf683876aae99
7
- data.tar.gz: d8a35db5b325de5af78b523724c6a5d94eec046231adad1345bbdf441d6afbfd7d3267642f6da41419941f588b57d89120d1b3f32c6164f3f4852ec7052092b4
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
- ## Usage
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 run --id your_app_id \
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 set up a Sinatra server for you. The default port it will be running on is `9090`.
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
- Then, 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
+ 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://localhost:9090/pusher/auth", // 9090 can be substituted for the port you specified.
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
- Boom, job done! Now get hacking!
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
- command :run do |c|
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
@@ -1,3 +1,3 @@
1
1
  module PusherHackathon
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pusher-hackathon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Patel