omniauth-scaffold 0.1.7 → 0.1.8
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/VERSION +1 -1
- data/lib/generators/omniauth/scaffold/scaffold_generator.rb +11 -0
- data/lib/generators/omniauth/scaffold/templates/README.md +0 -8
- data/lib/generators/omniauth/scaffold/templates/app/models/user.rb +6 -1
- data/lib/generators/omniauth/scaffold/templates/config/locales/ja.yml +198 -0
- data/lib/generators/omniauth/scaffold/templates/db/migrate/create_users.rb +2 -2
- data/omniauth-scaffold.gemspec +3 -2
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
@@ -8,6 +8,7 @@ module Omniauth
|
|
8
8
|
desc "This generator scaffold for OmniAuth"
|
9
9
|
|
10
10
|
def generate_scaffold
|
11
|
+
# Config
|
11
12
|
copy_file "config/initializers/omniauth.rb", "config/initializers/omniauth.rb"
|
12
13
|
copy_file "config/initializers/local_setting.rb", "config/initializers/local_setting.rb"
|
13
14
|
copy_file "config/initializers/constants.rb", "config/initializers/constants.rb"
|
@@ -15,9 +16,15 @@ module Omniauth
|
|
15
16
|
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"
|
16
17
|
insert_into_file "config/routes.rb", " root to: 'top#index'\n", after: "# root :to => 'welcome#index'\n"
|
17
18
|
insert_into_file "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n"
|
19
|
+
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"
|
20
|
+
insert_into_file "config/application.rb", " config.i18n.default_locale = :ja\n", after: "# config.i18n.default_locale = :de\n"
|
18
21
|
|
22
|
+
copy_file "config/locales/ja.yml", "config/locales/ja.yml"
|
23
|
+
|
24
|
+
# DB
|
19
25
|
copy_file "db/migrate/create_users.rb", "db/migrate/20000101000000_create_users.rb"
|
20
26
|
|
27
|
+
# App
|
21
28
|
copy_file "app/models/user.rb", "app/models/user.rb"
|
22
29
|
|
23
30
|
copy_file "app/controllers/sessions_controller.rb", "app/controllers/sessions_controller.rb"
|
@@ -30,10 +37,14 @@ module Omniauth
|
|
30
37
|
copy_file "app/assets/stylesheets/base.css.scss", "app/assets/stylesheets/base.css.scss"
|
31
38
|
copy_file "app/assets/stylesheets/scaffolds.css.scss", "app/assets/stylesheets/scaffolds.css.scss"
|
32
39
|
|
40
|
+
# public
|
33
41
|
remove_file 'public/index.html'
|
42
|
+
|
43
|
+
# README
|
34
44
|
remove_file 'README.rdoc'
|
35
45
|
copy_file "README.md", "README.md"
|
36
46
|
|
47
|
+
# gitignore
|
37
48
|
insert_into_file ".gitignore", "\n# Add\n.DS_Store\n/config/initializers/local_setting.rb\n", after: "/tmp\n"
|
38
49
|
end
|
39
50
|
end
|
@@ -41,14 +41,6 @@ Edit: config/initializers/local_setting.rb
|
|
41
41
|
|
42
42
|
※Twitterアプリ登録完了後に表示された「Consumer key」を「YOUR_CONSUMER_KEY」に、「Consumer secret」を「YOUR\_CONSUMER_SECRET」にそれぞれ入力
|
43
43
|
|
44
|
-
### アプリ名設定
|
45
|
-
|
46
|
-
Edit: config/initializers/constants.rb
|
47
|
-
|
48
|
-
APP_NAME = "YOUR_APP_NAME"
|
49
|
-
|
50
|
-
※「YOUR\_APP_NAME」を自分の作成したアプリ名に修正
|
51
|
-
|
52
44
|
### Rails起動
|
53
45
|
|
54
46
|
Gemインストール
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
class User < ActiveRecord::Base
|
3
|
-
|
3
|
+
attr_accessible :provider, :uid, :name, :screen_name, :image, :token, :secret
|
4
4
|
|
5
5
|
private
|
6
6
|
|
@@ -17,6 +17,11 @@ class User < ActiveRecord::Base
|
|
17
17
|
user[:screen_name] = auth["info"]["nickname"]
|
18
18
|
user[:image] = auth["info"]["image"]
|
19
19
|
end
|
20
|
+
|
21
|
+
unless auth["credentials"].blank?
|
22
|
+
user.token = auth['credentials']['token']
|
23
|
+
user.secret = auth['credentials']['secret']
|
24
|
+
end
|
20
25
|
|
21
26
|
user.save
|
22
27
|
|
@@ -0,0 +1,198 @@
|
|
1
|
+
# From https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/ja.yml
|
2
|
+
ja:
|
3
|
+
date:
|
4
|
+
abbr_day_names:
|
5
|
+
- 日
|
6
|
+
- 月
|
7
|
+
- 火
|
8
|
+
- 水
|
9
|
+
- 木
|
10
|
+
- 金
|
11
|
+
- 土
|
12
|
+
abbr_month_names:
|
13
|
+
-
|
14
|
+
- 1月
|
15
|
+
- 2月
|
16
|
+
- 3月
|
17
|
+
- 4月
|
18
|
+
- 5月
|
19
|
+
- 6月
|
20
|
+
- 7月
|
21
|
+
- 8月
|
22
|
+
- 9月
|
23
|
+
- 10月
|
24
|
+
- 11月
|
25
|
+
- 12月
|
26
|
+
day_names:
|
27
|
+
- 日曜日
|
28
|
+
- 月曜日
|
29
|
+
- 火曜日
|
30
|
+
- 水曜日
|
31
|
+
- 木曜日
|
32
|
+
- 金曜日
|
33
|
+
- 土曜日
|
34
|
+
formats:
|
35
|
+
default: ! '%Y/%m/%d'
|
36
|
+
long: ! '%Y年%m月%d日(%a)'
|
37
|
+
short: ! '%m/%d'
|
38
|
+
month_names:
|
39
|
+
-
|
40
|
+
- 1月
|
41
|
+
- 2月
|
42
|
+
- 3月
|
43
|
+
- 4月
|
44
|
+
- 5月
|
45
|
+
- 6月
|
46
|
+
- 7月
|
47
|
+
- 8月
|
48
|
+
- 9月
|
49
|
+
- 10月
|
50
|
+
- 11月
|
51
|
+
- 12月
|
52
|
+
order:
|
53
|
+
- :year
|
54
|
+
- :month
|
55
|
+
- :day
|
56
|
+
datetime:
|
57
|
+
distance_in_words:
|
58
|
+
about_x_hours:
|
59
|
+
one: 約1時間
|
60
|
+
other: 約%{count}時間
|
61
|
+
about_x_months:
|
62
|
+
one: 約1ヶ月
|
63
|
+
other: 約%{count}ヶ月
|
64
|
+
about_x_years:
|
65
|
+
one: 約1年
|
66
|
+
other: 約%{count}年
|
67
|
+
almost_x_years:
|
68
|
+
one: 1年弱
|
69
|
+
other: ! '%{count}年弱'
|
70
|
+
half_a_minute: 30秒前後
|
71
|
+
less_than_x_minutes:
|
72
|
+
one: 1分以内
|
73
|
+
other: ! '%{count}分以内'
|
74
|
+
less_than_x_seconds:
|
75
|
+
one: 1秒以内
|
76
|
+
other: ! '%{count}秒以内'
|
77
|
+
over_x_years:
|
78
|
+
one: 1年以上
|
79
|
+
other: ! '%{count}年以上'
|
80
|
+
x_days:
|
81
|
+
one: 1日
|
82
|
+
other: ! '%{count}日'
|
83
|
+
x_minutes:
|
84
|
+
one: 1分
|
85
|
+
other: ! '%{count}分'
|
86
|
+
x_months:
|
87
|
+
one: 1ヶ月
|
88
|
+
other: ! '%{count}ヶ月'
|
89
|
+
x_seconds:
|
90
|
+
one: 1秒
|
91
|
+
other: ! '%{count}秒'
|
92
|
+
prompts:
|
93
|
+
day: 日
|
94
|
+
hour: 時
|
95
|
+
minute: 分
|
96
|
+
month: 月
|
97
|
+
second: 秒
|
98
|
+
year: 年
|
99
|
+
errors: &errors
|
100
|
+
format: ! '%{attribute}%{message}'
|
101
|
+
messages:
|
102
|
+
accepted: を受諾してください。
|
103
|
+
blank: を入力してください。
|
104
|
+
confirmation: と確認の入力が一致しません。
|
105
|
+
empty: を入力してください。
|
106
|
+
equal_to: は%{count}にしてください。
|
107
|
+
even: は偶数にしてください。
|
108
|
+
exclusion: は予約されています。
|
109
|
+
greater_than: は%{count}より大きい値にしてください。
|
110
|
+
greater_than_or_equal_to: は%{count}以上の値にしてください。
|
111
|
+
inclusion: は一覧にありません。
|
112
|
+
invalid: は不正な値です。
|
113
|
+
less_than: は%{count}より小さい値にしてください。
|
114
|
+
less_than_or_equal_to: は%{count}以下の値にしてください。
|
115
|
+
not_a_number: は数値で入力してください。
|
116
|
+
not_an_integer: は整数で入力してください。
|
117
|
+
odd: は奇数にしてください。
|
118
|
+
record_invalid: バリデーションに失敗しました。 %{errors}
|
119
|
+
taken: はすでに存在します。
|
120
|
+
too_long: は%{count}文字以内で入力してください。
|
121
|
+
too_short: は%{count}文字以上で入力してください。
|
122
|
+
wrong_length: は%{count}文字で入力してください。
|
123
|
+
template:
|
124
|
+
body: 次の項目を確認してください。
|
125
|
+
header:
|
126
|
+
one: ! '%{model}にエラーが発生しました。'
|
127
|
+
other: ! '%{model}に%{count}つのエラーが発生しました。'
|
128
|
+
helpers:
|
129
|
+
select:
|
130
|
+
prompt: 選択してください。
|
131
|
+
submit:
|
132
|
+
create: 登録する
|
133
|
+
submit: 保存する
|
134
|
+
update: 更新する
|
135
|
+
number:
|
136
|
+
currency:
|
137
|
+
format:
|
138
|
+
delimiter: ! ','
|
139
|
+
format: ! '%n%u'
|
140
|
+
precision: 0
|
141
|
+
separator: .
|
142
|
+
significant: false
|
143
|
+
strip_insignificant_zeros: false
|
144
|
+
unit: 円
|
145
|
+
format:
|
146
|
+
delimiter: ! ','
|
147
|
+
precision: 3
|
148
|
+
separator: .
|
149
|
+
significant: false
|
150
|
+
strip_insignificant_zeros: false
|
151
|
+
human:
|
152
|
+
decimal_units:
|
153
|
+
format: ! '%n %u'
|
154
|
+
units:
|
155
|
+
billion: 十億
|
156
|
+
million: 百万
|
157
|
+
quadrillion: 千兆
|
158
|
+
thousand: 千
|
159
|
+
trillion: 兆
|
160
|
+
unit: ''
|
161
|
+
format:
|
162
|
+
delimiter: ''
|
163
|
+
precision: 3
|
164
|
+
significant: true
|
165
|
+
strip_insignificant_zeros: true
|
166
|
+
storage_units:
|
167
|
+
format: ! '%n%u'
|
168
|
+
units:
|
169
|
+
byte: バイト
|
170
|
+
gb: ギガバイト
|
171
|
+
kb: キロバイト
|
172
|
+
mb: メガバイト
|
173
|
+
tb: テラバイト
|
174
|
+
percentage:
|
175
|
+
format:
|
176
|
+
delimiter: ''
|
177
|
+
precision:
|
178
|
+
format:
|
179
|
+
delimiter: ''
|
180
|
+
support:
|
181
|
+
array:
|
182
|
+
last_word_connector: と
|
183
|
+
two_words_connector: と
|
184
|
+
words_connector: と
|
185
|
+
time:
|
186
|
+
am: 午前
|
187
|
+
formats:
|
188
|
+
default: ! '%Y/%m/%d %H:%M:%S'
|
189
|
+
long: ! '%Y年%m月%d日(%a) %H時%M分%S秒 %z'
|
190
|
+
short: ! '%y/%m/%d %H:%M'
|
191
|
+
pm: 午後
|
192
|
+
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
|
193
|
+
activemodel:
|
194
|
+
errors:
|
195
|
+
<<: *errors
|
196
|
+
activerecord:
|
197
|
+
errors:
|
198
|
+
<<: *errors
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :users do |t|
|
4
|
-
# ----- 追加 ----- #
|
5
4
|
t.string :provider
|
6
5
|
t.string :uid
|
7
6
|
t.string :name
|
8
7
|
t.string :screen_name
|
9
8
|
t.string :image
|
10
|
-
|
9
|
+
t.string :token
|
10
|
+
t.string :secret
|
11
11
|
|
12
12
|
t.timestamps
|
13
13
|
end
|
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.8"
|
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-04-
|
12
|
+
s.date = "2012-04-29"
|
13
13
|
s.description = "Scaffold for OmniAuth."
|
14
14
|
s.email = "s.matsumoto0115@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb",
|
36
36
|
"lib/generators/omniauth/scaffold/templates/config/initializers/local_setting.rb",
|
37
37
|
"lib/generators/omniauth/scaffold/templates/config/initializers/omniauth.rb",
|
38
|
+
"lib/generators/omniauth/scaffold/templates/config/locales/ja.yml",
|
38
39
|
"lib/generators/omniauth/scaffold/templates/db/migrate/create_users.rb",
|
39
40
|
"omniauth-scaffold.gemspec",
|
40
41
|
"spec/omniauth-scaffold_spec.rb",
|
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.8
|
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-04-
|
12
|
+
date: 2012-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-twitter
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb
|
134
134
|
- lib/generators/omniauth/scaffold/templates/config/initializers/local_setting.rb
|
135
135
|
- lib/generators/omniauth/scaffold/templates/config/initializers/omniauth.rb
|
136
|
+
- lib/generators/omniauth/scaffold/templates/config/locales/ja.yml
|
136
137
|
- lib/generators/omniauth/scaffold/templates/db/migrate/create_users.rb
|
137
138
|
- omniauth-scaffold.gemspec
|
138
139
|
- spec/omniauth-scaffold_spec.rb
|
@@ -152,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
153
|
version: '0'
|
153
154
|
segments:
|
154
155
|
- 0
|
155
|
-
hash:
|
156
|
+
hash: -1847677663337981583
|
156
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
158
|
none: false
|
158
159
|
requirements:
|