sinatra_auth_github 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +8 -4
  2. data/lib/sinatra/auth/github.rb +5 -1
  3. metadata +3 -3
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  sinatra_auth_github
2
2
  ===================
3
3
 
4
- A sinatra app the provides a gem that...
4
+ A sinatra extension that provides oauth authentication to github. Find out more about enabling your application at github's [oauth quickstart](http://gist.github.com/419219).
5
5
 
6
- Developing
7
- ==========
6
+ To test it out on localhost set your callback url to 'http://localhost:9292/auth/github/callback'
7
+
8
+ There's an example app in [spec/app.rb](/atmos/sinatra_auth_github/blob/master/spec/app.rb).
9
+
10
+ The Extension in Action
11
+ =======================
8
12
  % gem install bundler
9
13
  % bundle install
10
- % bundle exec rake
14
+ % GH_CLIENT_ID="<from GH>" GH_SECRET="<from GH>" bundle exec rackup
@@ -28,6 +28,10 @@ module Sinatra
28
28
  def github_user
29
29
  warden.user
30
30
  end
31
+
32
+ def relative_url_for(path)
33
+ request.script_name + path
34
+ end
31
35
  end
32
36
 
33
37
  def self.registered(app)
@@ -45,7 +49,7 @@ module Sinatra
45
49
 
46
50
  app.get '/auth/github/callback' do
47
51
  authenticate!
48
- redirect "/"
52
+ redirect relative_url_for('/')
49
53
  end
50
54
  end
51
55
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_auth_github
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Corey Donohoe