pusher-hackathon 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8bfb7898d724dc2880e699d9677b3f55dfa2e15b
4
+ data.tar.gz: e7315ca90777f7b6e5cae550d53bbedb452cda2f
5
+ SHA512:
6
+ metadata.gz: a4760eb82d9ddf3c497924b6882a676052b65e6ed0d280f5941c2ecc4ae9c6ee5ba58be96ccee205c89ad5b05846fa4c9368a7a2a3f5ed970c9df9a392c048a6
7
+ data.tar.gz: 901d402bfc121ac8e27e47604c55725c40421a186f5d14e40bc53730e6c5eea6de4f6b830b89ef718b28b41c6177d24ed80c25593ceaa6fd082fba2061746140
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pusher-hackathon.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Jamie Patel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Pusher::Hackathon
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'pusher-hackathon'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install pusher-hackathon
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/pusher-hackathon/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'commander/import'
5
+ require_relative '../lib/hackathon'
6
+
7
+ program :version, '0.0.1'
8
+ program :description, 'A command-line tool to set up Pusher private- and presence-channel authentication for hackathons.'
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'
15
+ c.option '--key STRING', String, 'Your Pusher App Key'
16
+ c.option '--secret STRING',String, 'Your Pusher App Secret'
17
+ c.option '--id STRING', String,'Your Pusher App Id'
18
+ c.option '--port NUMBER', String, '[optional] The port you wish to run the endpoint on'
19
+ c.action do |args, options|
20
+
21
+ if !(options.key && options.secret && options.id)
22
+ puts "Type: `pusher-hackathon run --id your_app_id --key your_app_key --secret your_app_secret`"
23
+ else
24
+
25
+ Pusher.app_id = options.id
26
+ Pusher.key = options.key
27
+ Pusher.secret = options.secret
28
+
29
+ PusherHackathon::AuthApp.set :port, options.port.to_i || 9090
30
+ PusherHackathon::AuthApp.run!
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <title>Pusher Test</title>
4
+ <script src="//js.pusher.com/2.2/pusher.js" type="text/javascript"></script>
5
+ <script type="text/javascript">
6
+
7
+ var pusher = new Pusher('235ba307396082ec6719', {
8
+ authEndpoint: "http://localhost:4040/pusher/auth",
9
+ auth: {
10
+ params: {
11
+ user_id: "yolo",
12
+ user_info: JSON.stringify({twitter: "yolo"}) // optional
13
+ }
14
+ }
15
+ });
16
+
17
+ var privateChannel = pusher.subscribe('private-channel');
18
+
19
+ var presenceChannel = pusher.subscribe('presence-test-channel');
20
+
21
+ presenceChannel.bind('pusher:subscription_succeeded', function(members){
22
+ console.log("Subscribed to presence channel!");
23
+ console.log(members.me)
24
+ });
25
+
26
+ </script>
27
+ </head>
28
+
29
+ <body>
30
+
31
+ <h2>Pusher Channel Auth</h2>
32
+
33
+ </body>
@@ -0,0 +1,3 @@
1
+ module PusherHackathon
2
+ VERSION = "0.0.1"
3
+ end
data/lib/hackathon.rb ADDED
@@ -0,0 +1,18 @@
1
+ require_relative "./hackathon/version"
2
+ require 'sinatra'
3
+ require 'pusher'
4
+ require 'json'
5
+
6
+ module PusherHackathon
7
+ class AuthApp < Sinatra::Base
8
+
9
+ post '/pusher/auth' do
10
+ response['Access-Control-Allow-Origin'] = '*'
11
+
12
+ Pusher[params[:channel_name]].authenticate(params[:socket_id], {
13
+ user_id: params[:user_id],
14
+ user_info: JSON.parse(params[:user_info])
15
+ }).to_json
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hackathon/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pusher-hackathon"
8
+ spec.version = PusherHackathon::VERSION
9
+ spec.authors = ["Jamie Patel"]
10
+ spec.email = ["jamie@notespublication.com"]
11
+ spec.summary = %q{Pusher hackathon tool}
12
+ spec.description = %q{A gem that starts up a server that authenticates your Pusher private- and presence-channelss}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ["pusher-hackathon"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_runtime_dependency "commander", ">= 4.2.1"
24
+ spec.add_runtime_dependency "sinatra", ">=1.4.6"
25
+ spec.add_runtime_dependency "pusher", ">= 0.14"
26
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pusher-hackathon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jamie Patel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: commander
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 4.2.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 4.2.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: sinatra
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.4.6
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.4.6
69
+ - !ruby/object:Gem::Dependency
70
+ name: pusher
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0.14'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0.14'
83
+ description: A gem that starts up a server that authenticates your Pusher private-
84
+ and presence-channelss
85
+ email:
86
+ - jamie@notespublication.com
87
+ executables:
88
+ - pusher-hackathon
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - .gitignore
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/pusher-hackathon
98
+ - example/index.html
99
+ - lib/hackathon.rb
100
+ - lib/hackathon/version.rb
101
+ - pusher-hackathon.gemspec
102
+ homepage: ''
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.4.2
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Pusher hackathon tool
126
+ test_files: []