rules_engine_users 0.0.1 → 0.0.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.
- data/VERSION +1 -1
- data/lib/rules_engine/controller_users.rb +3 -3
- data/rails_generators/manifests/rules_engine_users.rb +15 -3
- data/rails_generators/manifests/rules_engine_users.yml +4 -3
- data/rails_generators/templates/app/controllers/admin/users_controller.rb +2 -0
- data/rails_generators/templates/app/controllers/users_controller.rb +81 -5
- data/rails_generators/templates/app/models/user_mailer.rb +1 -1
- data/rails_generators/templates/app/models/user_observer.rb +1 -0
- data/rails_generators/templates/app/views/users/_login_form.html.erb +24 -0
- data/rails_generators/templates/app/views/users/_pswd_forgot_form.html.erb +22 -0
- data/rails_generators/templates/app/views/users/_signup_form.html.erb +26 -0
- data/rails_generators/templates/app/views/users/change_form.html.erb +5 -9
- data/rails_generators/templates/app/views/users/details.html.erb +1 -0
- data/rails_generators/templates/app/views/users/login_form.html.erb +8 -22
- data/rails_generators/templates/app/views/users/login_form.js.erb +37 -0
- data/rails_generators/templates/app/views/users/pswd_change_form.html.erb +5 -8
- data/rails_generators/templates/app/views/users/pswd_forgot_form.html.erb +13 -18
- data/rails_generators/templates/app/views/users/pswd_forgot_form.js.erb +29 -0
- data/rails_generators/templates/app/views/users/pswd_reset_form.html.erb +3 -8
- data/rails_generators/templates/app/views/users/signup_form.html.erb +13 -0
- data/rails_generators/templates/app/views/users/signup_form.js.erb +29 -0
- data/rails_generators/templates/app/views/users/welcome_form.html.erb +3 -7
- data/rails_generators/templates/config/initializers/rules_engine_users.rb +4 -0
- data/rails_generators/templates/db/migrate/20100104014507_create_users.rb +1 -1
- data/rails_generators/templates/doc/README.rules_engine_users +83 -76
- data/rails_generators/templates/spec/controllers/users_controller_spec.rb +312 -183
- data/rails_generators/templates/spec/models/user_mailer_spec.rb +1 -1
- data/rails_generators/templates/{features/support/blueprint_users.rb → spec/support/rules_engine_users_blueprints.rb} +0 -0
- data/rails_generators/templates/spec/support/rules_engine_users_macros.rb +16 -0
- data/spec/rules_engine/controller_users_spec.rb +3 -3
- metadata +17 -13
- data/.document +0 -5
- data/.gitignore +0 -22
- data/Rakefile +0 -47
- data/rails_generators/templates/spec/support/rules_engine_macros.rb +0 -16
- data/rules_engine_users.gemspec +0 -141
@@ -28,7 +28,7 @@ class CreateUsers < ActiveRecord::Migration
|
|
28
28
|
User.create (:full_name => 'Admin User',
|
29
29
|
:email => 'admin@test.com',
|
30
30
|
:login => 'admin',
|
31
|
-
:time_zone => "
|
31
|
+
:time_zone => "Melbourne",
|
32
32
|
:password => 'nopassword',
|
33
33
|
:password_confirmation => 'nopassword',
|
34
34
|
:access_level => User::ACCESS_LEVEL_ADMIN )
|
@@ -4,119 +4,126 @@
|
|
4
4
|
## Installation Guide
|
5
5
|
######################################
|
6
6
|
# 1. Install the Gem
|
7
|
+
|
7
8
|
sudo gem install rules_engine
|
8
9
|
sudo gem install rules_engine_users
|
9
10
|
sudo gem install will_paginate
|
10
11
|
|
12
|
+
|
11
13
|
######################################
|
12
14
|
# 2. Add to the existing Rails App
|
13
|
-
|
15
|
+
|
16
|
+
./script/generate rules_engine_users
|
17
|
+
|
14
18
|
|
15
19
|
######################################
|
16
20
|
# 3. Setup the Rails Environments
|
17
21
|
- ./config/environment.rb
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
ActionController::Base.define_access_level(:rules_engine_editor, 10)
|
30
|
-
ActionController::Base.define_access_level(:rules_engine_reader, 5)
|
31
|
-
# ActionController::Base.define_access_level(:more_access, 7)
|
32
|
-
# ActionController::Base.define_access_level(:less_access, 3)
|
23
|
+
Rails::Initializer.run do |config|
|
24
|
+
...
|
25
|
+
config.gem 'rules_engine'
|
26
|
+
config.gem 'rules_engine_users'
|
27
|
+
config.gem 'will_paginate'
|
28
|
+
...
|
29
|
+
config.active_record.observers = :user_observer
|
30
|
+
...
|
31
|
+
end
|
33
32
|
|
34
33
|
- ./config/environments/production.rb
|
35
34
|
- ./config/environments/development.rb
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
config.action_mailer.delivery_method = :smtp
|
37
|
+
config.action_mailer.smtp_settings = {
|
38
|
+
:address => "XXX",
|
39
|
+
:port => 25,
|
40
|
+
:user_name => "XXX",
|
41
|
+
:password => "XXX",
|
42
|
+
:domain => "XXX",
|
43
|
+
:authentication => :login
|
44
|
+
}
|
45
|
+
RulesEngine::ControllerUserMail.host = 'domain.com'
|
46
|
+
RulesEngine::ControllerUserMail.from = 'domain.com'
|
47
|
+
RulesEngine::ControllerUserMail.prefix = 'My Cool App'
|
49
48
|
|
50
49
|
- ./config/environments/test.rb
|
51
50
|
- ./config/environments/cucumber.rb
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0'
|
53
|
+
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0'
|
54
|
+
config.gem 'webrat', :lib => false, :version => '>=0.7.0'
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
config.gem "rspec", :version => '>=1.3.0', :lib => false
|
57
|
+
config.gem "rspec-rails", :version => '>=1.3.2', :lib => false
|
58
|
+
config.gem "faker", :version => '>=0.3.1', :lib => false
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
config.gem "machinist", :version => '>=1.0.6', :lib => false
|
61
|
+
config.gem 'rcov', :version => '>=0.9.8', :lib => false
|
62
|
+
config.gem 'remarkable_rails', :version => '>=3.1.13', :lib => false
|
63
|
+
|
64
|
+
require 'machinist/active_record'
|
65
|
+
require 'sham'
|
66
|
+
require 'faker'
|
67
|
+
require 'remarkable_rails'
|
64
68
|
|
65
|
-
require 'machinist/active_record'
|
66
|
-
require 'sham'
|
67
|
-
require 'faker'
|
68
|
-
require 'remarkable_rails'
|
69
69
|
|
70
70
|
######################################
|
71
71
|
# 4. Add the Routes
|
72
72
|
- ./config/routes.rb
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
74
|
+
ActionController::Routing::Routes.draw do |map|
|
75
|
+
...
|
76
|
+
map.with_options :controller => 'users', :path_prefix => '/user', :name_prefix => 'user_' do |user|
|
77
|
+
user.login '/', :action => 'login_form', :conditions => { :method => :get }
|
78
|
+
user.login '/', :action => 'login', :conditions => { :method => :post }
|
79
|
+
user.signup '/signup', :action => 'signup_form', :conditions => { :method => :get }
|
80
|
+
user.signup '/signup', :action => 'signup', :conditions => { :method => :post }
|
81
|
+
user.logout '/logout', :action => 'logout'
|
82
|
+
user.pswd_forgot '/pswd_forgot', :action => 'pswd_forgot_form', :conditions => { :method => :get }
|
83
|
+
user.pswd_forgot '/pswd_forgot', :action => 'pswd_forgot', :conditions => { :method => :post }
|
84
|
+
user.pswd_change '/pswd_change', :action => 'pswd_change_form', :conditions => { :method => :get }
|
85
|
+
user.pswd_change '/pswd_change', :action => 'pswd_change', :conditions => { :method => :post }
|
86
|
+
user.details '/details', :action => 'details', :conditions => { :method => :get }
|
87
|
+
user.change '/change', :action => 'change_form', :conditions => { :method => :get }
|
88
|
+
user.change '/change', :action => 'change', :conditions => { :method => :put }
|
89
|
+
user.pswd_reset '/pswd_reset', :action => 'pswd_reset_form', :conditions => { :method => :get }
|
90
|
+
user.pswd_reset '/pswd_reset', :action => 'pswd_reset', :conditions => { :method => :post }
|
91
|
+
user.welcome '/welcome', :action => 'welcome_form', :conditions => { :method => :get }
|
92
|
+
user.welcome '/welcome', :action => 'welcome', :conditions => { :method => :post }
|
93
|
+
end
|
94
|
+
|
95
|
+
map.namespace :admin do |admin|
|
96
|
+
admin.index '/', :controller => 'users', :action => 'index'
|
97
|
+
admin.resources :users, :controller => 'users'
|
98
|
+
end
|
99
|
+
...
|
100
|
+
end
|
100
101
|
|
101
102
|
|
102
103
|
######################################
|
103
104
|
# 5. Install the Required Gems
|
104
|
-
|
105
|
-
|
105
|
+
|
106
|
+
rake gems:install
|
107
|
+
rake gems:install RAILS_ENV=test
|
108
|
+
|
106
109
|
|
107
110
|
######################################
|
108
111
|
# 6. Migrate the Database
|
109
|
-
|
110
|
-
|
112
|
+
|
113
|
+
rake db:migrate
|
114
|
+
rake db:migrate RAILS_ENV=test
|
115
|
+
|
111
116
|
|
112
117
|
######################################
|
113
118
|
# 7. Run the Tests
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
119
|
+
|
120
|
+
rake spec
|
121
|
+
rake spec:rcov
|
122
|
+
rake cucumber
|
123
|
+
open coverage/index.html
|
124
|
+
|
118
125
|
|
119
126
|
######################################
|
120
127
|
# 8. Start the Server
|
121
|
-
|
122
|
-
|
128
|
+
./script/server
|
129
|
+
open http://localhost:3000/re_pipelines
|