Skip to content

Commit 291540b

Browse files
committedSep 20, 2014
gemfile update and omniauth
1 parent ed16f15 commit 291540b

File tree

8 files changed

+43
-25
lines changed

8 files changed

+43
-25
lines changed
 

‎Gemfile

+9-25
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
11
source 'https://rubygems.org'
22

3-
4-
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
53
gem 'rails', '4.1.4'
6-
gem 'sqlite3'
74
gem 'sass-rails', '~> 4.0.3'
85
gem 'uglifier', '>= 1.3.0'
96
gem 'coffee-rails', '~> 4.0.0'
107
gem 'slim-rails'
11-
# gem 'slim-rails'
12-
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
13-
# gem 'therubyracer', platforms: :ruby
148

159
gem 'devise'
1610
gem 'cancancan'
1711

1812
gem 'paperclip'
1913
gem 'aws-sdk'
2014

21-
# Use jquery as the JavaScript library
2215
gem 'jquery-rails'
23-
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
2416
gem 'turbolinks'
25-
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
2617
gem 'jbuilder', '~> 2.0'
27-
# bundle exec rake doc:rails generates the API under doc/api.
28-
gem 'sdoc', '~> 0.4.0', group: :doc
29-
30-
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
31-
gem 'spring', group: :development
32-
33-
# Use ActiveModel has_secure_password
34-
# gem 'bcrypt', '~> 3.1.7'
35-
36-
# Use unicorn as the app server
37-
# gem 'unicorn'
38-
39-
# Use Capistrano for deployment
40-
# gem 'capistrano-rails', group: :development
18+
gem 'omniauth'
4119

42-
# Use debugger
43-
# gem 'debugger', group: [:development, :test]
20+
group :development do
21+
gem 'sqlite3'
22+
gem 'better_errors'
23+
end
4424

25+
group :production do
26+
gem 'pg'
27+
gem 'unicorn'
28+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Place all the behaviors and hooks related to the matching controller here.
2+
# All this logic will automatically be available in application.js.
3+
# You can use CoffeeScript in this file: http://coffeescript.org/
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Place all the styles related to the sessions controller here.
2+
// They will automatically be included in application.css.
3+
// You can use Sass (SCSS) here: http://sass-lang.com/
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class SessionsController < ApplicationController
2+
def create
3+
@user = User.find_or_create_from_auth_hash(auth_hash)
4+
self.current_user = @user
5+
redirect_to '/'
6+
end
7+
8+
protected
9+
10+
def auth_hash
11+
request.env['omniauth.auth']
12+
end
13+
end

‎app/helpers/sessions_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module SessionsHelper
2+
end

‎config/routes.rb

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
end
99
end
1010

11+
match '/auth/:provider/callback', to: 'sessions#create', via: 'get'
12+
1113
devise_for :users
1214
root 'pages#home'
1315
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'test_helper'
2+
3+
class SessionsControllerTest < ActionController::TestCase
4+
# test "the truth" do
5+
# assert true
6+
# end
7+
end

‎test/helpers/sessions_helper_test.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require 'test_helper'
2+
3+
class SessionsHelperTest < ActionView::TestCase
4+
end

0 commit comments

Comments
 (0)
Please sign in to comment.