i0n_rails3_generators 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
data/config/version.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :version_major: 0
3
3
  :version_minor: 2
4
- :version_patch: 11
4
+ :version_patch: 12
@@ -1,48 +1,52 @@
1
- class AuthenticationGenerator < Rails::Generators::NamedBase
2
-
3
- source_root File.expand_path('../templates', __FILE__)
4
-
5
- def gemfile
6
- gem("bcrypt-ruby")
7
- end
8
-
9
- def setup_application
10
- application do
11
- '
12
- # Configure sensitive parameters which will be filtered from the log file.
13
- config.filter_parameters += [:password, :password_confirmation]
14
-
15
- config.autoload_paths += %W(#{Rails.root}/lib)
16
- '
17
- end
18
- end
19
-
20
- def create_authentication_lib_and_include_in_application_helper
21
- copy_file "lib/authentication.rb", "#{Rails.root}/lib/authentication.rb"
22
- inject_into_class("app/controllers/application_controller.rb", "include Authentication")
1
+ module i0n
2
+ module Generators
3
+ class AuthenticationGenerator < Rails::Generators::Base
4
+
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def gemfile
8
+ gem("bcrypt-ruby")
9
+ end
10
+
11
+ def setup_application
12
+ application do
13
+ '
14
+ # Configure sensitive parameters which will be filtered from the log file.
15
+ config.filter_parameters += [:password, :password_confirmation]
16
+
17
+ config.autoload_paths += %W(#{Rails.root}/lib)
18
+ '
19
+ end
20
+ end
21
+
22
+ def create_authentication_lib_and_include_in_application_helper
23
+ copy_file "lib/authentication.rb", "#{Rails.root}/lib/authentication.rb"
24
+ inject_into_class("app/controllers/application_controller.rb", "include Authentication")
25
+ end
26
+
27
+ def create_routes
28
+ route("match 'register' => 'users#new', :as => :register")
29
+ route("resources :users")
30
+ route("resources :user_sessions, :only => [:new, :create, :destroy]")
31
+ route("match 'login' => 'user_sessions#new', :as => :login")
32
+ route("match 'logout' => 'user_sessions#destroy', :as => :logout")
33
+ end
34
+
35
+ def create_models
36
+ generate("model", "user email:string password_hash:string password_salt:string")
37
+ end
38
+
39
+ def create_controllers
40
+ generate("controller", "user_sessions")
41
+ generate("controller", "users")
42
+ inject_into_class("app/controllers/users_controller.rb", IO.read("#{AuthenticationGenerator.source_root}/app/controllers/_users_controller.rb"))
43
+ end
44
+
45
+ def create_views
46
+ directory "app/views/users", "#{Rails.root}/app/views/users"
47
+ directory "app/view/user_sessions", "#{Rails.root}/app/views/user_sessions"
48
+ end
49
+
50
+ end
23
51
  end
24
-
25
- def create_routes
26
- route("match 'register' => 'users#new', :as => :register")
27
- route("resources :users")
28
- route("resources :user_sessions, :only => [:new, :create, :destroy]")
29
- route("match 'login' => 'user_sessions#new', :as => :login")
30
- route("match 'logout' => 'user_sessions#destroy', :as => :logout")
31
- end
32
-
33
- def create_models
34
- generate("model", "user email:string password_hash:string password_salt:string")
35
- end
36
-
37
- def create_controllers
38
- generate("controller", "user_sessions")
39
- generate("controller", "users")
40
- inject_into_class("app/controllers/users_controller.rb", IO.read("#{AuthenticationGenerator.source_root}/app/controllers/_users_controller.rb"))
41
- end
42
-
43
- def create_views
44
- directory "app/views/users", "#{Rails.root}/app/views/users"
45
- directory "app/view/user_sessions", "#{Rails.root}/app/views/user_sessions"
46
- end
47
-
48
52
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: i0n_rails3_generators
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.11
5
+ version: 0.2.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ian Alexander Wood (i0n)