Install (copy & paste):
curl -sL raw.github.com/gist/1676577/travis.rb > ~/bin/travis \
&& chmod +x ~/bin/travis
gem install hub | tail -2
ruby -e 'require "json"' 2>/dev/null || gem install json
#!/usr/bin/env bash | |
__rvm_system_wide_permissions() { | |
[[ -z "$1" ]] && return 1 | |
chown -R root:"$rvm_group_name" "$1" | |
chmod -R g+w "$1" | |
[[ -d "$1" ]] && find "$1" -type d -exec chmod g+s '{}' + | |
} | |
# Require root to install it. |
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
# RVM is unavailable at this point. | |
raise "RVM ruby lib is currently unavailable." |
# environment.rb | |
# | |
# These are models you should define. (you can change the model name, of course) | |
# * Oauth2::AccessToken | |
Rails::Initializer.run do |config| | |
: | |
require 'rack/oauth2' | |
oauth2_authenticator = lambda do |request| | |
access_token = Oauth2::AccessToken.find_by_token(request.access_token) |
# You should define those models. (you can change the model names) | |
# | |
# * Oauth2::Client | |
# * Oauth2::AccessToken | |
# * Oauth2::RefreshToken | |
# * Oauth2::AuthorizationCode | |
class Oauth2Controller < ApplicationController | |
before_filter :require_authentication, :only => :authorize |
require 'sinatra' | |
require 'omniauth' | |
class Application < Sinatra::Base | |
use OmniAuth::Builder do | |
provider :github, 'github_id', 'github_secret' | |
end | |
get '/' do |
class ApplicationController < ActionController::Base | |
before_filter :ensure_proper_protocol | |
protected | |
def ssl_allowed_action? | |
(params[:controller] == 'users/sessions' && ['new', 'create'].include?(params[:action])) || | |
(params[:controller] == 'users/registrations' && ['new', 'create', 'edit', 'update'].include?(params[:action])) || | |
(params[:controller] == 'users/omniauth_callbacks') | |
end |
body { | |
background-color: #FFF; | |
} | |
#wrapper { | |
width: 90%; | |
margin: 200px auto; | |
} | |
h1 { |
body { | |
background-color: #7A060C; | |
} | |
#wrapper { | |
width: 90%; | |
margin: 200px auto; | |
} | |
h1 { |