hello-rails 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -4
  3. data/app/controllers/hello/concerns/management/forgot_password.rb +1 -1
  4. data/app/controllers/hello/concerns/registration/sign_up.rb +7 -3
  5. data/app/controllers/hello/registration/sign_up_controller.rb +9 -1
  6. data/app/models/access.rb +2 -1
  7. data/app/models/credential.rb +2 -1
  8. data/app/models/email_credential.rb +2 -1
  9. data/app/models/password_credential.rb +2 -1
  10. data/app/models/user.rb +2 -1
  11. data/app/views/hello/shared/_nav_pills.html.erb +0 -2
  12. data/config/locales/hello.fr.yml +2 -4
  13. data/db/migrate/3_create_users.rb +10 -15
  14. data/lib/data/locales.yml +228 -0
  15. data/lib/generators/hello/install/install_generator.rb +8 -29
  16. data/lib/generators/hello/install/templates/initializer.rb +1 -1
  17. data/lib/generators/hello/install/templates/models/concerns/user/authorization.rb +8 -13
  18. data/lib/generators/hello/install/templates/models/user.rb +2 -1
  19. data/lib/generators/hello/users/USAGE +10 -0
  20. data/lib/generators/hello/{install/templates/users → users/templates/app}/controllers/users_controller.rb +2 -4
  21. data/lib/generators/hello/{install/templates/users → users/templates/app}/views/users/index.html.erb +1 -1
  22. data/lib/generators/hello/{install/templates/users → users/templates/app}/views/users/list.html.erb +3 -1
  23. data/lib/generators/hello/{install/templates/users → users/templates/app}/views/users/new.html.erb +2 -2
  24. data/lib/generators/hello/{install/templates/users → users/templates/app}/views/users/show.html.erb +0 -0
  25. data/lib/generators/hello/users/users_generator.rb +21 -0
  26. data/lib/hello/business/registration/sign_up.rb +30 -122
  27. data/lib/hello/locales.rb +1 -232
  28. data/lib/hello/rails_active_record/access.rb +12 -10
  29. data/lib/hello/rails_active_record/credential.rb +22 -18
  30. data/lib/hello/rails_active_record/email_credential.rb +12 -20
  31. data/lib/hello/rails_active_record/password_credential.rb +11 -32
  32. data/lib/hello/rails_active_record/user.rb +75 -54
  33. data/lib/hello/rails_controller.rb +1 -3
  34. data/lib/hello/rails_controller/restrict_by_role.rb +2 -2
  35. data/lib/hello/version.rb +1 -1
  36. data/spec/bdd/hello/authentication/classic_sign_in_spec.rb +2 -2
  37. data/spec/bdd/hello/internalionalization/anyone_can_change_their_locale/change_locale_on_the_sign_in_form_spec.rb +1 -1
  38. data/spec/bdd/hello/management/manage_email_credentials/manage_email_credentials_emails_page_spec.rb +7 -7
  39. data/spec/bdd/hello/management/manage_password_credentials/manage_password_forgot_password_spec.rb +1 -1
  40. data/spec/bdd/hello/management/manage_password_credentials/manage_password_reset_password_spec.rb +1 -1
  41. data/spec/bdd/hello/management/manage_profile/manage_profile_page_spec.rb +0 -2
  42. data/spec/bdd/hello/other/create_user_spec.rb +1 -3
  43. data/spec/bdd/hello/other/impersonate_user_spec.rb +1 -2
  44. data/spec/bdd/hello/other/list_users_spec.rb +2 -4
  45. data/spec/bdd/hello/registration/classic_sign_up_spec.rb +3 -4
  46. data/spec/bdd/hello/support.rb +0 -4
  47. data/spec/business/hello/registration/sign_up_spec.rb +10 -2
  48. data/spec/controllers/authentication_spec.rb +3 -3
  49. data/spec/models/create_and_destroy/email_credential_create_and_destroy_spec.rb +81 -0
  50. data/spec/models/create_and_destroy/password_credential_create_and_destroy_spec.rb +60 -0
  51. data/spec/models/create_and_destroy/user_create_and_destroy_spec.rb +124 -0
  52. data/spec/models/credential_spec.rb +12 -3
  53. data/spec/models/email_credential_spec.rb +1 -2
  54. data/spec/models/password_credential_spec.rb +1 -2
  55. data/spec/models/user_spec.rb +87 -27
  56. data/spec/requests/forgot_password_spec.rb +1 -1
  57. data/spec/support/factories.rb +10 -14
  58. data/spec/support/helpers/given.rb +8 -16
  59. data/spec/support/helpers/when.rb +0 -1
  60. metadata +42 -38
  61. data/lib/generators/hello/from_devise/USAGE +0 -8
  62. data/lib/generators/hello/from_devise/from_devise_generator.rb +0 -13
  63. data/lib/generators/hello/from_devise/templates/from_devise.migration.rb +0 -39
  64. data/spec/models/hello/sign_up_model_spec.rb +0 -64
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d623ee25f1fc28412e0a5fc5eed21dabfcfa960
4
- data.tar.gz: 2ebf9a76d24e8774ddb50b3d4e819ebaf257181e
3
+ metadata.gz: aacb58d36778303f56da878d17bddd6ea510ee76
4
+ data.tar.gz: cf0dce09cb7c296e7dab3e0f493bac83e0058b0c
5
5
  SHA512:
6
- metadata.gz: 58560a0be5c927cd1acfd195441d247213f989e12b7af35096eb81e2a27f07011ff5775481662056df79495e432e8235c64b4da11a6ce3df838af16621167403
7
- data.tar.gz: cf9c6068cad04ce290d4479736b31c8853ecd17d4f5f9109b44fcc64418f18098b33ce9a80c3d03ec1b2461bd0e3499acb763d29159ff8c45ff742c9811be736
6
+ metadata.gz: 7237606b7fef92e3248d1b4ab85d2faf36beeb279c5673a0719f167282c91ba5bdef11c05e74e90bff6c8034beefa15e366718fa3366231d6d2a6c60c4df8e61
7
+ data.tar.gz: 307200a7dab627cbeab4ef191d05ac56a705481cdcafd40b54005403fcc796d2e6ef96f2d5ce2073764bdc6e92dc376f1aee316a4c427ed226e075ce80b7a4d9
data/README.md CHANGED
@@ -9,8 +9,8 @@ Provides a set of valuable features for Registration, Authentication, Management
9
9
 
10
10
  ## Tested With The Latest
11
11
 
12
- | <image width=16 src='https://www.ruby-lang.org/images/header-ruby-logo.png'> Ruby 2.3.0 | <image width=16 src='https://www.ruby-lang.org/images/header-ruby-logo.png'> Ruby 2.4.0-dev | <image width=16 src='https://upload.wikimedia.org/wikipedia/en/thumb/e/e9/Ruby_on_Rails.svg/16px-Ruby_on_Rails.svg.png'> Rails 4.2.6 | <image width=16 src='https://upload.wikimedia.org/wikipedia/en/thumb/e/e9/Ruby_on_Rails.svg/16px-Ruby_on_Rails.svg.png'> Rails 5.0.0-dev |
13
- | :--- | :--- | :--- | :--- |
12
+ | <image width=16 src='https://www.ruby-lang.org/images/header-ruby-logo.png'> Ruby 2.3 | <image width=16 src='https://www.ruby-lang.org/images/header-ruby-logo.png'> Ruby 2.4.0-dev | <image width=16 src='https://upload.wikimedia.org/wikipedia/en/thumb/e/e9/Ruby_on_Rails.svg/16px-Ruby_on_Rails.svg.png'> Rails 5.0 |
13
+ | :--- | :--- | :--- |
14
14
 
15
15
 
16
16
 
@@ -31,22 +31,34 @@ Provides a set of valuable features for Registration, Authentication, Management
31
31
 
32
32
  ## Install
33
33
 
34
+ ##### Gemfile
34
35
  ```ruby
35
- Gemfile
36
36
 
37
37
  gem 'hello-rails'
38
38
  gem 'bcrypt' # bcrypt is a requirement
39
39
  gem 'nav_lynx' # nav_lynx is optional, add it if you are using hello for the first time
40
40
  ```
41
41
 
42
+ ##### Terminal
42
43
  ```shell
43
- Terminal
44
44
 
45
45
  bundle install
46
46
  bundle exec rails generate hello:install
47
47
  bundle exec rake db:migrate
48
48
  ```
49
49
 
50
+ ## Generators
51
+
52
+ After you are comfortable with this gem, come back and give these guys a try!
53
+
54
+ ```shell
55
+ bundle exec rails generate hello:install # initial setup
56
+ bundle exec rails generate hello:users # our secret-sauce scaffold for users
57
+ bundle exec rails generate hello:views # copies our view files to your project
58
+ bundle exec rails generate hello:locales # copies our translation files to your project
59
+ bundle exec rails generate hello:concerns # copies our key-behavior files to your project
60
+ ```
61
+
50
62
 
51
63
 
52
64
 
@@ -34,7 +34,7 @@ module Hello
34
34
  end
35
35
 
36
36
  def get_reset_password_url
37
- p = @user.main_password_credential
37
+ p = @user.password_credential
38
38
  token = p.reset_verifying_token!
39
39
  hello.reset_password_url(p.id, @user.id, token)
40
40
  end
@@ -41,13 +41,17 @@ module Hello
41
41
  end
42
42
 
43
43
  def deliver_confirmation_email
44
- token = @sign_up.email_credential.reset_verifying_token!
45
- url = hello.confirm_email_url(@sign_up.email_credential, token)
44
+ token = email_credential.reset_verifying_token!
45
+ url = hello.confirm_email_url(email_credential, token)
46
46
  Mailer.confirm_email(email, user, url).deliver
47
47
  end
48
48
 
49
49
  def email
50
- @sign_up.email_credential.email
50
+ email_credential.email
51
+ end
52
+
53
+ def email_credential
54
+ @sign_up.email_credentials.first
51
55
  end
52
56
 
53
57
  def user
@@ -41,7 +41,7 @@ module Hello
41
41
  end
42
42
 
43
43
  def _create_enabled
44
- if @sign_up.register(params.require(:sign_up))
44
+ if @sign_up.register(sign_up_params)
45
45
  flash[:notice] = @sign_up.success_message
46
46
  on_success
47
47
  else
@@ -58,6 +58,14 @@ module Hello
58
58
  end
59
59
  on_failure
60
60
  end
61
+
62
+ def sign_up_params
63
+ params.require(:sign_up).permit(sign_up_params_permitted)
64
+ end
65
+
66
+ def sign_up_params_permitted
67
+ Hello.configuration.sign_up_fields.map(&:to_s)
68
+ end
61
69
  end
62
70
  end
63
71
  end
@@ -1,2 +1,3 @@
1
- class Access < Hello::RailsActiveRecord::Access
1
+ class Access < ApplicationRecord
2
+ include Hello::RailsActiveRecord::Access
2
3
  end
@@ -1,2 +1,3 @@
1
- class Credential < Hello::RailsActiveRecord::Credential
1
+ class Credential < ApplicationRecord
2
+ include Hello::RailsActiveRecord::Credential
2
3
  end
@@ -1,2 +1,3 @@
1
- class EmailCredential < Hello::RailsActiveRecord::EmailCredential
1
+ class EmailCredential < Credential
2
+ include Hello::RailsActiveRecord::EmailCredential
2
3
  end
@@ -1,2 +1,3 @@
1
- class PasswordCredential < Hello::RailsActiveRecord::PasswordCredential
1
+ class PasswordCredential < Credential
2
+ include Hello::RailsActiveRecord::PasswordCredential
2
3
  end
@@ -1,2 +1,3 @@
1
- class User < Hello::RailsActiveRecord::User
1
+ class User < ApplicationRecord
2
+ include Hello::RailsActiveRecord::User
2
3
  end
@@ -1,9 +1,7 @@
1
1
  <ul class="nav nav-pills pull-right">
2
2
  <li><%= link_to human_current_locale, hello.locale_path %></li>
3
- <li><%= link_to "User List", users_path %></li>
4
3
 
5
4
  <% if signed_in? %>
6
- <li><%= link_to "My Profile", current_user %></li>
7
5
  <li><%= link_to "Settings", hello_path %></li>
8
6
  <li><%= link_to "Switch Accounts", hello.sessions_path %></li>
9
7
  <li><%= link_to "Sign Out", hello.sign_out_path, method: :delete %></li>
@@ -37,11 +37,9 @@ fr:
37
37
  success: "Veuillez saisir votre mot de passe pour ouvrir cet accès sensible"
38
38
  management:
39
39
  add_email:
40
- # TODO: missing translation
41
- success: "%{email} was successfully added"
40
+ success: "%{email} a bien été rajouté"
42
41
  remove_email:
43
- # TODO: missing translation
44
- success: "%{email} was successfully removed"
42
+ success: "%{email} a bien été supprimé"
45
43
  unlink_access:
46
44
  success: "La liaison avec votre appareil a été retirée"
47
45
  alert: "Une erreur s'est produite lors de la tentative de suppression du lien avec votre appareil"
@@ -1,23 +1,18 @@
1
1
  class CreateUsers < ActiveRecord::Migration
2
2
  def change
3
- must_create_user_table = !table_exists?(:users)
4
- create_table(:users, &:timestamps) if must_create_user_table
3
+ create_table :users do |t|
4
+ t.string :name
5
5
 
6
- add_users_column_safe :name, :string
6
+ t.string :role, default: 'onboarding'
7
7
 
8
- add_users_column_safe :role, :string
9
- add_users_column_safe :locale, :string
10
- add_users_column_safe :time_zone, :string
11
- add_users_column_safe :username, :string
8
+ t.string :locale
9
+ t.string :time_zone
10
+ t.string :username
12
11
 
13
- add_users_column_safe :credentials_count, :integer, default: 0
14
- add_users_column_safe :accesses_count, :integer, default: 0
15
- end
16
-
17
- private
12
+ t.integer :credentials_count, default: 0
13
+ t.integer :accesses_count, default: 0
18
14
 
19
- def add_users_column_safe(column_name, type, options = {})
20
- return if column_exists?(:users, column_name)
21
- add_column(:users, column_name, type, options)
15
+ t.timestamps
16
+ end
22
17
  end
23
18
  end
@@ -0,0 +1,228 @@
1
+ 'af': 'Afrikaans'
2
+ 'af-ZA': 'Afrikaans (South Africa)'
3
+ 'ar': 'Arabic'
4
+ 'ar-AE': 'Arabic (U.A.E.)'
5
+ 'ar-BH': 'Arabic (Bahrain)'
6
+ 'ar-DZ': 'Arabic (Algeria)'
7
+ 'ar-EG': 'Arabic (Egypt)'
8
+ 'ar-IQ': 'Arabic (Iraq)'
9
+ 'ar-JO': 'Arabic (Jordan)'
10
+ 'ar-KW': 'Arabic (Kuwait)'
11
+ 'ar-LB': 'Arabic (Lebanon)'
12
+ 'ar-LY': 'Arabic (Libya)'
13
+ 'ar-MA': 'Arabic (Morocco)'
14
+ 'ar-OM': 'Arabic (Oman)'
15
+ 'ar-QA': 'Arabic (Qatar)'
16
+ 'ar-SA': 'Arabic (Saudi Arabia)'
17
+ 'ar-SY': 'Arabic (Syria)'
18
+ 'ar-TN': 'Arabic (Tunisia)'
19
+ 'ar-YE': 'Arabic (Yemen)'
20
+ 'az': 'Azeri (Latin)'
21
+ 'az-AZ': 'Azeri (Cyrillic) (Azerbaijan)'
22
+ 'be': 'Belarusian'
23
+ 'be-BY': 'Belarusian (Belarus)'
24
+ 'bg': 'Bulgarian'
25
+ 'bg-BG': 'Bulgarian (Bulgaria)'
26
+ 'bs-BA': 'Bosnian (Bosnia and Herzegovina)'
27
+ 'ca': 'Catalan'
28
+ 'ca-ES': 'Catalan (Spain)'
29
+ 'cs': 'Czech'
30
+ 'cs-CZ': 'Czech (Czech Republic)'
31
+ 'cy': 'Welsh'
32
+ 'cy-GB': 'Welsh (United Kingdom)'
33
+ 'da': 'Danish'
34
+ 'da-DK': 'Danish (Denmark)'
35
+ 'de': 'German'
36
+ 'de-AT': 'German (Austria)'
37
+ 'de-CH': 'German (Switzerland)'
38
+ 'de-DE': 'German (Germany)'
39
+ 'de-LI': 'German (Liechtenstein)'
40
+ 'de-LU': 'German (Luxembourg)'
41
+ 'dv': 'Divehi'
42
+ 'dv-MV': 'Divehi (Maldives)'
43
+ 'el': 'Greek'
44
+ 'el-GR': 'Greek (Greece)'
45
+ 'en': 'English'
46
+ 'en-AU': 'English (Australia)'
47
+ 'en-BZ': 'English (Belize)'
48
+ 'en-CA': 'English (Canada)'
49
+ 'en-CB': 'English (Caribbean)'
50
+ 'en-GB': 'English (United Kingdom)'
51
+ 'en-IE': 'English (Ireland)'
52
+ 'en-JM': 'English (Jamaica)'
53
+ 'en-NZ': 'English (New Zealand)'
54
+ 'en-PH': 'English (Republic of the Philippines)'
55
+ 'en-TT': 'English (Trinidad and Tobago)'
56
+ 'en-US': 'English (United States)'
57
+ 'en-ZA': 'English (South Africa)'
58
+ 'en-ZW': 'English (Zimbabwe)'
59
+ 'eo': 'Esperanto'
60
+ 'es': 'Spanish'
61
+ 'es-AR': 'Spanish (Argentina)'
62
+ 'es-BO': 'Spanish (Bolivia)'
63
+ 'es-CL': 'Spanish (Chile)'
64
+ 'es-CO': 'Spanish (Colombia)'
65
+ 'es-CR': 'Spanish (Costa Rica)'
66
+ 'es-DO': 'Spanish (Dominican Republic)'
67
+ 'es-EC': 'Spanish (Ecuador)'
68
+ 'es-ES': 'Spanish (Spain)'
69
+ 'es-GT': 'Spanish (Guatemala)'
70
+ 'es-HN': 'Spanish (Honduras)'
71
+ 'es-MX': 'Spanish (Mexico)'
72
+ 'es-NI': 'Spanish (Nicaragua)'
73
+ 'es-PA': 'Spanish (Panama)'
74
+ 'es-PE': 'Spanish (Peru)'
75
+ 'es-PR': 'Spanish (Puerto Rico)'
76
+ 'es-PY': 'Spanish (Paraguay)'
77
+ 'es-SV': 'Spanish (El Salvador)'
78
+ 'es-UY': 'Spanish (Uruguay)'
79
+ 'es-VE': 'Spanish (Venezuela)'
80
+ 'et': 'Estonian'
81
+ 'et-EE': 'Estonian (Estonia)'
82
+ 'eu': 'Basque'
83
+ 'eu-ES': 'Basque (Spain)'
84
+ 'fa': 'Farsi'
85
+ 'fa-IR': 'Farsi (Iran)'
86
+ 'fi': 'Finnish'
87
+ 'fi-FI': 'Finnish (Finland)'
88
+ 'fo': 'Faroese'
89
+ 'fo-FO': 'Faroese (Faroe Islands)'
90
+ 'fr': 'French'
91
+ 'fr-BE': 'French (Belgium)'
92
+ 'fr-CA': 'French (Canada)'
93
+ 'fr-CH': 'French (Switzerland)'
94
+ 'fr-FR': 'French (France)'
95
+ 'fr-LU': 'French (Luxembourg)'
96
+ 'fr-MC': 'French (Principality of Monaco)'
97
+ 'gl': 'Galician'
98
+ 'gl-ES': 'Galician (Spain)'
99
+ 'gu': 'Gujarati'
100
+ 'gu-IN': 'Gujarati (India)'
101
+ 'he': 'Hebrew'
102
+ 'he-IL': 'Hebrew (Israel)'
103
+ 'hi': 'Hindi'
104
+ 'hi-IN': 'Hindi (India)'
105
+ 'hr': 'Croatian'
106
+ 'hr-BA': 'Croatian (Bosnia and Herzegovina)'
107
+ 'hr-HR': 'Croatian (Croatia)'
108
+ 'hu': 'Hungarian'
109
+ 'hu-HU': 'Hungarian (Hungary)'
110
+ 'hy': 'Armenian'
111
+ 'hy-AM': 'Armenian (Armenia)'
112
+ 'id': 'Indonesian'
113
+ 'id-ID': 'Indonesian (Indonesia)'
114
+ 'is': 'Icelandic'
115
+ 'is-IS': 'Icelandic (Iceland)'
116
+ 'it': 'Italian'
117
+ 'it-CH': 'Italian (Switzerland)'
118
+ 'it-IT': 'Italian (Italy)'
119
+ 'ja': 'Japanese'
120
+ 'ja-JP': 'Japanese (Japan)'
121
+ 'ka': 'Georgian'
122
+ 'ka-GE': 'Georgian (Georgia)'
123
+ 'kk': 'Kazakh'
124
+ 'kk-KZ': 'Kazakh (Kazakhstan)'
125
+ 'kn': 'Kannada'
126
+ 'kn-IN': 'Kannada (India)'
127
+ 'ko': 'Korean'
128
+ 'ko-KR': 'Korean (Korea)'
129
+ 'kok': 'Konkani'
130
+ 'kok-IN': 'Konkani (India)'
131
+ 'ky': 'Kyrgyz'
132
+ 'ky-KG': 'Kyrgyz (Kyrgyzstan)'
133
+ 'lt': 'Lithuanian'
134
+ 'lt-LT': 'Lithuanian (Lithuania)'
135
+ 'lv': 'Latvian'
136
+ 'lv-LV': 'Latvian (Latvia)'
137
+ 'mi': 'Maori'
138
+ 'mi-NZ': 'Maori (New Zealand)'
139
+ 'mk': 'FYRO Macedonian'
140
+ 'mk-MK': 'FYRO Macedonian (Former Yugoslav Republic of Macedonia)'
141
+ 'mn': 'Mongolian'
142
+ 'mn-MN': 'Mongolian (Mongolia)'
143
+ 'mr': 'Marathi'
144
+ 'mr-IN': 'Marathi (India)'
145
+ 'ms': 'Malay'
146
+ 'ms-BN': 'Malay (Brunei Darussalam)'
147
+ 'ms-MY': 'Malay (Malaysia)'
148
+ 'mt': 'Maltese'
149
+ 'mt-MT': 'Maltese (Malta)'
150
+ 'nb': 'Norwegian (Bokm?l)'
151
+ 'nb-NO': 'Norwegian (Bokm?l) (Norway)'
152
+ 'nl': 'Dutch'
153
+ 'nl-BE': 'Dutch (Belgium)'
154
+ 'nl-NL': 'Dutch (Netherlands)'
155
+ 'nn-NO': 'Norwegian (Nynorsk) (Norway)'
156
+ 'ns': 'Northern Sotho'
157
+ 'ns-ZA': 'Northern Sotho (South Africa)'
158
+ 'pa': 'Punjabi'
159
+ 'pa-IN': 'Punjabi (India)'
160
+ 'pl': 'Polish'
161
+ 'pl-PL': 'Polish (Poland)'
162
+ 'ps': 'Pashto'
163
+ 'ps-AR': 'Pashto (Afghanistan)'
164
+ 'pt': 'Portuguese'
165
+ 'pt-BR': 'Portuguese (Brazil)'
166
+ 'pt-PT': 'Portuguese (Portugal)'
167
+ 'qu': 'Quechua'
168
+ 'qu-BO': 'Quechua (Bolivia)'
169
+ 'qu-EC': 'Quechua (Ecuador)'
170
+ 'qu-PE': 'Quechua (Peru)'
171
+ 'ro': 'Romanian'
172
+ 'ro-RO': 'Romanian (Romania)'
173
+ 'ru': 'Russian'
174
+ 'ru-RU': 'Russian (Russia)'
175
+ 'sa': 'Sanskrit'
176
+ 'sa-IN': 'Sanskrit (India)'
177
+ 'se': 'Sami (Northern)'
178
+ 'se-FI': 'Sami (Northern) (Finland)'
179
+ 'se-NO': 'Sami (Northern) (Norway)'
180
+ 'se-SE': 'Sami (Lule) (Sweden)'
181
+ 'sk': 'Slovak'
182
+ 'sk-SK': 'Slovak (Slovakia)'
183
+ 'sl': 'Slovenian'
184
+ 'sl-SI': 'Slovenian (Slovenia)'
185
+ 'sq': 'Albanian'
186
+ 'sq-AL': 'Albanian (Albania)'
187
+ 'sr-BA': 'Serbian (Latin) (Bosnia and Herzegovina)'
188
+ 'sr-SP': 'Serbian (Latin) (Serbia and Montenegro)'
189
+ 'sv': 'Swedish'
190
+ 'sv-FI': 'Swedish (Finland)'
191
+ 'sv-SE': 'Swedish (Sweden)'
192
+ 'sw': 'Swahili'
193
+ 'sw-KE': 'Swahili (Kenya)'
194
+ 'syr': 'Syriac'
195
+ 'syr-SY': 'Syriac (Syria)'
196
+ 'ta': 'Tamil'
197
+ 'ta-IN': 'Tamil (India)'
198
+ 'te': 'Telugu'
199
+ 'te-IN': 'Telugu (India)'
200
+ 'th': 'Thai'
201
+ 'th-TH': 'Thai (Thailand)'
202
+ 'tl': 'Tagalog'
203
+ 'tl-PH': 'Tagalog (Philippines)'
204
+ 'tn': 'Tswana'
205
+ 'tn-ZA': 'Tswana (South Africa)'
206
+ 'tr': 'Turkish'
207
+ 'tr-TR': 'Turkish (Turkey)'
208
+ 'tt': 'Tatar'
209
+ 'tt-RU': 'Tatar (Russia)'
210
+ 'ts': 'Tsonga'
211
+ 'uk': 'Ukrainian'
212
+ 'uk-UA': 'Ukrainian (Ukraine)'
213
+ 'ur': 'Urdu'
214
+ 'ur-PK': 'Urdu (Islamic Republic of Pakistan)'
215
+ 'uz': 'Uzbek (Latin)'
216
+ 'uz-UZ': 'Uzbek (Cyrillic) (Uzbekistan)'
217
+ 'vi': 'Vietnamese'
218
+ 'vi-VN': 'Vietnamese (Viet Nam)'
219
+ 'xh': 'Xhosa'
220
+ 'xh-ZA': 'Xhosa (South Africa)'
221
+ 'zh': 'Chinese'
222
+ 'zh-CN': 'Chinese (S)'
223
+ 'zh-HK': 'Chinese (Hong Kong)'
224
+ 'zh-MO': 'Chinese (Macau)'
225
+ 'zh-SG': 'Chinese (Singapore)'
226
+ 'zh-TW': 'Chinese (T)'
227
+ 'zu': 'Zulu'
228
+ 'zu-ZA': 'Zulu (South Africa)'
@@ -3,6 +3,10 @@ class Hello::InstallGenerator < Rails::Generators::Base
3
3
 
4
4
  def copy_the_initializer
5
5
  copy_file 'initializer.rb', 'config/initializers/hello.rb'
6
+ append_file 'config/initializers/session_store.rb', "
7
+ # Suggestion added by gem 'hello-rails'
8
+ Rails.application.config.session_options[:expire_after] = 10.years
9
+ "
6
10
  end
7
11
 
8
12
  def locale_fix
@@ -17,14 +21,14 @@ class Hello::InstallGenerator < Rails::Generators::Base
17
21
  # a root route is needed
18
22
  # we were previously redirecting to /hello which caused a redirection loop bug
19
23
  def generate_root
20
- my_route "root to: 'root#index'"
24
+ route "root to: 'root#index'"
21
25
  copy_file 'root/root_controller.rb', 'app/controllers/root_controller.rb'
22
26
  copy_file 'root/index.html.erb', 'app/views/root/index.html.erb'
23
27
  end
24
28
 
25
29
  def append_to_the_routes
26
- my_route 'mount Hello::Engine => "/hello"'
27
- my_route "get '/hello/sign_out' => 'hello/authentication/sessions#sign_out'"
30
+ route 'mount Hello::Engine => "/hello"'
31
+ route "get '/hello/sign_out' => 'hello/authentication/sessions#sign_out'"
28
32
  end
29
33
 
30
34
  def create_the_migrations
@@ -55,23 +59,8 @@ class Hello::InstallGenerator < Rails::Generators::Base
55
59
  directory 'models', 'app/models'
56
60
  end
57
61
 
58
- def generate_profile
59
- my_route %(
60
- resources :users, only: [:index, :show, :new, :create] do
61
- collection do
62
- get 'list'
63
- end
64
- member do
65
- post 'impersonate'
66
- end
67
- end
68
- )
69
- directory 'users/controllers', 'app/controllers'
70
- directory 'users/views', 'app/views'
71
- end
72
-
73
62
  def generate_onboarding
74
- my_route %(
63
+ route %(
75
64
  get 'onboarding' => 'onboarding#index'
76
65
  post 'onboarding' => 'onboarding#continue'
77
66
  )
@@ -81,14 +70,4 @@ class Hello::InstallGenerator < Rails::Generators::Base
81
70
 
82
71
  # hook_for :test_framework
83
72
 
84
- protected
85
-
86
- def my_route(routing_code)
87
- log :route, routing_code
88
- sentinel = /\.routes\.draw do\s*$/
89
-
90
- in_root do
91
- inject_into_file 'config/routes.rb', "\n #{routing_code}", after: sentinel, verbose: false, force: false
92
- end
93
- end
94
73
  end