scaffold_plus 1.10.3 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +4 -4
  3. data/README.md +61 -51
  4. data/lib/generators/scaffold_plus/ancestry/ancestry_generator.rb +1 -1
  5. data/lib/generators/scaffold_plus/authority/authority_generator.rb +3 -0
  6. data/lib/generators/scaffold_plus/{enum/enum_generator.rb → enumerize/enumerize_generator.rb} +5 -5
  7. data/lib/generators/scaffold_plus/{enum → enumerize}/templates/enum_migration.rb +1 -1
  8. data/lib/generators/scaffold_plus/friendly_id/friendly_id_generator.rb +6 -0
  9. data/lib/generators/scaffold_plus/sorcery/sorcery_generator.rb +150 -0
  10. data/lib/generators/scaffold_plus/sorcery/templates/_form.html.erb +23 -0
  11. data/lib/generators/scaffold_plus/sorcery/templates/change.html.erb +15 -0
  12. data/lib/generators/scaffold_plus/sorcery/templates/edit.html.erb +5 -0
  13. data/lib/generators/scaffold_plus/sorcery/templates/index.html.erb +62 -0
  14. data/lib/generators/scaffold_plus/sorcery/templates/initializer.rb +114 -0
  15. data/lib/generators/scaffold_plus/sorcery/templates/log_in.html.erb +18 -0
  16. data/lib/generators/scaffold_plus/sorcery/templates/new.html.erb +5 -0
  17. data/lib/generators/scaffold_plus/sorcery/templates/password.html.erb +12 -0
  18. data/lib/generators/scaffold_plus/sorcery/templates/reset_password_email.html.erb +8 -0
  19. data/lib/generators/scaffold_plus/sorcery/templates/show.html.erb +87 -0
  20. data/lib/generators/scaffold_plus/sorcery/templates/sorcery.de.yml +62 -0
  21. data/lib/generators/scaffold_plus/sorcery/templates/sorcery.en.yml +62 -0
  22. data/lib/generators/scaffold_plus/sorcery/templates/user_mailer.rb +14 -0
  23. data/lib/generators/scaffold_plus/sorcery/templates/user_migration.rb +62 -0
  24. data/lib/generators/scaffold_plus/sorcery/templates/user_model.rb +18 -0
  25. data/lib/generators/scaffold_plus/sorcery/templates/users_controller.rb +156 -0
  26. data/lib/scaffold_plus/version.rb +1 -1
  27. data/scaffold_plus.gemspec +4 -4
  28. metadata +30 -14
  29. data/lib/generators/scaffold_plus/force_ssl/force_ssl_generator.rb +0 -46
@@ -0,0 +1,8 @@
1
+ Hello, <%%= @<%= name %>.email %>
2
+ ===============================================
3
+
4
+ You have requested to reset your password.
5
+
6
+ To choose a new password, just follow this link: <%%= @url %>.
7
+
8
+ Have a great day!
@@ -0,0 +1,87 @@
1
+ <%%- page_title @<%= name %>.name -%>
2
+ <h2><%%= @<%= name %>.name %></h2>
3
+ <%%- content_for(:help) { "<%= name %>_show" } -%>
4
+
5
+ <table class="table table-striped table-hover">
6
+ <tbody>
7
+ <tr>
8
+ <td><%%= t('activerecord.attributes.<%= name %>.email') %></td>
9
+ <td><%%= mail_to(@<%= name %>.email) %></td>
10
+ </tr>
11
+ <tr>
12
+ <td><%%= t('activerecord.attributes.<%= name %>.name') %></td>
13
+ <td><%%= @<%= name %>.name %></td>
14
+ </tr>
15
+ <tr>
16
+ <td><%%= t('activerecord.attributes.<%= name %>.phone') %></td>
17
+ <td><%%= @<%= name %>.phone %></td>
18
+ </tr>
19
+ <tr>
20
+ <td><%%= t('activerecord.attributes.<%= name %>.comment') %></td>
21
+ <td><%%= raw(@<%= name %>.comment) %></td>
22
+ </tr>
23
+ <tr>
24
+ <td><%%= t('activerecord.attributes.<%= name %>.theme') %></td>
25
+ <td><%%= @<%= name %>.theme %></td>
26
+ </tr>
27
+ <tr>
28
+ <td><%%= t('activerecord.attributes.<%= name %>.active') %></td>
29
+ <td><%%= @<%= name %>.active ? t('simple_form.yes') : t('simple_form.no') %></td>
30
+ </tr>
31
+ <tr>
32
+ <td><%%= t('activerecord.attributes.<%= name %>.sysadm') %></td>
33
+ <td><%%= @<%= name %>.sysadm ? t('simple_form.yes') : t('simple_form.no') %></td>
34
+ </tr>
35
+ <%- if options.activity_logging? -%>
36
+ <%%- if @<%= name %>.last_login_at.present? -%>
37
+ <tr>
38
+ <td><%%= t('activerecord.attributes.<%= name %>.last_login_at') %></td>
39
+ <td><%%= l(@<%= name %>.last_login_at) %></td>
40
+ </tr>
41
+ <tr>
42
+ <td><%%= t('activerecord.attributes.<%= name %>.last_login_from_ip_address') %></td>
43
+ <td><%%= @<%= name %>.last_login_from_ip_address %></td>
44
+ </tr>
45
+ <%%- end -%>
46
+ <%- end -%>
47
+ <%- if options.brute_force_protection? -%>
48
+ <tr>
49
+ <td><%%= t('activerecord.attributes.<%= name %>.failed_logins_count') %></td>
50
+ <td><%%= @<%= name %>.failed_logins_count %></td>
51
+ </tr>
52
+ <%- end -%>
53
+ <%- if options.activity_logging? -%>
54
+ <%%- if @<%= name %>.last_logout_at.present? -%>
55
+ <tr>
56
+ <td><%%= t('activerecord.attributes.<%= name %>.last_logout_at') %></td>
57
+ <td><%%= l(@<%= name %>.last_logout_at) %></td>
58
+ </tr>
59
+ <%%- end -%>
60
+ <%%- if @<%= name %>.last_activity_at.present? -%>
61
+ <tr>
62
+ <td><%%= t('activerecord.attributes.<%= name %>.last_activity_at') %></td>
63
+ <td><%%= l(@<%= name %>.last_activity_at) %></td>
64
+ </tr>
65
+ <%%- end -%>
66
+ <%- end -%>
67
+ <%- if options.brute_force_protection? -%>
68
+ <%%- if @<%= name %>.lock_expires_at.present? -%>
69
+ <tr>
70
+ <td><%%= t('activerecord.attributes.<%= name %>.lock_expires_at') %></td>
71
+ <td><%%= l(@<%= name %>.lock_expires_at) %></td>
72
+ </tr>
73
+ <%%- end -%>
74
+ <%- end -%>
75
+ </tbody>
76
+ </table>
77
+
78
+ <%%- if current_<%= name %>.sysadm or @<%= name %> == current_<%= name %> -%>
79
+ <%%= link_to t('actions.edit'), [:edit, @<%= name %>], class: 'btn btn-primary' %>
80
+ <%%= link_to t('actions.back.index'), <%= table_name %>_path, class: 'btn btn-default' %>
81
+ <%%- else -%>
82
+ <%%= link_to t('actions.back.index'), <%= table_name %>_path, class: 'btn btn-primary' %>
83
+ <%%- end -%>
84
+ <%%- if current_<%= name %>.sysadm and @<%= name %> != current_<%= name %> -%>
85
+ <%%= link_to t('actions.destroy'), @<%= name %>, method: :delete, data: { confirm: t('actions.confirm') }, class: 'btn btn-danger' %>
86
+ <%%- end -%>
87
+
@@ -0,0 +1,62 @@
1
+ de:
2
+ sorcery:
3
+ forbidden: "Diese Aktion ist nicht erlaubt."
4
+ log_in: "Login"
5
+ log_out: "Logout"
6
+ sign_up: "Benutzerkonto anlegen"
7
+ header: "%{name} Login"
8
+ submit: "Login"
9
+ <%- if options.reset_password? -%>
10
+ reset:
11
+ forgot: "Kennwort vergessen?"
12
+ header: "Kennwort anfordern"
13
+ send: "Anleitung senden"
14
+ back: "Zurück zum Login"
15
+ delivered: "Eine Anleitung wurde an die E-Mail Adresse gesendet."
16
+ missing: "Keine E-Mail Adresse angegeben."
17
+ choose: "Eingabe neues Kennwort"
18
+ change: "Kennwort ändern"
19
+ success: "Das Kennwort wurde aktualisiert."
20
+ failed: "Das Kennwort konnte nicht aktualisiert werden."
21
+ <%- end -%>
22
+ new_password: "Neues Kennwort"
23
+ failed: "E-Mail oder Kennwort ungültig"
24
+ success: "Willkommen und frohes Schaffen!"
25
+ goodbye: "Tschüss und bis bald."
26
+ required: "Bitte zuerst anmelden."
27
+
28
+ <%= name %>_mailer:
29
+ reset_password_email:
30
+ subject: "Kennwort für #{name} zurücksetzen"
31
+
32
+ activerecord:
33
+ models:
34
+ <%= name %>:
35
+ one: "Benutzer"
36
+ other: "Benutzer"
37
+ new: "Neuer Benutzer"
38
+ attributes:
39
+ <%= name %>:
40
+ email: "E-Mail"
41
+ name: "Name"
42
+ phone: "Telefon"
43
+ comment: "Bemerkung"
44
+ theme: "Oberfläche"
45
+ active: "Aktiv"
46
+ sysadm: "SysAdmin"
47
+ password: "Kennwort"
48
+ password_confirmation: "Kennwort wiederholen"
49
+ <%- if options.remember_me? -%>
50
+ remember_me: "Angemeldet bleiben"
51
+ <%- end -%>
52
+ <%- if options.activity_logging? -%>
53
+ last_login_at: "Letzte Anmeldung"
54
+ last_logout_at: "Letzte Abmeldung"
55
+ last_activity_at: "Letzte Aktivität"
56
+ last_login_from_ip_address: "Letzte IP-Adresse"
57
+ <%- end -%>
58
+ <%- if options.brute_force_protection? -%>
59
+ failed_logins_count: "Fehlversuche Anmeldung"
60
+ lock_expires_at: "Gesperrt bis"
61
+ <%- end -%>
62
+
@@ -0,0 +1,62 @@
1
+ en:
2
+ sorcery:
3
+ forbidden: "That is forbidden."
4
+ log_in: "Log in"
5
+ log_out: "Log out"
6
+ sign_up: "Sign up"
7
+ header: "%{name} Login"
8
+ submit: "Log in"
9
+ <%- if options.reset_password? -%>
10
+ reset:
11
+ forgot: "Forgot password?"
12
+ header: "Request new password"
13
+ send: "Send instructions"
14
+ back: "Back to log in"
15
+ delivered: "Instructions were sent to email address."
16
+ missing: "Missing email address."
17
+ choose: "Enter new password"
18
+ change: "Change password"
19
+ success: "Password has been changed."
20
+ failed: "Password could not be changed."
21
+ <%- end -%>
22
+ new_password: "Neues Kennwort"
23
+ failed: "E-Mail oder Kennwort ungültig"
24
+ success: "Willkommen und frohes Schaffen!"
25
+ goodbye: "Tschüss und bis bald."
26
+ required: "Please log in first."
27
+
28
+ <%= name %>_mailer:
29
+ reset_password_email:
30
+ subject: "Kennwort für #{name} zurücksetzen"
31
+
32
+ activerecord:
33
+ models:
34
+ <%= name %>:
35
+ one: "Benutzer"
36
+ other: "Benutzer"
37
+ new: "Neuer Benutzer"
38
+ attributes:
39
+ <%= name %>:
40
+ email: "E-Mail"
41
+ name: "Name"
42
+ phone: "Telefon"
43
+ comment: "Bemerkung"
44
+ theme: "Theme"
45
+ active: "Active"
46
+ sysadm: "SysAdmin"
47
+ password: "Password"
48
+ password_confirmation: "Repeat password"
49
+ <%- if options.remember_me? -%>
50
+ remember_me: "Remember me"
51
+ <%- end -%>
52
+ <%- if options.activity_logging? -%>
53
+ last_login_at: "Letzte Anmeldung"
54
+ last_logout_at: "Letzte Abmeldung"
55
+ last_activity_at: "Letzte Aktivität"
56
+ last_login_from_ip_address: "Letzte IP-Adresse"
57
+ <%- end -%>
58
+ <%- if options.brute_force_protection? -%>
59
+ failed_logins_count: "Fehlversuche Anmeldung"
60
+ lock_expires_at: "Gesperrt bis"
61
+ <%- end -%>
62
+
@@ -0,0 +1,14 @@
1
+ class <%= mailer_name.camelize %> < ActionMailer::Base
2
+ default from: "from@example.com"
3
+
4
+ # Subject can be set in your I18n file at config/locales/en.yml
5
+ # with the following lookup:
6
+ #
7
+ # en.<%= name %>_mailer.reset_password_email.subject
8
+ #
9
+ def reset_password_email(<%= name %>)
10
+ @<%= name %> = <%= name %>
11
+ @url = change_<%= name %>_url(<%= name %>.reset_password_token)
12
+ mail to: <%= name %>.email
13
+ end
14
+ end
@@ -0,0 +1,62 @@
1
+ class <%= migration_name.camelize %> < ActiveRecord::Migration
2
+ def change
3
+ create_table :<%= table_name %> do |t|
4
+ t.string :email, null: false
5
+ t.string :name
6
+ t.string :phone
7
+ t.text :comment
8
+ t.string :theme
9
+ t.boolean :active, default: true
10
+ t.boolean :sysadm, default: false
11
+
12
+ t.string :crypted_password, null: false
13
+ t.string :salt, null: false
14
+ <%- if options.user_activation? -%>
15
+ t.string :activation_state, default: nil
16
+ t.string :activation_token, default: nil
17
+ t.datetime :activation_token_expires_at, default: nil
18
+ <%- end -%>
19
+ <%- if options.reset_password? -%>
20
+ t.string :reset_password_token, default: nil
21
+ t.datetime :reset_password_token_expires_at, default: nil
22
+ t.datetime :reset_password_email_sent_at, default: nil
23
+ <%- end -%>
24
+ <%- if options.remember_me? -%>
25
+ t.boolean :remember_me
26
+ t.string :remember_me_token, default: nil
27
+ t.datetime :remember_me_token_expires_at, default: nil
28
+ <%- end -%>
29
+ <%- if options.brute_force_protection? -%>
30
+ t.integer :failed_logins_count, default: 0
31
+ t.datetime :lock_expires_at, default: nil
32
+ t.string :unlock_token, default: nil
33
+ <%- end -%>
34
+ <%- if options.activity_logging? -%>
35
+ t.datetime :last_login_at, default: nil
36
+ t.datetime :last_logout_at, default: nil
37
+ t.datetime :last_activity_at, default: nil
38
+ t.string :last_login_from_ip_address, default: nil
39
+ <%- end -%>
40
+
41
+ t.timestamps
42
+ end
43
+
44
+ add_index :<%= table_name %>, :email, unique: true
45
+ add_index :<%= table_name %>, :sysadm
46
+ <%- if options.user_activation? -%>
47
+ add_index :<%= table_name %>, :activation_token
48
+ <%- end -%>
49
+ <%- if options.reset_password? -%>
50
+ add_index :<%= table_name %>, :reset_password_token
51
+ <%- end -%>
52
+ <%- if options.remember_me? -%>
53
+ add_index :<%= table_name %>, :remember_me_token
54
+ <%- end -%>
55
+ <%- if options.brute_force_protection? -%>
56
+ add_index :<%= table_name %>, :unlock_token
57
+ <%- end -%>
58
+ <%- if options.activity_logging? -%>
59
+ add_index :<%= table_name %>, [:last_logout_at, :last_activity_at]
60
+ <%- end -%>
61
+ end
62
+ end
@@ -0,0 +1,18 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+ authenticates_with_sorcery!
3
+ validates :email, presence: true, uniqueness: { case_sensitive: false }
4
+ validates :password, presence: true, on: :create
5
+ validates :password, length: { minimum: 6 }, unless: Proc.new { |a| a.password.blank? }
6
+ validates :password, confirmation: true
7
+ validates :password_confirmation, presence: true, on: :create
8
+ <%- if options.authority? -%>
9
+ include Authority::UserAbilities
10
+ <%- end -%>
11
+
12
+ default_scope { order(:name) }
13
+ scope :active, -> { where(active: true) }
14
+ scope :sysadms, -> { where(sysadm: true) }
15
+
16
+ extend Enumerize
17
+ enumerize :theme, in: BootswatchRails::THEMES
18
+ end
@@ -0,0 +1,156 @@
1
+ class <%= controller_name.camelize %> < ApplicationController
2
+ skip_before_action :require_login, only: [:log_in, :access, :password, :reset, :change, :refresh, :log_out]
3
+ before_action :set_<%= name %>, only: [:show, :edit, :update, :destroy]
4
+
5
+ # GET /<%= table_name %>
6
+ # GET /<%= table_name %>.json
7
+ def index
8
+ @<%= table_name %> = <%= class_name %>.order(:email)
9
+ end
10
+
11
+ # GET /<%= table_name %>/1
12
+ # GET /<%= table_name %>/1.json
13
+ def show
14
+ end
15
+
16
+ # GET /<%= table_name %>/new
17
+ def new
18
+ @<%= name %> = <%= class_name %>.new
19
+ end
20
+
21
+ # POST /<%= table_name %>
22
+ # POST /<%= table_name %>.json
23
+ def create
24
+ @<%= name %> = <%= class_name %>.new(<%= name %>_params)
25
+
26
+ respond_to do |format|
27
+ if @<%= name %>.save
28
+ format.html { redirect_to @<%= name %>, notice: t('results.created', name: t('activerecord.models.<%= name %>.one')) }
29
+ format.json { render :show, status: :created, location: @<%= name %> }
30
+ else
31
+ format.html { render :new }
32
+ format.json { render json: @<%= name %>.errors, status: :unprocessable_entity }
33
+ end
34
+ end
35
+ end
36
+
37
+ # GET /<%= table_name %>/1/edit
38
+ def edit
39
+ end
40
+
41
+ # PATCH/PUT /<%= table_name %>/1
42
+ # PATCH/PUT /<%= table_name %>/1.json
43
+ def update
44
+ respond_to do |format|
45
+ if @<%= name %>.update(<%= name %>_params)
46
+ format.html { redirect_to @<%= name %>, notice: t('results.updated', name: t('activerecord.models.<%= name %>.one')) }
47
+ format.json { render :show, status: :ok, location: @<%= name %> }
48
+ else
49
+ format.html { render :edit }
50
+ format.json { render json: @<%= name %>.errors, status: :unprocessable_entity }
51
+ end
52
+ end
53
+ end
54
+
55
+ # GET /<%= table_name %>/log_in
56
+ def log_in
57
+ @<%= name %> = <%= class_name %>.new
58
+ render layout: '<%= options.layout %>'
59
+ end
60
+
61
+ # POST /<%= table_name %>/access
62
+ def access
63
+ @<%= name %> = <%= class_name %>.find_by email: params[:<%= name %>][:email]
64
+ if @<%= name %>.present? and @<%= name %>.active
65
+ <%- if options.remember_me? -%>
66
+ @<%= name %> = login(params[:<%= name %>][:email], params[:<%= name %>][:password], params[:<%= name %>][:remember_me])
67
+ <%- else -%>
68
+ @<%= name %> = login(params[:<%= name %>][:email], params[:<%= name %>][:password])
69
+ <%- end -%>
70
+ else
71
+ @<%= name %> = nil
72
+ end
73
+ if @<%= name %>.present?
74
+ redirect_back_or_to root_path, notice: t('sorcery.success')
75
+ else
76
+ redirect_to log_in_users_path, alert: t('sorcery.failed')
77
+ end
78
+ end
79
+ <%- if options.reset_password? -%>
80
+
81
+ # GET /<%= table_name %>/password
82
+ def password
83
+ @<%= name %> = <%= class_name %>.new
84
+ render layout: '<%= options.layout %>'
85
+ end
86
+
87
+ # POST /<%= table_name %>/reset
88
+ def reset
89
+ if params[:<%= name %>][:email].present?
90
+ @<%= name %> = <%= class_name %>.find_by email: params[:<%= name %>][:email]
91
+ @<%= name %>.deliver_reset_password_instructions! if @<%= name %>
92
+ redirect_to log_in_<%= table_name %>_path, notice: t('sorcery.reset.delivered')
93
+ else
94
+ redirect_to log_in_<%= table_name %>_path, alert: t('sorcery.reset.missing')
95
+ end
96
+ end
97
+
98
+ # GET /<%= table_name %>/token/change
99
+ def change
100
+ @<%= name %> = <%= class_name %>.load_from_reset_password_token(params[:id])
101
+ @token = params[:id]
102
+ if @<%= name %>.blank?
103
+ not_authenticated
104
+ return
105
+ end
106
+ render layout: '<%= options.layout %>'
107
+ end
108
+
109
+ # PATCH/PUT /<%= table_name %>/token/refresh
110
+ def refresh
111
+ @token = params[:<%= name %>][:reset_password_token]
112
+ @<%= name %> = <%= class_name %>.load_from_reset_password_token(@token)
113
+ if @<%= name %>.blank?
114
+ not_authenticated
115
+ return
116
+ end
117
+ @<%= name %>.password_confirmation = params[:<%= name %>][:password_confirmation]
118
+ if @<%= name %>.change_password!(params[:<%= name %>][:password])
119
+ redirect_to root_path, notice: t('sorcery.reset.success')
120
+ else
121
+ redirect_to change_<%= name %>_path(@token), alert: t('sorcery.reset.failed')
122
+ end
123
+ end
124
+ <%- end -%>
125
+
126
+ # DELETE /<%= table_name %>/1
127
+ # DELETE /<%= table_name %>/1.json
128
+ def destroy
129
+ if @<%= name %> == current_<%= name %> or !current_<%= name %>.sysadm
130
+ redirect_to root_path, alert: t('sorcery.forbidden')
131
+ return
132
+ end
133
+ @<%= name %>.destroy
134
+ respond_to do |format|
135
+ format.html { redirect_to <%= table_name %>_url, notice: t('results.deleted', name: t('activerecord.models.<%= name %>.one')) }
136
+ format.json { head :no_content }
137
+ end
138
+ end
139
+
140
+ # GET /<%= table_name %>/log_out
141
+ def log_out
142
+ logout
143
+ redirect_to root_url, notice: t('sorcery.goodbye')
144
+ end
145
+
146
+ private
147
+ # Use callbacks to share common setup or constraints between actions.
148
+ def set_<%= name %>
149
+ @<%= name %> = <%= class_name %>.find(params[:id])
150
+ end
151
+
152
+ # Never trust parameters from the scary internet, only allow the white list through.
153
+ def <%= name %>_params
154
+ params.require(:<%= name %>).permit(<%= whitelist %>)
155
+ end
156
+ end
@@ -1,3 +1,3 @@
1
1
  module ScaffoldPlus
2
- VERSION = "1.10.3"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = ScaffoldPlus::VERSION
9
9
  spec.authors = ["Volker Wiegand"]
10
10
  spec.email = ["volker.wiegand@cvw.de"]
11
- spec.summary = "A collection of little helpers for Rails scaffolding"
11
+ spec.summary = "A collection of helpers for Rails scaffolding"
12
12
  spec.description = spec.summary
13
13
  spec.homepage = "https://github.com/volkerwiegand/scaffold_plus"
14
14
  spec.license = "MIT"
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.required_ruby_version = '>= 1.9.3'
22
- spec.add_dependency 'activerecord', '~> 4.0'
22
+ spec.add_dependency 'activerecord', '>= 4.0'
23
23
 
24
- spec.add_development_dependency 'railties', '~> 4.0'
24
+ spec.add_development_dependency 'railties', '>= 4.0'
25
25
  spec.add_development_dependency "bundler", "~> 1.6"
26
- spec.add_development_dependency "rake", "~> 10.1"
26
+ spec.add_development_dependency "rake", ">= 10.1"
27
27
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffold_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.3
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-14 00:00:00.000000000 Z
11
+ date: 2016-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
@@ -56,17 +56,17 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.1'
69
- description: A collection of little helpers for Rails scaffolding
69
+ description: A collection of helpers for Rails scaffolding
70
70
  email:
71
71
  - volker.wiegand@cvw.de
72
72
  executables: []
@@ -86,9 +86,8 @@ files:
86
86
  - lib/generators/scaffold_plus/autofocus/autofocus_generator.rb
87
87
  - lib/generators/scaffold_plus/collection/collection_generator.rb
88
88
  - lib/generators/scaffold_plus/collection/templates/view.html.erb
89
- - lib/generators/scaffold_plus/enum/enum_generator.rb
90
- - lib/generators/scaffold_plus/enum/templates/enum_migration.rb
91
- - lib/generators/scaffold_plus/force_ssl/force_ssl_generator.rb
89
+ - lib/generators/scaffold_plus/enumerize/enumerize_generator.rb
90
+ - lib/generators/scaffold_plus/enumerize/templates/enum_migration.rb
92
91
  - lib/generators/scaffold_plus/friendly_id/friendly_id_generator.rb
93
92
  - lib/generators/scaffold_plus/friendly_id/templates/friendly_id_migration.rb
94
93
  - lib/generators/scaffold_plus/geocoder/geocoder_generator.rb
@@ -109,6 +108,23 @@ files:
109
108
  - lib/generators/scaffold_plus/many_to_many/templates/many_to_many_model.rb
110
109
  - lib/generators/scaffold_plus/migration/migration_generator.rb
111
110
  - lib/generators/scaffold_plus/migration/templates/change_migration.rb
111
+ - lib/generators/scaffold_plus/sorcery/sorcery_generator.rb
112
+ - lib/generators/scaffold_plus/sorcery/templates/_form.html.erb
113
+ - lib/generators/scaffold_plus/sorcery/templates/change.html.erb
114
+ - lib/generators/scaffold_plus/sorcery/templates/edit.html.erb
115
+ - lib/generators/scaffold_plus/sorcery/templates/index.html.erb
116
+ - lib/generators/scaffold_plus/sorcery/templates/initializer.rb
117
+ - lib/generators/scaffold_plus/sorcery/templates/log_in.html.erb
118
+ - lib/generators/scaffold_plus/sorcery/templates/new.html.erb
119
+ - lib/generators/scaffold_plus/sorcery/templates/password.html.erb
120
+ - lib/generators/scaffold_plus/sorcery/templates/reset_password_email.html.erb
121
+ - lib/generators/scaffold_plus/sorcery/templates/show.html.erb
122
+ - lib/generators/scaffold_plus/sorcery/templates/sorcery.de.yml
123
+ - lib/generators/scaffold_plus/sorcery/templates/sorcery.en.yml
124
+ - lib/generators/scaffold_plus/sorcery/templates/user_mailer.rb
125
+ - lib/generators/scaffold_plus/sorcery/templates/user_migration.rb
126
+ - lib/generators/scaffold_plus/sorcery/templates/user_model.rb
127
+ - lib/generators/scaffold_plus/sorcery/templates/users_controller.rb
112
128
  - lib/scaffold_plus.rb
113
129
  - lib/scaffold_plus/version.rb
114
130
  - scaffold_plus.gemspec
@@ -132,8 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
148
  version: '0'
133
149
  requirements: []
134
150
  rubyforge_project:
135
- rubygems_version: 2.4.3
151
+ rubygems_version: 2.6.6
136
152
  signing_key:
137
153
  specification_version: 4
138
- summary: A collection of little helpers for Rails scaffolding
154
+ summary: A collection of helpers for Rails scaffolding
139
155
  test_files: []
@@ -1,46 +0,0 @@
1
- require 'rails/generators/active_record'
2
-
3
- module ScaffoldPlus
4
- module Generators
5
- class ForceSslGenerator < ActiveRecord::Generators::Base
6
- desc "Enforce SSL for this controller in production"
7
- argument :name, type: :string,
8
- desc: "The resource that is SSL protected"
9
- class_option :only_for, type: :array,
10
- desc: 'Enforce SSL for these actions'
11
- class_option :except_for, type: :array,
12
- desc: 'Do not enforce SSL for these actions'
13
-
14
- def update_controller
15
- file = "app/controllers/#{table_name}_controller.rb"
16
- inject_into_file file, after: /^class.*ApplicationController$/ do
17
- text = "\n force_ssl if: :ssl_configured?"
18
- text << ", only: [#{only_list}]" if options.only_for.present?
19
- text << ", except: [#{except_list}]" if options.except_for.present?
20
- text
21
- end
22
- inject_into_file file, after: /private$/ do
23
- [
24
- "",
25
- " # When to enforce SSL for this controller",
26
- " def ssl_configured?",
27
- " Rails.env.production?",
28
- " end",
29
- "",
30
- ""
31
- ].join("\n")
32
- end
33
- end
34
-
35
- protected
36
-
37
- def only_list
38
- options.only_for.map { |o| ":#{o}" }.join(", ")
39
- end
40
-
41
- def except_list
42
- options.except_for.map { |o| ":#{o}" }.join(", ")
43
- end
44
- end
45
- end
46
- end