omniauth-scaffold 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +16 -3
  4. data/{LICENSE → LICENSE.txt} +2 -4
  5. data/README.rdoc +19 -0
  6. data/Rakefile +49 -2
  7. data/VERSION +1 -0
  8. data/lib/generators/omniauth/scaffold/scaffold_generator.rb +33 -0
  9. data/lib/generators/omniauth/scaffold/templates/README.rdoc +83 -0
  10. data/lib/generators/omniauth/scaffold/templates/app/controllers/application_controller.rb +28 -0
  11. data/lib/{omniauth-scaffold/templates → generators/omniauth/scaffold/templates/app/controllers}/sessions_controller.rb +0 -0
  12. data/lib/{omniauth-scaffold/templates → generators/omniauth/scaffold/templates/app/controllers}/top_controller.rb +0 -0
  13. data/lib/{omniauth-scaffold/templates → generators/omniauth/scaffold/templates/app/models}/user.rb +1 -6
  14. data/lib/generators/omniauth/scaffold/templates/app/views/layouts/application.html.erb +29 -0
  15. data/lib/generators/omniauth/scaffold/templates/app/views/top/index.html.erb +2 -0
  16. data/lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb +22 -0
  17. data/lib/generators/omniauth/scaffold/templates/config/initializers/local_setting.rb +2 -0
  18. data/lib/generators/omniauth/scaffold/templates/config/initializers/omniauth.rb +4 -0
  19. data/lib/{omniauth-scaffold/templates → generators/omniauth/scaffold/templates/db/migrate}/create_users.rb +2 -2
  20. data/omniauth-scaffold.gemspec +72 -13
  21. data/spec/omniauth-scaffold_spec.rb +7 -0
  22. data/spec/spec_helper.rb +12 -0
  23. metadata +130 -33
  24. data/.gitignore +0 -17
  25. data/README.md +0 -144
  26. data/lib/omniauth-scaffold/templates/README.md +0 -80
  27. data/lib/omniauth-scaffold/templates/application.html.erb +0 -37
  28. data/lib/omniauth-scaffold/templates/application_controller.rb +0 -60
  29. data/lib/omniauth-scaffold/templates/base.css.scss +0 -16
  30. data/lib/omniauth-scaffold/templates/index.html.erb +0 -2
  31. data/lib/omniauth-scaffold/templates/ja.yml +0 -198
  32. data/lib/omniauth-scaffold/templates/omniauth.rb +0 -10
  33. data/lib/omniauth-scaffold/templates/rails_config/development.yml +0 -0
  34. data/lib/omniauth-scaffold/templates/rails_config/production.yml +0 -11
  35. data/lib/omniauth-scaffold/templates/rails_config/rails_config.rb +0 -3
  36. data/lib/omniauth-scaffold/templates/rails_config/settings.local.yml +0 -3
  37. data/lib/omniauth-scaffold/templates/rails_config/settings.yml +0 -11
  38. data/lib/omniauth-scaffold/templates/rails_config/test.yml +0 -0
  39. data/lib/omniauth-scaffold/templates/scaffolds.css.scss +0 -70
  40. data/lib/omniauth-scaffold/version.rb +0 -5
  41. data/lib/omniauth-scaffold.rb +0 -92
metadata CHANGED
@@ -1,51 +1,145 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - shu0115
8
+ - Shun Matsumoto
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-04 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Scaffold for OmniAuth.
15
- email:
16
- - raisondetre0115@gmail.com
12
+ date: 2012-04-26 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-github
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-facebook
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'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.8.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.8.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: rdoc
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '3.12'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '3.12'
94
+ - !ruby/object:Gem::Dependency
95
+ name: jeweler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 1.8.3
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.8.3
110
+ description: Scaffold to use OmniAuth.
111
+ email: s.matsumoto0115@gmail.com
17
112
  executables: []
18
113
  extensions: []
19
- extra_rdoc_files: []
114
+ extra_rdoc_files:
115
+ - LICENSE.txt
116
+ - README.rdoc
20
117
  files:
21
- - .gitignore
118
+ - .document
119
+ - .rspec
22
120
  - Gemfile
23
- - LICENSE
24
- - README.md
121
+ - LICENSE.txt
122
+ - README.rdoc
25
123
  - Rakefile
26
- - lib/omniauth-scaffold.rb
27
- - lib/omniauth-scaffold/templates/README.md
28
- - lib/omniauth-scaffold/templates/application.html.erb
29
- - lib/omniauth-scaffold/templates/application_controller.rb
30
- - lib/omniauth-scaffold/templates/base.css.scss
31
- - lib/omniauth-scaffold/templates/create_users.rb
32
- - lib/omniauth-scaffold/templates/index.html.erb
33
- - lib/omniauth-scaffold/templates/ja.yml
34
- - lib/omniauth-scaffold/templates/omniauth.rb
35
- - lib/omniauth-scaffold/templates/rails_config/development.yml
36
- - lib/omniauth-scaffold/templates/rails_config/production.yml
37
- - lib/omniauth-scaffold/templates/rails_config/rails_config.rb
38
- - lib/omniauth-scaffold/templates/rails_config/settings.local.yml
39
- - lib/omniauth-scaffold/templates/rails_config/settings.yml
40
- - lib/omniauth-scaffold/templates/rails_config/test.yml
41
- - lib/omniauth-scaffold/templates/scaffolds.css.scss
42
- - lib/omniauth-scaffold/templates/sessions_controller.rb
43
- - lib/omniauth-scaffold/templates/top_controller.rb
44
- - lib/omniauth-scaffold/templates/user.rb
45
- - lib/omniauth-scaffold/version.rb
124
+ - VERSION
125
+ - lib/generators/omniauth/scaffold/scaffold_generator.rb
126
+ - lib/generators/omniauth/scaffold/templates/README.rdoc
127
+ - lib/generators/omniauth/scaffold/templates/app/controllers/application_controller.rb
128
+ - lib/generators/omniauth/scaffold/templates/app/controllers/sessions_controller.rb
129
+ - lib/generators/omniauth/scaffold/templates/app/controllers/top_controller.rb
130
+ - lib/generators/omniauth/scaffold/templates/app/models/user.rb
131
+ - lib/generators/omniauth/scaffold/templates/app/views/layouts/application.html.erb
132
+ - lib/generators/omniauth/scaffold/templates/app/views/top/index.html.erb
133
+ - lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb
134
+ - lib/generators/omniauth/scaffold/templates/config/initializers/local_setting.rb
135
+ - lib/generators/omniauth/scaffold/templates/config/initializers/omniauth.rb
136
+ - lib/generators/omniauth/scaffold/templates/db/migrate/create_users.rb
46
137
  - omniauth-scaffold.gemspec
47
- homepage: https://github.com/shu0115/omniauth-scaffold
48
- licenses: []
138
+ - spec/omniauth-scaffold_spec.rb
139
+ - spec/spec_helper.rb
140
+ homepage: http://github.com/shu0115/omniauth-scaffold
141
+ licenses:
142
+ - MIT
49
143
  post_install_message:
50
144
  rdoc_options: []
51
145
  require_paths:
@@ -56,6 +150,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
150
  - - ! '>='
57
151
  - !ruby/object:Gem::Version
58
152
  version: '0'
153
+ segments:
154
+ - 0
155
+ hash: -1303705991692644196
59
156
  required_rubygems_version: !ruby/object:Gem::Requirement
60
157
  none: false
61
158
  requirements:
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/README.md DELETED
@@ -1,144 +0,0 @@
1
- # Omniauth::Scaffold
2
-
3
- Scaffold for OmniAuth.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- vi Gemfile
11
- ----------
12
- # For OmniAuth
13
- gem 'rails_config'
14
- gem 'omniauth-scaffold', :group => :development
15
- gem 'omniauth-twitter'
16
- #gem 'omniauth-github'
17
- #gem 'omniauth-facebook'
18
- ----------
19
- ```
20
-
21
- And then execute:
22
-
23
- ```
24
- bundle install --without production
25
- ```
26
-
27
- Or install it yourself as:
28
-
29
- ```
30
- gem install rails_config
31
- gem install omniauth-scaffold
32
- gem install omniauth-twitter
33
- ```
34
-
35
- ## Usage
36
-
37
- ### Generate omniauth scaffold
38
-
39
- ```
40
- rails g omniauth:scaffold
41
- ----------
42
- create config/initializers/rails_config.rb
43
- create config/settings.yml
44
- create config/settings.local.yml
45
- create config/settings/development.yml
46
- create config/settings/production.yml
47
- create config/settings/test.yml
48
- create config/initializers/omniauth.rb
49
- insert config/routes.rb
50
- insert config/routes.rb
51
- insert config/routes.rb
52
- insert config/application.rb
53
- insert config/application.rb
54
- insert config/application.rb
55
- gsub config/environments/development.rb
56
- insert config/environments/development.rb
57
- create config/locales/ja.yml
58
- create db/migrate/20000101000000_create_users.rb
59
- create app/models/user.rb
60
- create app/controllers/application_controller.rb
61
- create app/controllers/sessions_controller.rb
62
- create app/controllers/top_controller.rb
63
- create app/views/layouts/application.html.erb
64
- create app/views/top/index.html.erb
65
- create app/assets/stylesheets/base.css.scss
66
- create app/assets/stylesheets/scaffolds.css.scss
67
- remove public/index.html
68
- remove README.rdoc
69
- create README.md
70
- append .gitignore
71
- ----------
72
- ```
73
-
74
- Edit: config/settings.yml
75
-
76
- ```ruby
77
- # アプリケーション名
78
- app_name: "YOUR_APP_NAME"
79
- ```
80
-
81
- ### Keys
82
-
83
- <a href="https://dev.twitter.com/apps/new" target="_blank">Twitter</a>
84
- <a href="https://github.com/settings/applications/new" target="_blank">GitHub</a>
85
- <a href="https://developers.facebook.com/apps" target="_blank">Facebook</a>
86
-
87
- ### Development Setting
88
-
89
- Edit: config/settings.local.yml
90
-
91
- ```ruby
92
- # Twitter OAuth Local Setting
93
- twitter_key: "TWITTER_KEY"
94
- twitter_secret: "TWITTER_SECRET"
95
- ```
96
-
97
- ### Production Setting For Heroku
98
-
99
- Twitter
100
-
101
- ```
102
- heroku config:add TWITTER_KEY=YOUR_CONSUMER_KEY
103
- heroku config:add TWITTER_SECRET=YOUR_CONSUMER_SECRET
104
- ```
105
-
106
- GitHub
107
-
108
- ```
109
- heroku config:add GITHUB_CLIENT_ID=YOUR_CLIENT_ID
110
- heroku config:add GITHUB_SECRET=YOUR_SECRET
111
- ```
112
-
113
- Facebook
114
-
115
- ```
116
- heroku config:add FACEBOOK_APP_ID=YOUR_APP_ID
117
- heroku config:add FACEBOOK_APP_SECRET=YOUR_APP_SECRET
118
- ```
119
-
120
- ### Heroku Timezone Setting
121
-
122
- ```
123
- heroku config:add TZ=Asia/Tokyo
124
- ```
125
-
126
- ### Migration
127
-
128
- ```
129
- rake db:migrate
130
- ```
131
-
132
- ### Start Server
133
-
134
- ```
135
- rails s
136
- ```
137
-
138
- ## Contributing
139
-
140
- 1. Fork it
141
- 2. Create your feature branch (`git checkout -b my-new-feature`)
142
- 3. Commit your changes (`git commit -am 'Added some feature'`)
143
- 4. Push to the branch (`git push origin my-new-feature`)
144
- 5. Create new Pull Request
@@ -1,80 +0,0 @@
1
- # APP_NAME
2
-
3
- APP_DESCRIPTION.
4
-
5
- ## Local Setting
6
-
7
- ### GitHub上でFork
8
-
9
- ```
10
- https://github.com/USER_NAME/APP_NAME/
11
- ```
12
-
13
- ### リポジトリをローカルへ作成
14
-
15
- ```
16
- cd ~/WORK_DIRECTORY
17
- git clone git@github.com:YOUR_USER_NAME/APP_NAME.git
18
- cd APP_NAME
19
- ```
20
-
21
- ### ブランチ作成
22
-
23
- ```
24
- git checkout -b YOUR_NEW_BRANCH
25
- ```
26
-
27
- ### Twitterアプリ登録
28
-
29
- <a href="https://dev.twitter.com/apps/new" target="_blank">Twitter Create an application</a>
30
-
31
- ```
32
- Name: [ (アプリケーションの名前) ]
33
- Description: [ (アプリケーションの説明) ]
34
- WebSite: [ http://0.0.0.0:3000/ ]
35
- Callback URL: [ http://0.0.0.0:3000/ ] ※登録しないと動かない
36
- □ Yes, I agree <= チェック
37
- CAPTCHA入力後「Create your Twitter application」を押下
38
- ```
39
-
40
- ### ローカル用Twitterキー設定
41
-
42
- Create: config/settings.local.yml
43
-
44
- ```ruby
45
- # Twitter OAuth Local Setting
46
- twitter_key: "YOUR_CONSUMER_KEY"
47
- twitter_secret: "YOUR_CONSUMER_SECRET"
48
- ```
49
-
50
- ※Twitterアプリ登録完了後に表示された「Consumer key」を「YOUR_CONSUMER_KEY」に、「Consumer secret」を「YOUR_CONSUMER_SECRET」にそれぞれ入力
51
-
52
- ### Rails起動
53
-
54
- Gemインストール
55
-
56
- ```
57
- bundle install --without production
58
- ```
59
-
60
- ローカルDB作成
61
-
62
- ```
63
- rake db:migrate
64
- ```
65
-
66
- ローカルサーバ起動
67
-
68
- ```
69
- bundle exec rails s
70
- ```
71
-
72
- ページアクセス
73
-
74
- ```
75
- http://0.0.0.0:3000/
76
- ```
77
-
78
- ## Copyright
79
-
80
- Copyright (c) 2012 MY_NAME. <a href="http://creativecommons.org/licenses/by-nc-sa/2.1/jp/" target="_blank">CC BY-NC-SA 2.1</a>
@@ -1,37 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title><%= Settings.app_name %></title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <% if current_user %>
12
- <%# ログイン済み %>
13
- <%= link_to_unless( current_user.screen_name.blank?, image_tag( current_user.image, size: "20x20" ), "https://twitter.com/#!/#{current_user.screen_name}", target: "_blank" ) %>
14
- <%= current_user.screen_name %> :
15
- || <%= link_to "Logout", logout_path %>
16
- <% else %>
17
- <%# 未ログイン %>
18
- <%= link_to "Login", "/auth/#{Settings.provider}" %>
19
- <% end %>
20
-
21
- <%# 通知/エラーメッセージ %>
22
- <%= simple_format( flash[:notice], style: "color: green;" ) unless flash[:notice].blank? %>
23
- <%= simple_format( flash[:alert], style: "color: red;" ) unless flash[:alert].blank? %>
24
-
25
- <%= yield %>
26
-
27
- <br />
28
- <br />
29
-
30
- <center>
31
- Developed by <a href="https://twitter.com/#!/<%= Settings.programmer_twitter_id %>/" target="_blank">@<%= Settings.programmer_twitter_id %></a>,
32
- Designed by <a href="https://twitter.com/#!/<%= Settings.designer_twitter_id %>/" target="_blank">@<%= Settings.designer_twitter_id %></a>,
33
- Licence by <a href="https://creativecommons.org/licenses/by-nc-sa/2.1/jp/" target="_blank">CC BY-NC-SA 2.1</a>
34
- </center>
35
-
36
- </body>
37
- </html>
@@ -1,60 +0,0 @@
1
- # coding: utf-8
2
- class ApplicationController < ActionController::Base
3
-
4
- protect_from_forgery
5
-
6
- # httpsリダイレクト
7
- before_filter :ssl_redirect if Rails.env.production?
8
-
9
- # 未ログインリダイレクト
10
- before_filter :authorize
11
-
12
- # セッション有効期限延長
13
- before_filter :reset_session_expires
14
-
15
- private
16
-
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
- #-----------#
30
- # authorize #
31
- #-----------#
32
- # ログイン認証
33
- def authorize
34
- # セッション/トップコントローラ以外で
35
- if params[:controller] != "sessions" and params[:controller] != "top"
36
- # 未ログインであればルートヘリダイレクト
37
- if session[:user_id].blank?
38
- redirect_to :root and return
39
- end
40
- end
41
- end
42
-
43
- #-----------------------#
44
- # reset_session_expires #
45
- #-----------------------#
46
- # セッション期限延長
47
- def reset_session_expires
48
- request.session_options[:expire_after] = 2.weeks
49
- end
50
-
51
- #--------------#
52
- # current_user #
53
- #--------------#
54
- def current_user
55
- @current_user ||= User.where( id: session[:user_id] ).first
56
- end
57
-
58
- helper_method :current_user
59
-
60
- end
@@ -1,16 +0,0 @@
1
- /* テーブル */
2
- table, tr, th, td {
3
- border: 1px solid #aaa;
4
- padding: 5px;
5
- border-collapse: collapse;
6
- border-spacing: 0px;
7
- }
8
-
9
- .search table, .search tr, .search td {
10
- border: 0px solid #aaa;
11
- padding: 0px;
12
- }
13
-
14
- th {
15
- white-space: nowrap;
16
- }
@@ -1,2 +0,0 @@
1
-
2
- <h1>Welcome to <%= Settings.app_name %>.</h1>