warden-github 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,6 +7,11 @@ To test it out on localhost set your callback url to 'http://localhost:9292/auth
7
7
 
8
8
  There's an example app in [spec/app.rb](/atmos/warden-github/blob/master/spec/app.rb).
9
9
 
10
+ Using with GitHub Enterprise
11
+ ============================
12
+
13
+ Export the `OCTOKIT_API_ENDPOINT` environmental variable to the URL of your enterprise install.
14
+
10
15
  The Extension in Action
11
16
  =======================
12
17
  % gem install bundler
data/config.ru CHANGED
@@ -9,7 +9,7 @@ rescue LoadError
9
9
  end
10
10
 
11
11
  Bundler.require(:runtime, :test)
12
- #require "debugger"
12
+ require "ruby-debug"
13
13
 
14
14
  $LOAD_PATH << File.dirname(__FILE__) + '/lib'
15
15
  require File.expand_path(File.join(File.dirname(__FILE__), 'lib', 'warden-github'))
@@ -54,7 +54,7 @@ Warden::Strategies.add(:github) do
54
54
  end
55
55
 
56
56
  def user_info_for(token)
57
- @user_info ||= RestClient.get("https://api.github.com/user", :params => {:access_token => token})
57
+ @user_info ||= RestClient.get(github_api_uri + "/user", :params => {:access_token => token})
58
58
  end
59
59
 
60
60
  def callback_url
@@ -72,4 +72,12 @@ Warden::Strategies.add(:github) do
72
72
  proto = "http" if proto.nil?
73
73
  "#{proto}://#{request.host}#{port_part}#{suffix}"
74
74
  end
75
+
76
+ def github_api_uri
77
+ if ENV['OCTOKIT_API_ENDPOINT']
78
+ ENV['OCTOKIT_API_ENDPOINT']
79
+ else
80
+ "https://api.github.com"
81
+ end
82
+ end
75
83
  end
@@ -1,5 +1,5 @@
1
1
  module Warden
2
2
  module Github
3
- VERSION = "0.12.0"
3
+ VERSION = "0.12.1"
4
4
  end
5
5
  end
data/spec/app.rb CHANGED
@@ -13,7 +13,7 @@ module Example
13
13
  manager[:github_client_id] = ENV['GITHUB_CLIENT_ID'] || 'ee9aa24b64d82c21535a'
14
14
  manager[:github_secret] = ENV['GITHUB_CLIENT_SECRET'] || 'ed8ff0c54067aefb808dab1ca265865405d08d6f'
15
15
 
16
- manager[:github_scopes] = 'repo'
16
+ manager[:github_scopes] = ''
17
17
  manager[:github_oauth_domain] = ENV['GITHUB_OAUTH_DOMAIN'] || 'https://github.com'
18
18
  manager[:github_callback_url] = '/auth/github/callback'
19
19
  end
@@ -34,9 +34,9 @@ module Example
34
34
  ensure_authenticated
35
35
  <<-EOS
36
36
  <h2>Hello There, #{user.name}!</h2>
37
- <h3>Rails Org Member: #{user.organization_member?('github')}.</h3>
38
- <h3>Publicized Rails Org Member: #{user.publicized_organization_member?('github')}.</h3>
39
- <h3>Rails Committer Team Member: #{user.team_member?(135235)}.</h3>
37
+ <h3>Rails Org Member: #{user.organization_member?('rails')}.</h3>
38
+ <h3>Publicized Rails Org Member: #{user.publicized_organization_member?('rails')}.</h3>
39
+ <h3>Rails Committer Team Member: #{user.team_member?(632)}.</h3>
40
40
  EOS
41
41
  end
42
42
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warden-github
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 45
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 12
9
- - 0
10
- version: 0.12.0
9
+ - 1
10
+ version: 0.12.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Corey Donohoe
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-30 00:00:00 -08:00
18
+ date: 2013-01-28 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency