google_authentication 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +28 -0
- data/Guardfile +20 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +150 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/app/controllers/google_authentication/omniauth_callbacks_controller.rb +11 -0
- data/app/controllers/google_authentication/sessions_controller.rb +10 -0
- data/config/routes.rb +11 -0
- data/features/google_authentication.feature +27 -0
- data/features/step_definitions/google_authentication_steps.rb +19 -0
- data/features/support/env.rb +24 -0
- data/google_authentication.gemspec +155 -0
- data/lib/generators/google_authentication/google_authentication_generator.rb +46 -0
- data/lib/generators/google_authentication/install_generator.rb +27 -0
- data/lib/generators/templates/MODEL.warning +10 -0
- data/lib/generators/templates/README +11 -0
- data/lib/generators/templates/google_authentication.rb +14 -0
- data/lib/generators/templates/migration.rb +27 -0
- data/lib/google_authentication.rb +43 -0
- data/lib/google_authentication/acts_as_google_user.rb +77 -0
- data/lib/google_authentication/engine.rb +19 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/posts_controller.rb +83 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/models/user.rb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +23 -0
- data/spec/dummy/app/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +25 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +15 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +45 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +204 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/devise.en.yml +53 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/db/migrate/20110630105039_create_posts.rb +14 -0
- data/spec/dummy/db/migrate/20110630111038_devise_create_users.rb +18 -0
- data/spec/dummy/db/schema.rb +34 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/spec/dummy/public/javascripts/rails.js +191 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/public/stylesheets/scaffold.css +56 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/generators/google_authentication_generator_spec.rb +39 -0
- data/spec/generators/install_generator_spec.rb +23 -0
- data/spec/google_authentication_spec.rb +28 -0
- data/spec/integration/navigation_spec.rb +22 -0
- data/spec/models/acts_as_google_user_spec.rb +67 -0
- data/spec/spec_helper.rb +37 -0
- metadata +289 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@google_authentication --create
|
data/Gemfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'rails', '>= 3.0.0'
|
4
|
+
gem 'omniauth' # This MUST be before devise
|
5
|
+
gem 'devise', '>= 1.2.0'
|
6
|
+
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "sqlite3"
|
11
|
+
gem "rspec-rails"
|
12
|
+
gem "guard-rspec"
|
13
|
+
gem "capybara", ">= 0.4.0"
|
14
|
+
gem "yard"
|
15
|
+
gem "cucumber", "~> 0.10"
|
16
|
+
gem "bundler", "~> 1.0.0"
|
17
|
+
gem "jeweler", "~> 1.6.2"
|
18
|
+
gem "rcov", ">= 0"
|
19
|
+
if RUBY_PLATFORM.downcase.include?("darwin") # I'm on Mac
|
20
|
+
gem "rb-fsevent"
|
21
|
+
gem "growl"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
group :test do
|
26
|
+
gem "aruba"
|
27
|
+
gem "generator_spec"
|
28
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^spec/.+_spec\.rb$})
|
11
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
12
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
13
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
14
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
15
|
+
watch('spec/spec_helper.rb') { "spec" }
|
16
|
+
watch('config/routes.rb') { "spec/routing" }
|
17
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
18
|
+
# Capybara request specs
|
19
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
20
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Fabio Napoleoni
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# google_authentication with devise + omniauth
|
2
|
+
|
3
|
+
I found myself using Google authentication in a lot of projects (especially private projects which require google apps
|
4
|
+
authentication). With Omniauth it's pretty simple to authenticate against Google and Devise has a lot of convenient helpers.
|
5
|
+
|
6
|
+
But if you need to use Devise with a model which is only `:omniauthable` you'll have to do a lot of configuration to make
|
7
|
+
it working, as you can see [here](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview). Essentially you need
|
8
|
+
to define custom routes, a callbacks controller for processing Omniauth responses and a sessions controller because
|
9
|
+
you can't use Devise one if your model is only `:omniauthable`.
|
10
|
+
|
11
|
+
I'm studying Rails Engines, so this gem is my first attempt with them. I tried to build all the needed stuff in a gem to
|
12
|
+
develop an out-of-the-box solution for Google authentication based on devise + omniauth. This gem is the result.
|
13
|
+
|
14
|
+
## Hello world Google
|
15
|
+
|
16
|
+
This is the minimal configuration in order to use google as authenticator for your projects
|
17
|
+
|
18
|
+
rails new google_app
|
19
|
+
gem 'google_authentication' # in your Gemfile
|
20
|
+
bundle install
|
21
|
+
rails g google_authentication:install # this will also install devise in your app
|
22
|
+
rails g google_authentication user # this will generate a model and it will enable devise routes for it
|
23
|
+
rake db:migrate
|
24
|
+
|
25
|
+
No other steps are needed, you have a working google application. You can use all the devise helpers and routes in your
|
26
|
+
app, with no further configuration.
|
27
|
+
|
28
|
+
## A deeper look
|
29
|
+
|
30
|
+
To use the gem the mandatory steps are pretty standard
|
31
|
+
|
32
|
+
gem 'google_authentication' # in your Gemfile
|
33
|
+
|
34
|
+
Then (after the `bundle install` command) you must install devise and google_authentication initializers in the app with
|
35
|
+
the command
|
36
|
+
|
37
|
+
rails g google_authentication:install # this will also install devise in your app
|
38
|
+
|
39
|
+
As far as the model defined in the `:model_name` config parameter doesn't exist the gem (and devise itself) is invisible
|
40
|
+
to your app.
|
41
|
+
|
42
|
+
You can use the given generator to create a Google authenticable model with
|
43
|
+
|
44
|
+
rails g google_authentication user # this will generate a model and it will enable devise routes for it
|
45
|
+
rake db:migrate
|
46
|
+
|
47
|
+
These commands will (indirectly) activate the gem routes by defining the `User` class. The generated model contains an
|
48
|
+
`acts_as_google_user` call which activates devise features for that model.
|
49
|
+
|
50
|
+
At this point you can start using devise methods, helpers and filters in your app, something like this piece of code in
|
51
|
+
your views (or layout)
|
52
|
+
|
53
|
+
<% if current_user %>
|
54
|
+
<p>Currently logged in as <strong><%= current_user.email %></strong></p>
|
55
|
+
<% else %>
|
56
|
+
<p>You're not logged in, <%= link_to 'Login', user_omniauth_authorize_path(:google_apps) %></p>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
If you want to add Google authentication to an existing model you'll have to add an `acts_as_google_user` call in it and
|
60
|
+
you need to generate a migration which creates required fields with
|
61
|
+
|
62
|
+
rails g migration add_google_authentication_to_user email:string omniauth_uid:string
|
63
|
+
|
64
|
+
Which creates a migration like this one
|
65
|
+
|
66
|
+
class AddGoogleAuthenticationToUser < ActiveRecord::Migration
|
67
|
+
def self.up
|
68
|
+
add_column :users, :email, :string
|
69
|
+
add_column :users, :omniauth_uid, :string
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.down
|
73
|
+
remove_column :users, :omniauth_uid
|
74
|
+
remove_column :users, :email
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
You may still need to edit the generated migration to add other devise fields if you use other devise modules.
|
79
|
+
See [this wiki page](https://github.com/plataformatec/devise/wiki/How-To:-change-an-already-existing-table-to-add-devise-required-columns) and below
|
80
|
+
|
81
|
+
## Configuration and Customization
|
82
|
+
|
83
|
+
At this stage my gem has only 2 configurable params: `domain` and `model_name`. You can configure them in the initializer
|
84
|
+
created by the install generator.
|
85
|
+
|
86
|
+
* **domain:** it tell the gem which google domain it should use to authenticate users
|
87
|
+
* **model_name:** it tell the gem which model should be authenticated with Google
|
88
|
+
|
89
|
+
## Model creation and retrieval
|
90
|
+
|
91
|
+
When returning from google auth page to your app gem's callback controller is invoked and it search for an existing user
|
92
|
+
with the given `omniauth_uid`. If he can't be found it creates it and sign in him. If the user already exist it will
|
93
|
+
update its fields with omniauth returned ones.
|
94
|
+
|
95
|
+
This (pretty simple) logic is implemented in the `acts_as_google_user` behavior and it can be customized as you wish.
|
96
|
+
|
97
|
+
To replace the default finder just define a class method in you model named `find_or_create_by_omniauth` and it will be
|
98
|
+
called in the callback controller to retrieve or create the users. This method will be invoked with the full omniauth hash
|
99
|
+
returned by omniauth gem. With the current omniauth implementation it will contain the following values
|
100
|
+
|
101
|
+
* `provider` (required) - The provider with which the user authenticated (i.e. 'google_apps')
|
102
|
+
* `uid` (required) - An identifier unique to the given provider. Should be used as unique identifier for your users, stored as a string.
|
103
|
+
* `user_info` (required) - A hash containing information about the user
|
104
|
+
* `name` (required) - The best display name known to the strategy. Usually a concatenation of first and last name.
|
105
|
+
* `email` - The e-mail of the authenticating user.
|
106
|
+
* `first_name`
|
107
|
+
* `last_name`
|
108
|
+
|
109
|
+
## Integration with other devise modules
|
110
|
+
|
111
|
+
Models used in this gem may use other devise modules in a transparent way, just pass devise modules to the `acts_as_google_user`
|
112
|
+
call. However I've excluded some modules because they're useless in this context, so you can not pass any of them to the call.
|
113
|
+
These are the devise modules you can use in your models:
|
114
|
+
|
115
|
+
class User < ActiveRecord::Base
|
116
|
+
# :omniauthable is obviously included by default even if you don't list it
|
117
|
+
acts_as_google_user :omniauthable, :token_authenticable, :trackable, :timeoutable, :rememberable
|
118
|
+
end
|
119
|
+
|
120
|
+
## Known issues
|
121
|
+
|
122
|
+
I'm a fun of Cucumber + Rspec so I tried to test my gem with these two tools, however it is not fully tested (I had
|
123
|
+
trouble in writing some spec for a Rails Engine) but it still has a pretty decent coverage.
|
124
|
+
|
125
|
+
Moreover I wrote some high level integration test with [Aruba](https://github.com/cucumber/aruba) but I can't make them
|
126
|
+
running. I opened [an issue on for aruba](https://github.com/cucumber/aruba/issues/77), but I'm not sure that the problem
|
127
|
+
is with Aruba itself, it could also be related in some way with Bundler. You can clone the repo and run the features by
|
128
|
+
yourself to see what's happening. Any fix for that is welcome...
|
129
|
+
|
130
|
+
## Contributing to google_authentication
|
131
|
+
|
132
|
+
I'm using the [gitflow model](https://github.com/nvie/gitflow) to maintain this gem, so all the development stuff is in
|
133
|
+
the develop branch, master will contain only stable code.
|
134
|
+
|
135
|
+
For gem publishing and maintaining I'm using the [jeweler gem](https://github.com/technicalpickles/jeweler), so you can
|
136
|
+
fork my project and run `bundle install` to get the required dependencies.
|
137
|
+
|
138
|
+
* Check out the latest develop to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
139
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
140
|
+
* Fork the project
|
141
|
+
* Start a feature/bugfix branch
|
142
|
+
* Commit and push until you are happy with your contribution
|
143
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
144
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
145
|
+
|
146
|
+
## Copyright
|
147
|
+
|
148
|
+
Copyright (c) 2011 Fabio Napoleoni. See LICENSE.txt for
|
149
|
+
further details.
|
150
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "google_authentication"
|
18
|
+
gem.homepage = "http://github.com/fabn/google_authentication"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Authenticate users through Google in your app}
|
21
|
+
gem.description = %Q{Authenticate users through Google in your app using devise and omniauth}
|
22
|
+
gem.email = "f.napoleoni@gmail.com"
|
23
|
+
gem.authors = ["Fabio Napoleoni"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
require 'cucumber/rake/task'
|
40
|
+
Cucumber::Rake::Task.new(:features)
|
41
|
+
|
42
|
+
task :default => :spec
|
43
|
+
|
44
|
+
require 'yard'
|
45
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class GoogleAuthentication::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
2
|
+
|
3
|
+
unloadable
|
4
|
+
|
5
|
+
# callback called by devise on successful authentication
|
6
|
+
def google_apps
|
7
|
+
@resource = resource_class.find_or_create_by_omniauth_impl(request.env["omniauth.auth"])
|
8
|
+
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Google"
|
9
|
+
sign_in_and_redirect @resource, :event => :authentication
|
10
|
+
end
|
11
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
if GoogleAuthentication.define_routes?
|
4
|
+
# Devise + omniauth routes only if the given class exist
|
5
|
+
devise_for GoogleAuthentication.devise_table, :controllers => {:omniauth_callbacks => "google_authentication/omniauth_callbacks"} do
|
6
|
+
get 'sign_in', :to => 'google_authentication/sessions#new', :as => :new_user_session
|
7
|
+
get 'sign_out', :to => 'google_authentication/sessions#destroy', :as => :destroy_user_session
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Create a new application
|
2
|
+
In order to use google_authentication gem
|
3
|
+
A user should create a new rails application and install the gem and run the generator
|
4
|
+
|
5
|
+
Background: A new rails application has been created with google_authentication gem
|
6
|
+
Given a rails application named "google_app" exists
|
7
|
+
And this gem is installed in that application
|
8
|
+
|
9
|
+
@announce
|
10
|
+
Scenario: Installation using default values
|
11
|
+
When I successfully run `rails generate google_authentication:install`
|
12
|
+
# this is needed because rails g returns 0 when can't find the generator
|
13
|
+
And the output should not contain "Could not find generator"
|
14
|
+
Then a file named "config/initializers/devise.rb" should exist
|
15
|
+
And the file "config/initializers/google_authentication.rb" should contain "# config.domain = 'gmail.com'"
|
16
|
+
And the file "config/initializers/google_authentication.rb" should contain "# config.model_name = :user"
|
17
|
+
|
18
|
+
Scenario: Installation with model generation and default values
|
19
|
+
When I generate the model with "" as argument
|
20
|
+
Then the file "app/models/user.rb" should contain "acts_as_google_user"
|
21
|
+
And the file "db/schema.rb" should contain "users"
|
22
|
+
|
23
|
+
Scenario: Installation with different model name
|
24
|
+
When I generate the model with "account" as argument
|
25
|
+
Then the file "app/models/account.rb" should contain "acts_as_google_user"
|
26
|
+
And the file "config/initializers/google_authentication.rb" should contain "config.model_name = :account"
|
27
|
+
And the file "db/schema.rb" should contain "accounts"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Given /^a rails application named "([^\"]*)" exists$/ do |app_name|
|
2
|
+
@app_name = app_name
|
3
|
+
Given "I successfully run `rm -rf #{app_name}`"
|
4
|
+
And "a directory named \"#{app_name}\" should not exist"
|
5
|
+
And "I successfully run `rails new #{app_name}`"
|
6
|
+
And "I cd to \"#{app_name}\""
|
7
|
+
end
|
8
|
+
|
9
|
+
When /^this gem is installed in that application$/ do
|
10
|
+
gempath = File.expand_path('../../../', __FILE__)
|
11
|
+
Given "I append to \"Gemfile\" with \"gem 'google_authentication', :path => '#{gempath}'\""
|
12
|
+
And "I successfully run `bundle check`"
|
13
|
+
end
|
14
|
+
|
15
|
+
When /^I generate the model with "([^\"]*)" as argument$/ do |model_name|
|
16
|
+
Given "I successfully run `rails generate google_authentication:install`"
|
17
|
+
And "I successfully run `rails generate google_authentication #{model_name}`"
|
18
|
+
And "I successfully run `rake db:migrate`"
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
11
|
+
require 'rails/all'
|
12
|
+
require 'google_authentication'
|
13
|
+
|
14
|
+
require 'rspec/expectations'
|
15
|
+
|
16
|
+
# using aruba for full integration features
|
17
|
+
require 'aruba/cucumber'
|
18
|
+
|
19
|
+
Before do
|
20
|
+
#@dirs = ["/tmp/aruba"]
|
21
|
+
# raise timeouts
|
22
|
+
@aruba_timeout_seconds = 10
|
23
|
+
@aruba_io_wait_seconds = 10
|
24
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{google_authentication}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Fabio Napoleoni"]
|
12
|
+
s.date = %q{2011-07-04}
|
13
|
+
s.description = %q{Authenticate users through Google in your app using devise and omniauth}
|
14
|
+
s.email = %q{f.napoleoni@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.markdown"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".rvmrc",
|
23
|
+
"Gemfile",
|
24
|
+
"Guardfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.markdown",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"app/controllers/google_authentication/omniauth_callbacks_controller.rb",
|
30
|
+
"app/controllers/google_authentication/sessions_controller.rb",
|
31
|
+
"config/routes.rb",
|
32
|
+
"features/google_authentication.feature",
|
33
|
+
"features/step_definitions/google_authentication_steps.rb",
|
34
|
+
"features/support/env.rb",
|
35
|
+
"google_authentication.gemspec",
|
36
|
+
"lib/generators/google_authentication/google_authentication_generator.rb",
|
37
|
+
"lib/generators/google_authentication/install_generator.rb",
|
38
|
+
"lib/generators/templates/MODEL.warning",
|
39
|
+
"lib/generators/templates/README",
|
40
|
+
"lib/generators/templates/google_authentication.rb",
|
41
|
+
"lib/generators/templates/migration.rb",
|
42
|
+
"lib/google_authentication.rb",
|
43
|
+
"lib/google_authentication/acts_as_google_user.rb",
|
44
|
+
"lib/google_authentication/engine.rb",
|
45
|
+
"spec/dummy/Rakefile",
|
46
|
+
"spec/dummy/app/controllers/application_controller.rb",
|
47
|
+
"spec/dummy/app/controllers/posts_controller.rb",
|
48
|
+
"spec/dummy/app/helpers/application_helper.rb",
|
49
|
+
"spec/dummy/app/helpers/posts_helper.rb",
|
50
|
+
"spec/dummy/app/models/post.rb",
|
51
|
+
"spec/dummy/app/models/user.rb",
|
52
|
+
"spec/dummy/app/views/layouts/application.html.erb",
|
53
|
+
"spec/dummy/app/views/posts/_form.html.erb",
|
54
|
+
"spec/dummy/app/views/posts/edit.html.erb",
|
55
|
+
"spec/dummy/app/views/posts/index.html.erb",
|
56
|
+
"spec/dummy/app/views/posts/new.html.erb",
|
57
|
+
"spec/dummy/app/views/posts/show.html.erb",
|
58
|
+
"spec/dummy/config.ru",
|
59
|
+
"spec/dummy/config/application.rb",
|
60
|
+
"spec/dummy/config/boot.rb",
|
61
|
+
"spec/dummy/config/database.yml",
|
62
|
+
"spec/dummy/config/environment.rb",
|
63
|
+
"spec/dummy/config/environments/development.rb",
|
64
|
+
"spec/dummy/config/environments/production.rb",
|
65
|
+
"spec/dummy/config/environments/test.rb",
|
66
|
+
"spec/dummy/config/initializers/backtrace_silencers.rb",
|
67
|
+
"spec/dummy/config/initializers/devise.rb",
|
68
|
+
"spec/dummy/config/initializers/inflections.rb",
|
69
|
+
"spec/dummy/config/initializers/mime_types.rb",
|
70
|
+
"spec/dummy/config/initializers/secret_token.rb",
|
71
|
+
"spec/dummy/config/initializers/session_store.rb",
|
72
|
+
"spec/dummy/config/locales/devise.en.yml",
|
73
|
+
"spec/dummy/config/locales/en.yml",
|
74
|
+
"spec/dummy/config/routes.rb",
|
75
|
+
"spec/dummy/db/migrate/20110630105039_create_posts.rb",
|
76
|
+
"spec/dummy/db/migrate/20110630111038_devise_create_users.rb",
|
77
|
+
"spec/dummy/db/schema.rb",
|
78
|
+
"spec/dummy/public/404.html",
|
79
|
+
"spec/dummy/public/422.html",
|
80
|
+
"spec/dummy/public/500.html",
|
81
|
+
"spec/dummy/public/favicon.ico",
|
82
|
+
"spec/dummy/public/javascripts/application.js",
|
83
|
+
"spec/dummy/public/javascripts/controls.js",
|
84
|
+
"spec/dummy/public/javascripts/dragdrop.js",
|
85
|
+
"spec/dummy/public/javascripts/effects.js",
|
86
|
+
"spec/dummy/public/javascripts/prototype.js",
|
87
|
+
"spec/dummy/public/javascripts/rails.js",
|
88
|
+
"spec/dummy/public/stylesheets/.gitkeep",
|
89
|
+
"spec/dummy/public/stylesheets/scaffold.css",
|
90
|
+
"spec/dummy/script/rails",
|
91
|
+
"spec/generators/google_authentication_generator_spec.rb",
|
92
|
+
"spec/generators/install_generator_spec.rb",
|
93
|
+
"spec/google_authentication_spec.rb",
|
94
|
+
"spec/integration/navigation_spec.rb",
|
95
|
+
"spec/models/acts_as_google_user_spec.rb",
|
96
|
+
"spec/spec_helper.rb"
|
97
|
+
]
|
98
|
+
s.homepage = %q{http://github.com/fabn/google_authentication}
|
99
|
+
s.licenses = ["MIT"]
|
100
|
+
s.require_paths = ["lib"]
|
101
|
+
s.rubygems_version = %q{1.6.2}
|
102
|
+
s.summary = %q{Authenticate users through Google in your app}
|
103
|
+
|
104
|
+
if s.respond_to? :specification_version then
|
105
|
+
s.specification_version = 3
|
106
|
+
|
107
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
108
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
109
|
+
s.add_runtime_dependency(%q<omniauth>, [">= 0"])
|
110
|
+
s.add_runtime_dependency(%q<devise>, [">= 1.2.0"])
|
111
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
112
|
+
s.add_development_dependency(%q<rspec-rails>, [">= 0"])
|
113
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
114
|
+
s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
|
115
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
116
|
+
s.add_development_dependency(%q<cucumber>, ["~> 0.10"])
|
117
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
118
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
119
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
120
|
+
s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
|
121
|
+
s.add_development_dependency(%q<growl>, [">= 0"])
|
122
|
+
else
|
123
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
124
|
+
s.add_dependency(%q<omniauth>, [">= 0"])
|
125
|
+
s.add_dependency(%q<devise>, [">= 1.2.0"])
|
126
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
127
|
+
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
128
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
129
|
+
s.add_dependency(%q<capybara>, [">= 0.4.0"])
|
130
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
131
|
+
s.add_dependency(%q<cucumber>, ["~> 0.10"])
|
132
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
133
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
134
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
135
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
136
|
+
s.add_dependency(%q<growl>, [">= 0"])
|
137
|
+
end
|
138
|
+
else
|
139
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
140
|
+
s.add_dependency(%q<omniauth>, [">= 0"])
|
141
|
+
s.add_dependency(%q<devise>, [">= 1.2.0"])
|
142
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
143
|
+
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
144
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
145
|
+
s.add_dependency(%q<capybara>, [">= 0.4.0"])
|
146
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
147
|
+
s.add_dependency(%q<cucumber>, ["~> 0.10"])
|
148
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
149
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
150
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
151
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
152
|
+
s.add_dependency(%q<growl>, [">= 0"])
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|