cz_auth 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -11
- data/lib/cz_auth/version.rb +1 -1
- data/lib/generators/cz_auth/injections.yml +8 -0
- data/lib/generators/cz_auth/install_generator.rb +17 -9
- data/lib/generators/cz_auth/model_generator.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a072031d0f658e0884bb5a69dc1413ded18d8f33
|
4
|
+
data.tar.gz: 91dffff1714948b8cf83b41473ced57095d357d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14354f782cdf4994c63f73ee73e859460ab2f17cef9dfc3d6e21f07ccd2ca99f8c280c98b3da6f7e369d0670b66b922a9a9b73edd2e698045c6df93013669a0
|
7
|
+
data.tar.gz: 93c5cd044e8b9b10e30fa31222e69b3468af408c1bda26bd6652d5a2fd73e48126afa1be6df7aab34ab5fd872729ca41288763ebf1b5b049dc8c828426eb8634
|
data/README.md
CHANGED
@@ -7,7 +7,8 @@ Usage
|
|
7
7
|
=
|
8
8
|
|
9
9
|
```shell
|
10
|
-
rails g cz_auth:install
|
10
|
+
rails g cz_auth:install
|
11
|
+
rails g cz_auth:model <model_name>
|
11
12
|
rake db:migrate
|
12
13
|
```
|
13
14
|
|
@@ -16,16 +17,6 @@ You can also work with existing models, by adding the following to an existing m
|
|
16
17
|
requires_authentication
|
17
18
|
```
|
18
19
|
|
19
|
-
Add the following to the top of `application_controller.rb`
|
20
|
-
```ruby
|
21
|
-
include CzAuth::Concerns::Authentication
|
22
|
-
```
|
23
|
-
|
24
|
-
Add the following to the top of `routes.rb`
|
25
|
-
```ruby
|
26
|
-
mount CzAuth::Engine => "/"
|
27
|
-
```
|
28
|
-
|
29
20
|
Details
|
30
21
|
=
|
31
22
|
|
data/lib/cz_auth/version.rb
CHANGED
@@ -3,17 +3,25 @@ require 'rails/generators/migration'
|
|
3
3
|
|
4
4
|
class CzAuth::InstallGenerator < Rails::Generators::Base
|
5
5
|
include Rails::Generators::Migration
|
6
|
-
desc "Installs
|
6
|
+
desc "Installs CZAuth Required Files/Lines."
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
def injections
|
9
|
+
[
|
10
|
+
{
|
11
|
+
file: "app/controllers/application_controller.rb",
|
12
|
+
line: "\n\tinclude CzAuth::Concerns::Authentication",
|
13
|
+
after: "ActionController::Base"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
file: "config/routes.rb",
|
17
|
+
line: "\n\tmount CzAuth::Engine => '/'",
|
18
|
+
after: "routes.draw do"
|
19
|
+
}
|
20
|
+
].each do |injection|
|
21
|
+
inject_into_file injection[:file], after: injection[:after] do
|
22
|
+
injection[:line]
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
26
|
+
|
19
27
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class CzAuth::ModelGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
desc "Installs the CzAuth Models, Migrations."
|
7
|
+
|
8
|
+
argument :user_model, :type => :string, :required => false, :default => "User", :desc => "Your user model name."
|
9
|
+
|
10
|
+
def create_models
|
11
|
+
model = user_model.singularize
|
12
|
+
generate("model", "#{model} email password_digest auth_token password_reset_token")
|
13
|
+
inject_into_file "app/models/#{user_model}.rb", after: "ActiveRecord::Base" do
|
14
|
+
"\n\trequires_authentication"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cz_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kelley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -57,7 +57,9 @@ files:
|
|
57
57
|
- lib/cz_auth/requires_authentication.rb
|
58
58
|
- lib/cz_auth/version.rb
|
59
59
|
- lib/cz_auth.rb
|
60
|
+
- lib/generators/cz_auth/injections.yml
|
60
61
|
- lib/generators/cz_auth/install_generator.rb
|
62
|
+
- lib/generators/cz_auth/model_generator.rb
|
61
63
|
- spec/dummy/app/assets/javascripts/application.js
|
62
64
|
- spec/dummy/app/assets/stylesheets/application.css
|
63
65
|
- spec/dummy/app/controllers/application_controller.rb
|