omniauth-scaffold 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/generators/omniauth/scaffold/scaffold_generator.rb +48 -23
- data/lib/generators/omniauth/scaffold/templates/app/views/layouts/application.html.erb +1 -1
- data/lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb +10 -13
- data/omniauth-scaffold.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
@@ -10,6 +10,7 @@ module Omniauth
|
|
10
10
|
|
11
11
|
def generate_scaffold
|
12
12
|
# Config
|
13
|
+
# initializers/local_setting.rb
|
13
14
|
if File.exist?('config/initializers/local_setting.rb')
|
14
15
|
content = "\n# Twitter\n"
|
15
16
|
content += "ENV['TWITTER_KEY'] = \"YOUR_CONSUMER_KEY\"\n"
|
@@ -21,47 +22,71 @@ module Omniauth
|
|
21
22
|
content += "#ENV['FACEBOOK_APP_ID'] = \"YOUR_APP_ID\"\n"
|
22
23
|
content += "#ENV['FACEBOOK_APP_SECRET'] = \"YOUR_APP_SECRET\"\n"
|
23
24
|
|
24
|
-
append_file "config/initializers/local_setting.rb", content.force_encoding('ASCII-8BIT')
|
25
|
+
append_file( "config/initializers/local_setting.rb", content.force_encoding('ASCII-8BIT') )
|
25
26
|
else
|
26
|
-
copy_file "config/initializers/local_setting.rb", "config/initializers/local_setting.rb"
|
27
|
+
copy_file( "config/initializers/local_setting.rb", "config/initializers/local_setting.rb" )
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
# initializers/constants.rb
|
31
|
+
if File.exist?( 'config/initializers/constants.rb' )
|
32
|
+
content = "\n# OmniAuth Provider\n"
|
33
|
+
content += "# Production環境\n"
|
34
|
+
content += "if Rails.env.production?\n"
|
35
|
+
content += " DEFAULT_PROVIDER = \"twitter\"\n"
|
36
|
+
content += " # DEFAULT_PROVIDER = \"facebook\"\n"
|
37
|
+
content += " # DEFAULT_PROVIDER = \"github\"\n"
|
38
|
+
content += "\n"
|
39
|
+
content += "# Production環境以外\n"
|
40
|
+
content += "else\n"
|
41
|
+
content += " # DEFAULT_PROVIDER = \"developer\"\n"
|
42
|
+
content += " DEFAULT_PROVIDER = \"twitter\"\n"
|
43
|
+
content += " # DEFAULT_PROVIDER = \"facebook\"\n"
|
44
|
+
content += " # DEFAULT_PROVIDER = \"github\"\n"
|
45
|
+
content += "end\n"
|
46
|
+
content += "\n"
|
47
|
+
content += "# アプリケーション名\n"
|
48
|
+
content += "APP_NAME = \"YOUR_APP_NAME\"\n"
|
49
|
+
|
50
|
+
append_file( "config/initializers/constants.rb", content.force_encoding('ASCII-8BIT') )
|
51
|
+
else
|
52
|
+
copy_file( "config/initializers/constants.rb", "config/initializers/constants.rb" )
|
53
|
+
end
|
54
|
+
|
55
|
+
copy_file( "config/initializers/omniauth.rb", "config/initializers/omniauth.rb" )
|
31
56
|
|
32
|
-
insert_into_file "config/routes.rb", " match \"/auth/:provider/callback\" => \"sessions#callback\"\n match \"/auth/failure\" => \"sessions#failure\"\n match \"/logout\" => \"sessions#destroy\", :as => :logout\n", after: "# first created -> highest priority.\n"
|
33
|
-
insert_into_file "config/routes.rb", " root to: 'top#index'\n", after: "# root :to => 'welcome#index'\n"
|
34
|
-
insert_into_file "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n"
|
35
|
-
insert_into_file "config/application.rb", " config.time_zone = 'Tokyo'\n config.active_record.default_timezone = :local\n", after: "# config.time_zone = 'Central Time (US & Canada)'\n"
|
36
|
-
insert_into_file "config/application.rb", " config.i18n.default_locale = :ja\n", after: "# config.i18n.default_locale = :de\n"
|
57
|
+
insert_into_file( "config/routes.rb", " match \"/auth/:provider/callback\" => \"sessions#callback\"\n match \"/auth/failure\" => \"sessions#failure\"\n match \"/logout\" => \"sessions#destroy\", :as => :logout\n", after: "# first created -> highest priority.\n" )
|
58
|
+
insert_into_file( "config/routes.rb", " root to: 'top#index'\n", after: "# root :to => 'welcome#index'\n" )
|
59
|
+
insert_into_file( "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n" )
|
60
|
+
insert_into_file( "config/application.rb", " config.time_zone = 'Tokyo'\n config.active_record.default_timezone = :local\n", after: "# config.time_zone = 'Central Time (US & Canada)'\n" )
|
61
|
+
insert_into_file( "config/application.rb", " config.i18n.default_locale = :ja\n", after: "# config.i18n.default_locale = :de\n" )
|
37
62
|
|
38
|
-
copy_file "config/locales/ja.yml", "config/locales/ja.yml"
|
63
|
+
copy_file( "config/locales/ja.yml", "config/locales/ja.yml" )
|
39
64
|
|
40
65
|
# DB
|
41
|
-
copy_file "db/migrate/create_users.rb", "db/migrate/20000101000000_create_users.rb"
|
66
|
+
copy_file( "db/migrate/create_users.rb", "db/migrate/20000101000000_create_users.rb" )
|
42
67
|
|
43
68
|
# App
|
44
|
-
copy_file "app/models/user.rb", "app/models/user.rb"
|
69
|
+
copy_file( "app/models/user.rb", "app/models/user.rb" )
|
45
70
|
|
46
|
-
copy_file "app/controllers/sessions_controller.rb", "app/controllers/sessions_controller.rb"
|
47
|
-
copy_file "app/controllers/application_controller.rb", "app/controllers/application_controller.rb"
|
48
|
-
copy_file "app/controllers/top_controller.rb", "app/controllers/top_controller.rb"
|
71
|
+
copy_file( "app/controllers/sessions_controller.rb", "app/controllers/sessions_controller.rb" )
|
72
|
+
copy_file( "app/controllers/application_controller.rb", "app/controllers/application_controller.rb" )
|
73
|
+
copy_file( "app/controllers/top_controller.rb", "app/controllers/top_controller.rb" )
|
49
74
|
|
50
|
-
copy_file "app/views/layouts/application.html.erb", "app/views/layouts/application.html.erb"
|
51
|
-
copy_file "app/views/top/index.html.erb", "app/views/top/index.html.erb"
|
75
|
+
copy_file( "app/views/layouts/application.html.erb", "app/views/layouts/application.html.erb" )
|
76
|
+
copy_file( "app/views/top/index.html.erb", "app/views/top/index.html.erb" )
|
52
77
|
|
53
|
-
copy_file "app/assets/stylesheets/base.css.scss", "app/assets/stylesheets/base.css.scss"
|
54
|
-
copy_file "app/assets/stylesheets/scaffolds.css.scss", "app/assets/stylesheets/scaffolds.css.scss"
|
78
|
+
copy_file( "app/assets/stylesheets/base.css.scss", "app/assets/stylesheets/base.css.scss" )
|
79
|
+
copy_file( "app/assets/stylesheets/scaffolds.css.scss", "app/assets/stylesheets/scaffolds.css.scss" )
|
55
80
|
|
56
81
|
# public
|
57
|
-
remove_file 'public/index.html'
|
82
|
+
remove_file( 'public/index.html' )
|
58
83
|
|
59
84
|
# README
|
60
|
-
remove_file 'README.rdoc'
|
61
|
-
copy_file "README.md", "README.md"
|
85
|
+
remove_file( 'README.rdoc' )
|
86
|
+
copy_file( "README.md", "README.md" )
|
62
87
|
|
63
88
|
# gitignore
|
64
|
-
insert_into_file ".gitignore", "\n# Add\n.DS_Store\n/config/initializers/local_setting.rb\n", after: "/tmp\n"
|
89
|
+
insert_into_file( ".gitignore", "\n# Add\n.DS_Store\n/config/initializers/local_setting.rb\n", after: "/tmp\n" )
|
65
90
|
end
|
66
91
|
end
|
67
92
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%# ログイン済み %>
|
14
14
|
<%= link_to_unless( current_user.screen_name.blank?, image_tag( current_user.image, size: "20x20" ), "https://twitter.com/#!/#{current_user.screen_name}", target: "_blank" ) %>
|
15
15
|
<%= current_user.name %> :
|
16
|
-
|| <%= link_to "Logout"
|
16
|
+
|| <%= link_to "Logout", logout_path %>
|
17
17
|
<% else %>
|
18
18
|
<%# 未ログイン %>
|
19
19
|
<%= link_to "Login", "/auth/#{DEFAULT_PROVIDER}" %>
|
@@ -1,22 +1,19 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
#
|
3
|
+
# OmniAuth Provider
|
4
|
+
# Production環境
|
4
5
|
if Rails.env.production?
|
5
|
-
#----------------#
|
6
|
-
# Production環境 #
|
7
|
-
#----------------#
|
8
6
|
DEFAULT_PROVIDER = "twitter"
|
9
|
-
#
|
10
|
-
#
|
7
|
+
# DEFAULT_PROVIDER = "facebook"
|
8
|
+
# DEFAULT_PROVIDER = "github"
|
9
|
+
|
10
|
+
# Production環境以外
|
11
11
|
else
|
12
|
-
|
13
|
-
# Production環境以外 #
|
14
|
-
#--------------------#
|
15
|
-
# DEFAULT_PROVIDER = "developer"
|
12
|
+
# DEFAULT_PROVIDER = "developer"
|
16
13
|
DEFAULT_PROVIDER = "twitter"
|
17
|
-
#
|
18
|
-
#
|
14
|
+
# DEFAULT_PROVIDER = "facebook"
|
15
|
+
# DEFAULT_PROVIDER = "github"
|
19
16
|
end
|
20
17
|
|
21
|
-
#
|
18
|
+
# アプリケーション名
|
22
19
|
APP_NAME = "YOUR_APP_NAME"
|
data/omniauth-scaffold.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "omniauth-scaffold"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Shun Matsumoto"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-24"
|
13
13
|
s.description = "Scaffold for OmniAuth."
|
14
14
|
s.email = "s.matsumoto0115@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
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.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-twitter
|
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
segments:
|
155
155
|
- 0
|
156
|
-
hash:
|
156
|
+
hash: -2153492965234191673
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
none: false
|
159
159
|
requirements:
|