cz_auth 0.4.0 → 0.4.2

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
  SHA1:
3
- metadata.gz: 55831e93c3b7a8e16fa461375f4bf04e2c5c9b8f
4
- data.tar.gz: 924e7c4eeb3fff4bc1a5d386ba123a85bff4a21b
3
+ metadata.gz: a072031d0f658e0884bb5a69dc1413ded18d8f33
4
+ data.tar.gz: 91dffff1714948b8cf83b41473ced57095d357d9
5
5
  SHA512:
6
- metadata.gz: 057d5400090326908e2b6b36a980943338a1e563d908617cb349c66dc4797e7d86a9975d1f02822e9f5e553ae4ea876f65cad305c7ee362516ffe67ffb67764d
7
- data.tar.gz: d56f1d2a905cd6c8f23f8e9c3ef393b79d9c74300caa7819527d8ef7cd6ff72770cf22eb81cde02e4ff8a665174ae03135c79c6990f054fbe1374199d527a8c8
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 <model_name>
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
 
@@ -1,3 +1,3 @@
1
1
  module CzAuth
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -0,0 +1,8 @@
1
+ controller:
2
+ file: app/controllers/application_controller.rb
3
+ line: include CzAuth::Concerns::Authentication
4
+ after: ActionController::Base
5
+ routes:
6
+ file: config/routes.rb
7
+ line: mount CzAuth::Engine => '/'
8
+ after: Application.routes.draw do
@@ -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 the CzAuth Models, Migrations."
6
+ desc "Installs CZAuth Required Files/Lines."
7
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
- if File.exists?("app/models/#{user_model}.rb")
14
- inject_into_file "app/models/#{user_model}.rb", :after => "ActiveRecord::Base" do
15
- "\n\trequires_authentication"
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.0
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-03 00:00:00.000000000 Z
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