rails_guardian 0.1.6 → 0.1.7

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: 2a667ea50382b87912ba9172cfd7021f87ccf082f24a545490bc970880309f63
4
- data.tar.gz: 8006b9bdd5c659bac23c98a570fcd2219c81cd1de1fdc97843b09ce3dd6830e5
3
+ metadata.gz: 3a72533f47412fafba9f7b5f47c5d76a4226675c05361fb78d32c9aa541e8b6d
4
+ data.tar.gz: e06a4caef3ce902713ec887da4e3b5f3bb54a4607372203a21eff0c01fbf3fb9
5
5
  SHA512:
6
- metadata.gz: '019a18c5739a872a0c62d39072a51a748b87188a198c519e45a22838be98ffe2efd77f5f0306d474a753c6c715265362ccb610417cedff15f6debd2726df41be'
7
- data.tar.gz: 21382013680717a101a8995f980c62791a5c41a1029d91763fc0ec2122a5f4439ea3eaa6a99ec272547d5b7b84fcbb9b0802cda4cab2946722dd78c2c32bc58b
6
+ metadata.gz: 14033ffcb6fe018d71a6bdb0e961d25645abb91b430b828a5f18b792810b093bf19350151f5b9a317cbf05a4289df6c90e479b363040d1472ca75483788f91e5
7
+ data.tar.gz: 454849bf78e608203884b931ccdab0160f19dc8101e5e86cb3fd5444df75913746bb6dd1b7a89188f30cb5cde1dfbe02b58fa1d3e14893c5bc27761ee3c60253
@@ -1,13 +1,19 @@
1
1
  # lib/generators/rails_guardian/model/model_generator.rb
2
2
  module RailsGuardian
3
- module Generators
4
- class ModelGenerator < Rails::Generators::NamedBase
5
- source_root File.expand_path('templates', __dir__)
6
-
7
- def create_model_file
8
- template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
9
- end
10
- end
11
- end
3
+ module Generators
4
+ class ModelGenerator < Rails::Generators::NamedBase
5
+ source_root File.expand_path('templates', __dir__)
6
+
7
+ def create_model_file
8
+ template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
9
+ end
10
+
11
+ def create_migration_file
12
+ if defined?(ActiveRecord)
13
+ migration_template 'migration.rb', "db/migrate/guardian_create_#{table_name}.rb"
14
+ end
15
+ end
16
+ end
17
+ end
12
18
  end
13
19
 
@@ -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
+
@@ -1,3 +1,3 @@
1
1
  module RailsGuardian
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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.6
4
+ version: 0.1.7
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