rails_guardian 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 847e2b3a8ef43ab4802b5cf5decd4e3225b4ad5576dbff4e0987c51686d0623d
|
4
|
+
data.tar.gz: a8d841f545fda207f9e8deb715bfab35f9aeffa1f52959957f584d1377ace481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 775ccf185593dc7c38afad42ed8f8f758d242899dae1e96215ebddc3b9135cc23a37bf1f0747ab65c26354f1a3e61c9ea598ad1fec56f9d7781a2680b9c3bfa8
|
7
|
+
data.tar.gz: bceddfcf55f73169499315ccb08fb7431e39c840142d4ad02e14b307dbbe66d6187348a0b4e26b5f4af2afcb9f20e984cc3e2acb0447365c86842f60405ac285
|
@@ -1,13 +1,23 @@
|
|
1
|
-
# lib/generators/
|
1
|
+
# lib/generators/guardian/model/model_generator.rb
|
2
|
+
require 'rails/generators/active_record'
|
3
|
+
|
4
|
+
|
2
5
|
module RailsGuardian
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
module Generators
|
7
|
+
class ModelGenerator < Rails::Generators::NamedBase
|
8
|
+
include ActiveRecord::Generators::Migration
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
10
|
+
|
11
|
+
def create_model_file
|
12
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_migration_file
|
16
|
+
if defined?(ActiveRecord)
|
17
|
+
migration_template 'migration.rb', "db/migrate/guardian_create_#{table_name}.rb"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
12
22
|
end
|
13
23
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# lib/generators/guardian/model/templates/migration.rb
|
2
|
+
class GuardianCreate<%= table_name.camelize %> < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :<%= table_name %> do |t|
|
5
|
+
t.string :email, null: false, default: ""
|
6
|
+
t.string :encrypted_password, null: false, default: ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, default: 0, null: false
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.string :current_sign_in_ip
|
20
|
+
t.string :last_sign_in_ip
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
t.string :confirmation_token
|
24
|
+
t.datetime :confirmed_at
|
25
|
+
t.datetime :confirmation_sent_at
|
26
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
## Lockable
|
29
|
+
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
30
|
+
t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
t.datetime :locked_at
|
32
|
+
|
33
|
+
t.timestamps null: false
|
34
|
+
end
|
35
|
+
|
36
|
+
add_index :<%= table_name %>, :email, unique: true
|
37
|
+
add_index :<%= table_name %>, :reset_password_token, unique: true
|
38
|
+
add_index :<%= table_name %>, :confirmation_token, unique: true
|
39
|
+
add_index :<%= table_name %>, :unlock_token, unique: true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_guardian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fabiantorresm
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/lib/generators/rails_guardian/install/install_generator.rb
|
40
40
|
- lib/lib/generators/rails_guardian/install/templates/rails_guardian.rb
|
41
41
|
- lib/lib/generators/rails_guardian/model/model_generator.rb
|
42
|
+
- lib/lib/generators/rails_guardian/model/templates/migration.rb
|
42
43
|
- lib/lib/generators/rails_guardian/model/templates/model.rb
|
43
44
|
- lib/lib/generators/rails_guardian/views/views_generator.rb
|
44
45
|
- lib/rails_guardian.rb
|