sinatra_auth_github 0.0.11 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ coverage
2
+ .bundle
3
+ pkg
4
+ .DS_Store
5
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sinatra_auth_github.gemspec
4
+ gemspec
5
+
6
+ # vim:ft=ruby
data/Gemfile.lock ADDED
@@ -0,0 +1,60 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ ParseTree (3.0.6)
5
+ RubyInline (>= 3.7.0)
6
+ sexp_processor (>= 3.0.0)
7
+ RubyInline (3.8.6)
8
+ ZenTest (~> 4.3)
9
+ ZenTest (4.4.0)
10
+ addressable (2.2.2)
11
+ columnize (0.3.2)
12
+ faraday (0.4.6)
13
+ addressable (>= 2.1.1)
14
+ rack (>= 1.0.1)
15
+ json (1.4.6)
16
+ linecache (0.43)
17
+ mime-types (1.16)
18
+ multi_json (0.0.5)
19
+ oauth2 (0.0.13)
20
+ faraday (~> 0.4.1)
21
+ multi_json (>= 0.0.4)
22
+ rack (1.2.1)
23
+ rack-test (0.5.6)
24
+ rack (>= 1.0)
25
+ rake (0.8.7)
26
+ randexp (0.1.5)
27
+ ParseTree
28
+ rest-client (1.5.1)
29
+ mime-types (>= 1.16)
30
+ rspec (1.3.1)
31
+ ruby-debug (0.10.4)
32
+ columnize (>= 0.1)
33
+ ruby-debug-base (~> 0.10.4.0)
34
+ ruby-debug-base (0.10.4)
35
+ linecache (>= 0.3)
36
+ sexp_processor (3.0.5)
37
+ sinatra (1.1.0)
38
+ rack (~> 1.1)
39
+ tilt (~> 1.1)
40
+ tilt (1.1)
41
+ warden (0.10.7)
42
+ rack (>= 1.0.0)
43
+ warden-github (0.0.7)
44
+ json (>= 1.0.0)
45
+ oauth2 (~> 0.0.8)
46
+ warden (~> 0.10)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ bundler (~> 1.0)
53
+ rack-test (~> 0.5.3)
54
+ rake
55
+ randexp (~> 0.1.5)
56
+ rest-client (~> 1.5.1)
57
+ rspec (~> 1.3.0)
58
+ ruby-debug
59
+ sinatra (~> 1.0)
60
+ warden-github (~> 0.0.7)
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require 'rake/gempackagetask'
2
+ require 'rubygems/specification'
3
+ require 'date'
4
+ require 'bundler'
5
+
6
+ task :default => [:spec]
7
+
8
+ require 'spec/rake/spectask'
9
+ desc "Run specs"
10
+ Spec::Rake::SpecTask.new do |t|
11
+ t.spec_files = FileList['spec/**/*_spec.rb']
12
+ t.spec_opts = %w(-fs --color)
13
+ t.spec_opts << '--loadby' << 'random'
14
+
15
+ t.rcov_opts << '--exclude' << 'spec,.bundle'
16
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
17
+ t.rcov_opts << '--text-summary'
18
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
19
+ end
data/config.ru ADDED
@@ -0,0 +1,20 @@
1
+ ENV['RACK_ENV'] ||= 'development'
2
+ begin
3
+ require File.expand_path('../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ require "rubygems"
6
+ require "bundler"
7
+ Bundler.setup
8
+ end
9
+
10
+ Bundler.require(:runtime)
11
+
12
+ $LOAD_PATH << File.dirname(__FILE__) + '/lib'
13
+ require File.expand_path(File.join(File.dirname(__FILE__), 'lib', 'sinatra_auth_github'))
14
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'app'))
15
+
16
+ use Rack::Static, :urls => ["/css", "/img", "/js"], :root => "public"
17
+
18
+ run Example::App
19
+
20
+ # vim:ft=ruby
@@ -5,6 +5,8 @@ require 'rest_client'
5
5
  module Sinatra
6
6
  module Auth
7
7
  module Github
8
+ VERSION = "0.0.13"
9
+
8
10
  class BadAuthentication < Sinatra::Base
9
11
  get '/unauthenticated' do
10
12
  status 403
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "sinatra_auth_github"
6
+ s.version = "0.0.13"
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Corey Donohoe"]
9
+ s.email = ["atmos@atmos.org"]
10
+ s.homepage = "http://github.com/atmos/sinatra_auth_github"
11
+ s.summary = "A sinatra extension for easy oauth integration with github"
12
+ s.description = s.summary
13
+
14
+ s.rubyforge_project = "sinatra_auth_github"
15
+
16
+ s.add_dependency "sinatra", "~>1.0"
17
+ s.add_dependency "rest-client", "~>1.5.1"
18
+ s.add_dependency "warden-github", "~>0.0.7"
19
+
20
+ s.add_development_dependency "rake"
21
+ s.add_development_dependency "rspec", "~>1.3.0"
22
+ s.add_development_dependency "bundler", "~>1.0"
23
+ s.add_development_dependency "randexp", "~>0.1.5"
24
+ s.add_development_dependency "rack-test", "~>0.5.3"
25
+ s.add_development_dependency "ruby-debug"
26
+
27
+ s.files = `git ls-files`.split("\n")
28
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
+ s.require_paths = ["lib"]
31
+ end
data/spec/app.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'pp'
2
+
3
+ module Example
4
+ class App < Sinatra::Base
5
+ enable :sessions
6
+
7
+ set :github_options, { :client_id => ENV['GH_CLIENT_ID'],
8
+ :secret => ENV['GH_SECRET'],
9
+ :scopes => 'user,offline_access,repo' }
10
+
11
+ register Sinatra::Auth::Github
12
+
13
+ before do
14
+ authenticate!
15
+ end
16
+
17
+ helpers do
18
+ def repos
19
+ github_request("repos/show/#{github_user.login}")
20
+ end
21
+ end
22
+
23
+ get '/' do
24
+ "Hello There, #{github_user.name}!#{github_user.token}\n#{repos.inspect}"
25
+ end
26
+
27
+ get '/logout' do
28
+ logout!
29
+ redirect '/'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ Bundler.require(:default, :runtime, :test)
2
+
3
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'sinatra', 'auth', 'github')
4
+
5
+ require 'pp'
6
+
7
+ Webrat.configure do |config|
8
+ config.mode = :rack
9
+ config.application_port = 4567
10
+ end
11
+
12
+ Spec::Runner.configure do |config|
13
+ config.include(Rack::Test::Methods)
14
+ config.include(Webrat::Methods)
15
+ config.include(Webrat::Matchers)
16
+
17
+ def app
18
+ Example.app
19
+ end
20
+ 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: 9
5
- prerelease: false
4
+ hash: 5
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Corey Donohoe
@@ -15,14 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-19 00:00:00 -07:00
18
+ date: 2011-04-08 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
- prerelease: false
24
22
  name: sinatra
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
26
  requirements:
28
27
  - - ~>
@@ -32,54 +31,155 @@ dependencies:
32
31
  - 1
33
32
  - 0
34
33
  version: "1.0"
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
37
34
  type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rest-client
38
38
  prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 1
45
+ segments:
46
+ - 1
47
+ - 5
48
+ - 1
49
+ version: 1.5.1
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
39
53
  name: warden-github
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
41
56
  none: false
42
57
  requirements:
43
58
  - - ~>
44
59
  - !ruby/object:Gem::Version
45
- hash: 21
60
+ hash: 17
46
61
  segments:
47
62
  - 0
48
63
  - 0
49
- - 5
50
- version: 0.0.5
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
64
+ - 7
65
+ version: 0.0.7
53
66
  type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: rake
54
70
  prerelease: false
55
- name: rest-client
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :development
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: rspec
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
57
86
  none: false
58
87
  requirements:
59
88
  - - ~>
60
89
  - !ruby/object:Gem::Version
61
- hash: 1
90
+ hash: 27
62
91
  segments:
63
92
  - 1
64
- - 5
93
+ - 3
94
+ - 0
95
+ version: 1.3.0
96
+ type: :development
97
+ version_requirements: *id005
98
+ - !ruby/object:Gem::Dependency
99
+ name: bundler
100
+ prerelease: false
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ~>
105
+ - !ruby/object:Gem::Version
106
+ hash: 15
107
+ segments:
65
108
  - 1
66
- version: 1.5.1
67
- requirement: *id003
109
+ - 0
110
+ version: "1.0"
111
+ type: :development
112
+ version_requirements: *id006
113
+ - !ruby/object:Gem::Dependency
114
+ name: randexp
115
+ prerelease: false
116
+ requirement: &id007 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ~>
120
+ - !ruby/object:Gem::Version
121
+ hash: 17
122
+ segments:
123
+ - 0
124
+ - 1
125
+ - 5
126
+ version: 0.1.5
127
+ type: :development
128
+ version_requirements: *id007
129
+ - !ruby/object:Gem::Dependency
130
+ name: rack-test
131
+ prerelease: false
132
+ requirement: &id008 !ruby/object:Gem::Requirement
133
+ none: false
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ hash: 13
138
+ segments:
139
+ - 0
140
+ - 5
141
+ - 3
142
+ version: 0.5.3
143
+ type: :development
144
+ version_requirements: *id008
145
+ - !ruby/object:Gem::Dependency
146
+ name: ruby-debug
147
+ prerelease: false
148
+ requirement: &id009 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ type: :development
158
+ version_requirements: *id009
68
159
  description: A sinatra extension for easy oauth integration with github
69
- email: atmos@atmos.org
160
+ email:
161
+ - atmos@atmos.org
70
162
  executables: []
71
163
 
72
164
  extensions: []
73
165
 
74
- extra_rdoc_files:
75
- - LICENSE
166
+ extra_rdoc_files: []
167
+
76
168
  files:
169
+ - .gitignore
170
+ - Gemfile
171
+ - Gemfile.lock
77
172
  - LICENSE
78
173
  - README.md
174
+ - Rakefile
175
+ - config.ru
79
176
  - lib/sinatra/auth/github.rb
80
177
  - lib/sinatra_auth_github.rb
178
+ - sinatra_auth_github.gemspec
179
+ - spec/app.rb
180
+ - spec/spec_helper.rb
81
181
  has_rdoc: true
82
- homepage: http://www.github.com/atmos/sinatra_auth_github
182
+ homepage: http://github.com/atmos/sinatra_auth_github
83
183
  licenses: []
84
184
 
85
185
  post_install_message:
@@ -107,10 +207,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
207
  version: "0"
108
208
  requirements: []
109
209
 
110
- rubyforge_project:
111
- rubygems_version: 1.3.7
210
+ rubyforge_project: sinatra_auth_github
211
+ rubygems_version: 1.6.2
112
212
  signing_key:
113
213
  specification_version: 3
114
214
  summary: A sinatra extension for easy oauth integration with github
115
- test_files: []
116
-
215
+ test_files:
216
+ - spec/app.rb
217
+ - spec/spec_helper.rb