omniauth_generator 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/inspectionProfiles/Project_Default.xml +12 -0
- data/.idea/inspectionProfiles/profiles_settings.xml +7 -0
- data/.idea/misc.xml +49 -0
- data/.idea/modules.xml +9 -0
- data/.idea/omniauth_generator.iml +11 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/lib/generators/omniauth_initializer/USAGE +10 -0
- data/lib/generators/omniauth_initializer/omniauth_initializer_generator.rb +33 -0
- data/lib/generators/omniauth_initializer/templates/api_keys.yml +21 -0
- data/lib/generators/omniauth_initializer/templates/sessions_controller.rb +16 -0
- data/lib/omniauth_generator.rb +5 -0
- data/lib/omniauth_generator/version.rb +3 -0
- data/omniauth_generator.gemspec +23 -0
- metadata +93 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
MGIzMDIzYTVjZjQ3MjEzMjNjZWQ5NTRiOWIzOGIxNzc1NTFjMjRhNA==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
N2ViNDlmYjkxZjFiZDdhMzNiNmQ0OThkNWQzNmQxZmMzNTBmNjQ2NA==
|
|
7
|
+
SHA512:
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
NWU1ZjU0ZDA3MzJjYTIwZjgyMTE2OWMzZmNmNjRhYWM5NDNiZjcxYmNkYjYz
|
|
10
|
+
OGJhMDI1MWJjZWQxY2I4NjE3MzY5NzNhMzU0YzAzZmZhYWI3YjQ1YWQ4NTU2
|
|
11
|
+
NjU1YWNkYzNjM2IwMjQ2YzFmMTcxNDk0YWE5MGM3MjUxZjk3MDY=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
ZmYzMDExZThlOWY0M2IwOTg3NTUzNjJiNzZmM2Q0YTdjNjY3YTQ1MTllY2M1
|
|
14
|
+
ODMwZTBhNWMxYmYzZmYyYWJhZTdiMDlmYjkzMTcwOTBmYjY5MTlkYWJiMzk1
|
|
15
|
+
ZTBkN2NmN2FjZTE2NWQ5N2IzNGM5Y2RiMjcxNTQxOWQwNzJjNjc=
|
data/.gitignore
ADDED
data/.idea/encodings.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0" is_locked="false">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<option name="myLocal" value="false" />
|
|
5
|
+
<inspection_tool class="LossyEncoding" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
6
|
+
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
|
7
|
+
<option name="processCode" value="true" />
|
|
8
|
+
<option name="processLiterals" value="true" />
|
|
9
|
+
<option name="processComments" value="true" />
|
|
10
|
+
</inspection_tool>
|
|
11
|
+
</profile>
|
|
12
|
+
</component>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectDictionaryState">
|
|
4
|
+
<dictionary name="renoliver" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
7
|
+
<entry key="Project Default">
|
|
8
|
+
<profile-state>
|
|
9
|
+
<expanded-state>
|
|
10
|
+
<State>
|
|
11
|
+
<id />
|
|
12
|
+
</State>
|
|
13
|
+
<State>
|
|
14
|
+
<id>Spelling</id>
|
|
15
|
+
</State>
|
|
16
|
+
</expanded-state>
|
|
17
|
+
<selected-state>
|
|
18
|
+
<State>
|
|
19
|
+
<id>Spelling</id>
|
|
20
|
+
</State>
|
|
21
|
+
</selected-state>
|
|
22
|
+
</profile-state>
|
|
23
|
+
</entry>
|
|
24
|
+
</component>
|
|
25
|
+
<component name="ProjectResources">
|
|
26
|
+
<default-html-doctype>$APPLICATION_HOME_DIR$/lib/rubymine.jar!/resources/html5-schema/html5.rnc</default-html-doctype>
|
|
27
|
+
</component>
|
|
28
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.8.7-p370" project-jdk-type="RUBY_SDK" />
|
|
29
|
+
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
|
|
30
|
+
<option name="USER" value="" />
|
|
31
|
+
<option name="PASSWORD" value="" />
|
|
32
|
+
<option name="mySSHConnectionTimeout" value="30000" />
|
|
33
|
+
<option name="mySSHReadTimeout" value="30000" />
|
|
34
|
+
<option name="LAST_MERGED_REVISION" />
|
|
35
|
+
<option name="MERGE_DRY_RUN" value="false" />
|
|
36
|
+
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
|
|
37
|
+
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
|
|
38
|
+
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
|
|
39
|
+
<option name="DETECT_NESTED_COPIES" value="true" />
|
|
40
|
+
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
|
|
41
|
+
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
|
|
42
|
+
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
|
|
43
|
+
<option name="FORCE_UPDATE" value="false" />
|
|
44
|
+
<option name="IGNORE_EXTERNALS" value="false" />
|
|
45
|
+
<configuration useDefault="false">$USER_HOME$/.subversion</configuration>
|
|
46
|
+
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
|
|
47
|
+
</component>
|
|
48
|
+
</project>
|
|
49
|
+
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/omniauth_generator.iml" filepath="$PROJECT_DIR$/.idea/omniauth_generator.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
9
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.1, RVM: ruby-1.8.7-p370) [gem]" level="application" />
|
|
8
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.1.1, RVM: ruby-1.8.7-p370) [gem]" level="application" />
|
|
9
|
+
</component>
|
|
10
|
+
</module>
|
|
11
|
+
|
data/.idea/vcs.xml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Rennan Oliveira
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# OmniauthGenerator
|
|
2
|
+
|
|
3
|
+
Simple Gem created because I kept repeating the same simple steps everytime I used omniauth
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Description:
|
|
8
|
+
Generates all files needed for basic omniauth 'login with facebook or twitter'
|
|
9
|
+
|
|
10
|
+
Example:
|
|
11
|
+
rails generate omniauth_initializer Session
|
|
12
|
+
|
|
13
|
+
This will create:
|
|
14
|
+
config/api_keys.yml <- Set your app keys here.
|
|
15
|
+
config/initializers/omniauth_initializer.rb <- choose the providers you will use
|
|
16
|
+
app/controllers/sessions_controller.rb <- sample controller
|
|
17
|
+
|
|
18
|
+
And add a route to your routes.rb file:
|
|
19
|
+
get '/auth/:provider/callback', :to => 'sessions#create'
|
|
20
|
+
|
|
21
|
+
## Contributing
|
|
22
|
+
|
|
23
|
+
1. Fork it ( http://github.com/rennanoliveira/omniauth_generator/fork )
|
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
25
|
+
3. ADD TESTS.
|
|
26
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
|
27
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
|
28
|
+
6. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Generates all files needed for basic omniauth 'login with facebook or twitter'
|
|
3
|
+
|
|
4
|
+
Example:
|
|
5
|
+
rails generate omniauth_initializer Session
|
|
6
|
+
|
|
7
|
+
This will create:
|
|
8
|
+
config/api_keys.yml
|
|
9
|
+
config/initializers/omniauth_initializer.rb
|
|
10
|
+
app/controllers/sessions_controller.rb
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/named_base'
|
|
3
|
+
|
|
4
|
+
class OmniauthInitializerGenerator < Rails::Generators::NamedBase
|
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def copy_api_keys_file
|
|
9
|
+
copy_file "api_keys.yml", "config/api_keys.yml"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create_omniauth_initializer_file
|
|
13
|
+
create_file "config/initializers/omniauth_initializer.rb", <<-FILE
|
|
14
|
+
API_KEYS = YAML::load_file("#{Rails.root}/config/api_keys.yml")[Rails.env]
|
|
15
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
|
16
|
+
# Uncomment the providers you wish to use and/or add other providers.
|
|
17
|
+
#provider :twitter, API_KEYS['twitter']['api_key'], API_KEYS['twitter']['api_secret']
|
|
18
|
+
#provider :facebook, API_KEYS['facebook']['api_key'], API_KEYS['facebook']['api_secret']
|
|
19
|
+
end
|
|
20
|
+
FILE
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def copy_sessions_controller_file
|
|
24
|
+
copy_file "sessions_controller.rb", "app/controllers/#{file_name.pluralize}_controller.rb"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def add_callback_route
|
|
28
|
+
line = "Application.routes.draw do"
|
|
29
|
+
gsub_file 'config/routes.rb', /(#{Regexp.escape(line)})/mi do |match|
|
|
30
|
+
"#{match}\n \n# Omniauth Callback will hit the action below\nget '/auth/:provider/callback', :to => '#{file_name.pluralize}#create'\n"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
defaults: &defaults
|
|
2
|
+
twitter:
|
|
3
|
+
api_key: "KEY"
|
|
4
|
+
api_secret: "SECRET"
|
|
5
|
+
facebook:
|
|
6
|
+
api_key: "KEY"
|
|
7
|
+
api_secret: "SECRET"
|
|
8
|
+
|
|
9
|
+
development:
|
|
10
|
+
<<: *defaults
|
|
11
|
+
|
|
12
|
+
test:
|
|
13
|
+
<<: *defaults
|
|
14
|
+
|
|
15
|
+
production:
|
|
16
|
+
twitter:
|
|
17
|
+
api_key: "KEY2"
|
|
18
|
+
api_secret: "SECRET2"
|
|
19
|
+
facebook:
|
|
20
|
+
api_key: "KEY2"
|
|
21
|
+
api_secret: "SECRET2"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class SessionsController < ApplicationController
|
|
2
|
+
#The callback from logging in with facebook or twitter will hit this action.
|
|
3
|
+
#All logic for what you will do with the omniauth response hash goes here.
|
|
4
|
+
def create
|
|
5
|
+
#@user = User.find_or_create_from_auth_hash(auth_hash)
|
|
6
|
+
#self.current_user = @user
|
|
7
|
+
#redirect_to '/'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
protected
|
|
11
|
+
|
|
12
|
+
#This auth_hash contains the response from the requested provider (facebook, twitter, etc)
|
|
13
|
+
def auth_hash
|
|
14
|
+
request.env['omniauth.auth']
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'omniauth_generator/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "omniauth_generator"
|
|
8
|
+
spec.version = OmniauthGenerator::VERSION
|
|
9
|
+
spec.authors = ["Rennan Oliveira"]
|
|
10
|
+
spec.email = ["renmcoliver@gmail.com"]
|
|
11
|
+
spec.summary = %q{Generates basic omniauth config}
|
|
12
|
+
spec.description = %q{Generates yml file, inittializer, routes and a controller for basic omniauth authentication}
|
|
13
|
+
spec.homepage = "https://github.com/rennanoliveira/omniauth_generator"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: omniauth_generator
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rennan Oliveira
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.5'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.5'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ! '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: Generates yml file, inittializer, routes and a controller for basic omniauth
|
|
42
|
+
authentication
|
|
43
|
+
email:
|
|
44
|
+
- renmcoliver@gmail.com
|
|
45
|
+
executables: []
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- .gitignore
|
|
50
|
+
- .idea/encodings.xml
|
|
51
|
+
- .idea/inspectionProfiles/Project_Default.xml
|
|
52
|
+
- .idea/inspectionProfiles/profiles_settings.xml
|
|
53
|
+
- .idea/misc.xml
|
|
54
|
+
- .idea/modules.xml
|
|
55
|
+
- .idea/omniauth_generator.iml
|
|
56
|
+
- .idea/scopes/scope_settings.xml
|
|
57
|
+
- .idea/vcs.xml
|
|
58
|
+
- Gemfile
|
|
59
|
+
- LICENSE.txt
|
|
60
|
+
- README.md
|
|
61
|
+
- Rakefile
|
|
62
|
+
- lib/generators/omniauth_initializer/USAGE
|
|
63
|
+
- lib/generators/omniauth_initializer/omniauth_initializer_generator.rb
|
|
64
|
+
- lib/generators/omniauth_initializer/templates/api_keys.yml
|
|
65
|
+
- lib/generators/omniauth_initializer/templates/sessions_controller.rb
|
|
66
|
+
- lib/omniauth_generator.rb
|
|
67
|
+
- lib/omniauth_generator/version.rb
|
|
68
|
+
- omniauth_generator.gemspec
|
|
69
|
+
homepage: https://github.com/rennanoliveira/omniauth_generator
|
|
70
|
+
licenses:
|
|
71
|
+
- MIT
|
|
72
|
+
metadata: {}
|
|
73
|
+
post_install_message:
|
|
74
|
+
rdoc_options: []
|
|
75
|
+
require_paths:
|
|
76
|
+
- lib
|
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ! '>='
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ! '>='
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
requirements: []
|
|
88
|
+
rubyforge_project:
|
|
89
|
+
rubygems_version: 2.2.1
|
|
90
|
+
signing_key:
|
|
91
|
+
specification_version: 4
|
|
92
|
+
summary: Generates basic omniauth config
|
|
93
|
+
test_files: []
|