This repository has been archived by the owner. It is now read-only.
Permalink
Please sign in to comment.
Showing
with
80 additions
and 0 deletions.
@@ -0,0 +1,7 @@ | ||
+coverage | ||
+.bundle | ||
+pkg | ||
+.DS_Store | ||
+Gemfile.lock | ||
+tmp | ||
+.powrc |
5
Gemfile
@@ -0,0 +1,5 @@ | ||
+source "http://rubygems.org" | ||
+ | ||
+gem "sinatra" | ||
+gem "sinatra_auth_github" | ||
+ |
20
LICENSE
@@ -0,0 +1,20 @@ | ||
+Copyright (c) 2010 Scott Chacon | ||
+ | ||
+Permission is hereby granted, free of charge, to any person obtaining | ||
+a copy of this software and associated documentation files (the | ||
+"Software"), to deal in the Software without restriction, including | ||
+without limitation the rights to use, copy, modify, merge, publish, | ||
+distribute, sublicense, and/or sell copies of the Software, and to | ||
+permit persons to whom the Software is furnished to do so, subject to | ||
+the following conditions: | ||
+ | ||
+The above copyright notice and this permission notice shall be | ||
+included in all copies or substantial portions of the Software. | ||
+ | ||
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@@ -0,0 +1,5 @@ | ||
+GitHub Terminal | ||
+=============== | ||
+ | ||
+Awesome. | ||
+ |
31
app.rb
@@ -0,0 +1,31 @@ | ||
+require 'sinatra' | ||
+require 'sinatra_auth_github' | ||
+require 'pp' | ||
+ | ||
+class TerminalApp < Sinatra::Base | ||
+ enable :sessions | ||
+ | ||
+ set :github_options, { | ||
+ :secret => ENV['GITHUB_CLIENT_SECRET'], | ||
+ :client_id => ENV['GITHUB_CLIENT_ID'], | ||
+ :scopes => 'user,repo' # repo is need for org auth :\ | ||
+ } | ||
+ | ||
+ register Sinatra::Auth::Github | ||
+ | ||
+ helpers do | ||
+ def repos | ||
+ github_request("repos/show/#{github_user.login}") | ||
+ end | ||
+ end | ||
+ | ||
+ get '/' do | ||
+ authenticate! | ||
+ "Hello There, #{github_user.name}!#{github_user.token}\n#{repos.inspect}" | ||
+ end | ||
+ | ||
+ get '/logout' do | ||
+ logout! | ||
+ redirect '/' | ||
+ end | ||
+end |
12
config.ru
@@ -0,0 +1,12 @@ | ||
+require "rubygems" | ||
+require "bundler" | ||
+Bundler.setup | ||
+ | ||
+Bundler.require(:runtime) | ||
+ | ||
+require 'app' | ||
+ | ||
+use Rack::Static, :urls => ["/css", "/img", "/js"], :root => "public" | ||
+ | ||
+run TerminalApp | ||
+ |
0 comments on commit
f5d05d2