omniauth-scaffold 0.1.15 → 0.1.16

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.
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ # gem 'omniauth-twitter'
4
+ # gem 'omniauth-facebook'
5
+ # gem 'omniauth-github'
6
+ # gem 'rails_config'
7
+
3
8
  # Specify your gem's dependencies in omniauth-scaffold.gemspec
4
9
  gemspec
@@ -3,9 +3,6 @@ class ApplicationController < ActionController::Base
3
3
 
4
4
  protect_from_forgery
5
5
 
6
- # httpsリダイレクト
7
- before_filter :ssl_redirect if Rails.env.production?
8
-
9
6
  # ログイン認証
10
7
  before_filter :authorize
11
8
 
@@ -14,18 +11,6 @@ class ApplicationController < ActionController::Base
14
11
 
15
12
  private
16
13
 
17
- #--------------#
18
- # ssl_redirect #
19
- #--------------#
20
- # httpsへリダイレクト(Production環境のみ)
21
- def ssl_redirect
22
- unless request.env["HTTP_X_FORWARDED_PROTO"].to_s == "https"
23
- request.env["HTTP_X_FORWARDED_PROTO"] = "https"
24
-
25
- redirect_to request.url and return
26
- end
27
- end
28
-
29
14
  #-----------#
30
15
  # authorize #
31
16
  #-----------#
@@ -4,7 +4,7 @@ class CreateUsers < ActiveRecord::Migration
4
4
  t.string :provider
5
5
  t.string :uid
6
6
  t.string :name
7
- t.string :screen_name
7
+ t.string :nickname
8
8
  t.string :image
9
9
  t.string :token
10
10
  t.string :secret
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
  class User < ActiveRecord::Base
3
- attr_accessible :provider, :uid, :name, :screen_name, :image, :token, :secret
3
+ attr_accessible :provider, :uid, :name, :nickname, :image, :token, :secret
4
4
 
5
5
  private
6
6
 
@@ -10,16 +10,16 @@ class User < ActiveRecord::Base
10
10
  def self.create_with_omniauth( auth )
11
11
  user = User.new
12
12
  user[:provider] = auth["provider"]
13
- user[:uid] = auth["uid"]
13
+ user[:uid] = auth["uid"]
14
14
 
15
15
  unless auth["info"].blank?
16
- user[:name] = auth["info"]["name"]
17
- user[:screen_name] = auth["info"]["nickname"]
18
- user[:image] = auth["info"]["image"]
16
+ user[:name] = auth["info"]["name"]
17
+ user[:nickname] = auth["info"]["nickname"]
18
+ user[:image] = auth["info"]["image"]
19
19
  end
20
20
 
21
21
  unless auth["credentials"].blank?
22
- user.token = auth['credentials']['token']
22
+ user.token = auth['credentials']['token']
23
23
  user.secret = auth['credentials']['secret']
24
24
  end
25
25
 
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Scaffold
3
- VERSION = "0.1.15"
3
+ VERSION = "0.1.16"
4
4
  end
5
5
  end
@@ -1,6 +1,10 @@
1
1
  # coding: utf-8
2
2
  require "omniauth-scaffold/version"
3
3
  require 'rails/generators'
4
+ # require 'omniauth-twitter'
5
+ # require 'omniauth-facebook'
6
+ # require 'omniauth-github'
7
+ # require 'rails_config'
4
8
 
5
9
  module Omniauth
6
10
  module Generators
@@ -32,7 +36,7 @@ module Omniauth
32
36
  content += " match \"/logout\" => \"sessions#destroy\", :as => :logout\n"
33
37
  insert_into_file( "config/routes.rb", content.force_encoding('ASCII-8BIT'), after: "# first created -> highest priority.\n" )
34
38
  insert_into_file( "config/routes.rb", " root to: 'top#index'\n", after: "# root :to => 'welcome#index'\n" )
35
- insert_into_file( "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n" )
39
+ # insert_into_file( "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n" )
36
40
 
37
41
  # ----- application.rb ----- #
38
42
  content = " config.time_zone = 'Tokyo'\n"
@@ -43,12 +47,15 @@ module Omniauth
43
47
  content += " config.assets.initialize_on_precompile = false\n"
44
48
  insert_into_file( "config/application.rb", content.force_encoding('ASCII-8BIT'), after: "config.assets.version = '1.0'\n" )
45
49
 
50
+ # ----- production.rb ----- #
51
+ insert_into_file( "config/environments/production.rb", " config.force_ssl = true\n", after: "# config.force_ssl = true\n" ) # 強制SSL設定
52
+
46
53
  # ----- development.rb ----- #
47
54
  content = "\n # For LogRotate\n"
48
55
  content += " config.logger = Logger.new( 'log/development.log', 5, 1*1024*1024 ) # 1MB * 5\n"
49
56
  insert_into_file( "config/environments/development.rb", content.force_encoding('ASCII-8BIT'), after: "config.assets.debug = true\n" )
50
- gsub_file "config/environments/development.rb", /(config.assets.debug = true)+/, "# config.assets.debug = true"
51
- insert_into_file( "config/environments/development.rb", " config.assets.debug = false\n", after: "config.assets.debug = true\n" )
57
+ gsub_file "config/environments/development.rb", /(config.assets.debug = true)+/, "# config.assets.debug = true" # コメントアウト追加
58
+ insert_into_file( "config/environments/development.rb", " config.assets.debug = false\n", after: "config.assets.debug = true\n" ) # false設定追加
52
59
 
53
60
  # ----- ja.yml ----- #
54
61
  copy_file( "templates/ja.yml", "config/locales/ja.yml" )
@@ -1,5 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require File.expand_path('../lib/omniauth-scaffold/version', __FILE__)
3
+ require 'omniauth-twitter'
4
+ require 'omniauth-facebook'
5
+ require 'omniauth-github'
3
6
 
4
7
  Gem::Specification.new do |gem|
5
8
  gem.authors = ["shu0115"]
@@ -14,4 +17,8 @@ Gem::Specification.new do |gem|
14
17
  gem.name = "omniauth-scaffold"
15
18
  gem.require_paths = ["lib"]
16
19
  gem.version = Omniauth::Scaffold::VERSION
20
+
21
+ gem.add_dependency 'omniauth-twitter'
22
+ gem.add_dependency 'omniauth-facebook'
23
+ gem.add_dependency 'omniauth-github'
17
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,56 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-27 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-10-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-twitter
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-facebook
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: omniauth-github
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
14
62
  description: Scaffold for OmniAuth.
15
63
  email:
16
64
  - raisondetre0115@gmail.com
@@ -65,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
113
  version: '0'
66
114
  requirements: []
67
115
  rubyforge_project:
68
- rubygems_version: 1.8.23
116
+ rubygems_version: 1.8.24
69
117
  signing_key:
70
118
  specification_version: 3
71
119
  summary: OmniAuth Scaffold