authtrail 0.1.2 → 0.1.3

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: 686cc3a7c96d52e4cf5ac79c4268bdb0cd9b670978ac23668af4e8e0d4f11b08
4
- data.tar.gz: 073fd3fefbe1cee4eca8daa2ee3fe13ea2aefd1c3f3d1d868daafa1fe40b7511
3
+ metadata.gz: 5d58f1c05f2177c5a9dd84c1aeed638ce17b5d601f8b8b9a677f5046cad5f239
4
+ data.tar.gz: 79b099d5edba1165e553c35aa8ed43040ca58c2d1ff2616f76cd020da48b15d5
5
5
  SHA512:
6
- metadata.gz: 5b2afdc6ab493f2d8c3759d9d0d145b518f3447250889ce5013f737629d3bd89248ddb7413d8f75c2452a221ed950404355a9763814bdcfffe158bb89a7a2da7
7
- data.tar.gz: ac21a072dd8328cb749a65aedd12188de9cc93501d5ad54bb4ada4b0a56e24bc1cc1116f8d32dfeb3c8a3d28a066258ffc05bbec655c94ec08a30c3ff7e1fee0
6
+ metadata.gz: bc289ab35e5bddd7ea8043fe771787f737bc6661444921485a0b86d13c741c39e4812277718246d612f17bd63cd9719543d23f57803b17cdd30e20f948eeb1ae
7
+ data.tar.gz: 8ba5999ed1ed9f96a225d4f16ce94117204045d3375080ca6dbac0f4020a5e0b00279e69175ef0845403707ea5a1c9b89fe709a0b613666bf207f04cea2c46b2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.3
2
+
3
+ - Added support for Rails 4.2
4
+
1
5
  ## 0.1.2
2
6
 
3
7
  - Added `identity_method` option
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Andrew Kane
1
+ Copyright (c) 2017-2018 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -129,7 +129,7 @@ We recommend using this in addition to Devise’s `Lockable` module and [Rack::A
129
129
 
130
130
  Check out [Hardening Devise](https://github.com/ankane/shorts/blob/master/Hardening-Devise.md) and [Secure Rails](https://github.com/ankane/secure_rails) for more best practices.
131
131
 
132
- Works with Rails 5+
132
+ Works with Rails 4.2+
133
133
 
134
134
  ## History
135
135
 
@@ -1,5 +1,5 @@
1
1
  module AuthTrail
2
- class GeocodeJob < ApplicationJob
2
+ class GeocodeJob < Rails::VERSION::MAJOR >= 5 ? ApplicationJob : ActiveJob::Base
3
3
  def perform(login_activity)
4
4
  result =
5
5
  begin
@@ -1,3 +1,3 @@
1
1
  module AuthTrail
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -25,11 +25,27 @@ module Authtrail
25
25
  end
26
26
 
27
27
  def generate_model
28
- template "login_activity_model.rb", "app/models/login_activity.rb"
28
+ template "login_activity_model.rb", "app/models/login_activity.rb", model_base_class: model_base_class, ar_optional_flag: ar_optional_flag
29
29
  end
30
30
 
31
31
  def migration_version
32
- "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
32
+ if rails5?
33
+ "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
34
+ end
35
+ end
36
+
37
+ def rails5?
38
+ Rails::VERSION::MAJOR >= 5
39
+ end
40
+
41
+ def model_base_class
42
+ rails5? ? "ApplicationRecord" : "ActiveRecord::Base"
43
+ end
44
+
45
+ def ar_optional_flag
46
+ if rails5?
47
+ ", optional: true"
48
+ end
33
49
  end
34
50
  end
35
51
  end
@@ -0,0 +1,3 @@
1
+ class LoginActivity < <%= model_base_class %>
2
+ belongs_to :user, polymorphic: true<%= ar_optional_flag %>
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authtrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-31 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
19
+ version: '4.2'
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
- version: '5'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5'
33
+ version: '4.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5'
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: warden
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -123,8 +123,8 @@ files:
123
123
  - lib/auth_trail/version.rb
124
124
  - lib/authtrail.rb
125
125
  - lib/generators/authtrail/install_generator.rb
126
- - lib/generators/authtrail/templates/login_activities_migration.rb
127
- - lib/generators/authtrail/templates/login_activity_model.rb
126
+ - lib/generators/authtrail/templates/login_activities_migration.rb.tt
127
+ - lib/generators/authtrail/templates/login_activity_model.rb.tt
128
128
  homepage: https://github.com/ankane/authtrail
129
129
  licenses:
130
130
  - MIT
@@ -1,3 +0,0 @@
1
- class LoginActivity < ApplicationRecord
2
- belongs_to :user, polymorphic: true, optional: true
3
- end