domp 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 731b83429338d7d90464a431ac652f52f97b559f
4
- data.tar.gz: 918b89b16ad0c94eb8323d6e981099d59ca4c947
3
+ metadata.gz: 9e0cc4c0b72f28d1c2077b228266add9aef14fc1
4
+ data.tar.gz: d7df9bc7823e0536036182fe4b41ee5304177311
5
5
  SHA512:
6
- metadata.gz: f365e90d335925009bac201ef8cbbb8d81984c32a4a4d8e23f37e55270e721d129922cfcd56788dc4d9c7e68784145eeace4fe6b3ddee0490a031602501f9435
7
- data.tar.gz: 4627f95a516d93a265d7a0a6a1ca05c6a08f213d9bcc27527a6591f0da6dc119ac5ad5876e063945de074c08fcbfe473b0fe771f9b6b3d8f94eb655f118d8c3f
6
+ metadata.gz: 1cfe4bf21b99ac110ecf565aede34d11d5157651a66dec5a0a56b34c87504740383d58c2f1d600a574f02516593da2f8b42f38069bee343405e328ce280ea03b
7
+ data.tar.gz: d554b797d8a39e0bdc8beefcf4a0596512e4dfcfd58d897b06be054cd417fa9e82c20ff7dd718a477925fe8577bbc6f576ffb75ef368c313c573f5da9780754d
data/README.md CHANGED
@@ -49,7 +49,7 @@ Here's what the `User` model will look like:
49
49
 
50
50
  ```ruby
51
51
  class User < ActiveRecord::Base
52
- has_many :authentications, class_name: 'UserAuthentication'
52
+ has_many :authentications, class_name: 'UserAuthentication', dependent: :destroy
53
53
 
54
54
  devise :omniauthable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
55
55
 
@@ -86,6 +86,10 @@ gem "omniauth"
86
86
  gem "omniauth-facebook"
87
87
  gem "omniauth-twitter"
88
88
  ```
89
+
90
+ ## License
91
+ This gem is released under the MIT License.
92
+
89
93
  ## Contributing
90
94
 
91
95
  1. Fork it
@@ -4,16 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'domp/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "domp"
8
- gem.version = Domp::VERSION
9
- gem.authors = ["Alexander Zaytsev"]
10
- gem.email = ["alexander@say26.com"]
11
- gem.description = %q{Devise Omniauth Multiple Providers}
12
- gem.summary = %q{Generator to bootstrap usage of multiple providers with Devise and Omniauth}
13
- gem.homepage = "https://github.com/AlexanderZaytsev/domp"
7
+ gem.name = "domp"
8
+ gem.version = Domp::VERSION
9
+ gem.license = 'MIT'
10
+ gem.authors = ["Alexander Zaytsev"]
11
+ gem.email = ["alexander@say26.com"]
12
+ gem.description = %q{Devise Omniauth Multiple Providers}
13
+ gem.summary = %q{Generator to bootstrap usage of multiple providers with Devise and Omniauth}
14
+ gem.homepage = "https://github.com/AlexanderZaytsev/domp"
14
15
 
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ["lib"]
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module Domp
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -23,7 +23,7 @@ class DompGenerator < Rails::Generators::NamedBase
23
23
  providers.each do |provider|
24
24
  id = ask("#{provider.capitalize} application ID:")
25
25
  secret = ask("#{provider.capitalize} application secret:")
26
- omniauth_config << "\n config.omniauth :#{provider}, '#{id}', '#{secret}'\n"
26
+ omniauth_config << "\n config.omniauth :#{provider.underscore}, '#{id}', '#{secret}'\n"
27
27
  end
28
28
 
29
29
  inject_into_file 'config/initializers/devise.rb', after: "# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'" do
@@ -33,7 +33,7 @@ class DompGenerator < Rails::Generators::NamedBase
33
33
 
34
34
  def update_model_class
35
35
  inject_into_class "app/models/#{file_name}.rb", class_name do
36
- " has_many :authentications, class_name: '#{class_name}Authentication'\n"
36
+ " has_many :authentications, class_name: '#{class_name}Authentication', dependent: :destroy\n"
37
37
  end
38
38
 
39
39
  inject_into_class "app/models/#{file_name}.rb", class_name do
@@ -10,12 +10,14 @@ class <%= class_name %>Authentication < ActiveRecord::Base
10
10
 
11
11
  <% end -%>
12
12
  def self.create_from_omniauth(params, <%= class_name.downcase %>, provider)
13
+ token_expires_at = params['credentials']['expires_at'] ? Time.at(params['credentials']['expires_at']).to_datetime : nil
14
+
13
15
  create(
14
16
  <%= class_name.downcase %>: <%= class_name.downcase %>,
15
17
  authentication_provider: provider,
16
18
  uid: params['uid'],
17
19
  token: params['credentials']['token'],
18
- token_expires_at: Time.at(params['credentials']['expires_at']).to_datetime,
20
+ token_expires_at: token_expires_at,
19
21
  params: params,
20
22
  )
21
23
  end
@@ -2,7 +2,7 @@
2
2
  class <%= class_name.pluralize %>::OmniauthCallbacksController < Devise::OmniauthCallbacksController
3
3
 
4
4
  <% providers.each do |provider| -%>
5
- def <%= provider %>
5
+ def <%= provider.underscore %>
6
6
  create
7
7
  end
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Zaytsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-23 00:00:00.000000000 Z
11
+ date: 2013-12-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Devise Omniauth Multiple Providers
14
14
  email:
@@ -33,7 +33,8 @@ files:
33
33
  - lib/generators/domp/templates/model_authentications_migration.rb
34
34
  - lib/generators/domp/templates/omniauth_callbacks_controller.rb
35
35
  homepage: https://github.com/AlexanderZaytsev/domp
36
- licenses: []
36
+ licenses:
37
+ - MIT
37
38
  metadata: {}
38
39
  post_install_message:
39
40
  rdoc_options: []