cream 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ 0.8.4 - Jan 1, 2011
2
+ -----
3
+ Fixed argument error in #routes_configure! in devise:config generator
4
+ (Also fixed minor bug in 'rails3_assist' gem to allow block as argument in order to insert content into the routes file.
5
+ Now the full_config generator should run just fine again!
6
+
1
7
  Dec 18, 2010
2
8
  ---
3
9
  Improved ORM validation and handling
@@ -1,15 +1,13 @@
1
- # Cream
1
+ h1. Cream
2
2
 
3
3
  This project aims to assist you in setting up a complete Authentication and Authorization system for your Rails 3 app and supports multiple ORMs.
4
4
  Just run the *full_config* generator with arguments specifying: roles available, the role strategy to use and the ORM to target and you are set to go.
5
5
 
6
- _Note_: Cream leverages an extensive set of framework components I have created specifically to make it much easier/faster to create Rails 3 plugins and spec/test them, using more natural DSLs. Look into the code to see the magic!
7
-
8
6
  Cream targets smooth integration of the following systems:
9
7
 
10
- * [Devise](http://github.com/plataformatec/devise) - Authorization
11
- * [CanCan](http://github.com/ryanb/cancan) - Authentication
12
- * [Roles Generic](http://github.com/kristianmandrup/roles_generic) - Roles
8
+ * "Devise":http://github.com/plataformatec/devise - Authentication
9
+ * "CanCan":http://github.com/ryanb/cancan - Authorization
10
+ * "Roles Generic":http://github.com/kristianmandrup/roles_generic - Roles
13
11
 
14
12
  For more advanced Authorization configuration, cream uses *cancan-permits* to enable use of *Permits* and *Licenses*.
15
13
  The gems *devise-links* and *cancan-rest-links* provide view helpers to facilitate working with authentication links and to enable REST links with permission logic.
@@ -20,51 +18,59 @@ The objectives of this project:
20
18
  * Integrate all these sub-systems
21
19
  * Provide generators that can auto-configure your Rails 3 app with these systems for a given ORM
22
20
 
23
- ## Rails 3 demo apps with Cream
21
+ For more information also see the "Cream Wiki":https://github.com/kristianmandrup/cream/wiki, which includes Cream status notes and a complete listing and usage examples of the latest *Roles Generic API*. The wiki also contains an overview of the full Cream API, which contains various helper methods to facilitate working with Users, Sessions, Roles and Permissions in both your views and controllers. Please let me know of other areas that you think should be covered in the Wiki or on this main page ;)
22
+
23
+ _Note_: Cream leverages an extensive set of framework components I have created specifically to make it much easier/faster to create Rails 3 plugins and spec/test them, using more natural DSLs. Look into the code to see the magic!
24
+
25
+ h2. Cream user group
26
+
27
+ The "Cream user group":http://groups.google.com/group/rails-cream is a google group where you can ask Cream related questions, provide suggestions etc. to the Cream community.
28
+
29
+ h2. Rails 3 demo apps with Cream
24
30
 
25
31
  The following Rails 3 demo apps use Cream 0.7.7 and above and were created around Dec 1. 2010
26
32
 
27
- * [Cream app with Active Record](https://github.com/kristianmandrup/cream-app-active_record)
28
- * [Cream app with Mongoid](https://github.com/kristianmandrup/cream-app-mongoid)
29
- * [Cream app with Mongo Mapper](https://github.com/kristianmandrup/cream-app-mongo_mapper)
33
+ * "Cream app with Active Record":https://github.com/kristianmandrup/cream-app-active_record
34
+ * "Cream app with Mongoid":https://github.com/kristianmandrup/cream-app-mongoid
35
+ * "Cream app with Mongo Mapper":https://github.com/kristianmandrup/cream-app-mongo_mapper
30
36
 
31
- ## Authentication systems
37
+ h2. Authentication systems
32
38
 
33
- Cream targets [devise](http://github.com/plataformatec/devise) as the Authentication system of choice
39
+ Cream targets "Devise":http://github.com/plataformatec/devise as the Authentication system of choice
34
40
 
35
- ### Devise links
41
+ h3. Devise links
36
42
 
37
- The project [devise links](http://github.com/kristianmandrup/devise-links) adds more convenience for creating view links to trigger Devise session actions.
43
+ The project "devise links":http://github.com/kristianmandrup/devise-links adds more convenience for creating view links to trigger Devise session actions.
38
44
 
39
- ## Authorization system
45
+ h2. Authorization system
40
46
 
41
- There is support for the [CanCan](http://github.com/ryanb/cancan) Authorization system.
42
- I have created a [Cancan permits](http://github.com/kristianmandrup/cancan-permits) gem that adds the concept of Permits for each role (see below).
47
+ There is support for the "CanCan":http://github.com/ryanb/cancan Authorization system.
48
+ I have created a "Cancan permits":http://github.com/kristianmandrup/cancan-permits gem that adds the concept of Permits for each role (see below).
43
49
 
44
- ## Roles
50
+ h2. Roles
45
51
 
46
- I have developed a flexible [Roles Generic](http://github.com/kristianmandrup/roles_generic) system which is used as the basis for the default Role system.
52
+ I have developed a flexible "Roles Generic":http://github.com/kristianmandrup/roles_generic system which is used as the basis for the default Role system.
47
53
 
48
54
  The *Roles Generic API* has been implemented for the following ORMs
49
55
 
50
- * [Roles Active Record](http://github.com/kristianmandrup/roles_active_record)
51
- * [Roles DataMapper](http://github.com/kristianmandrup/roles_data_mapper)
52
- * [Roles MongoMapper](http://github.com/kristianmandrup/roles_mongo_mapper)
53
- * [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
54
- * [Roles Simply Stored](https://github.com/kristianmandrup/roles_simply_stored)
56
+ * "Roles Active Record":http://github.com/kristianmandrup/roles_active_record
57
+ * "Roles DataMapper":http://github.com/kristianmandrup/roles_data_mapper
58
+ * "Roles MongoMapper":http://github.com/kristianmandrup/roles_mongo_mapper
59
+ * "Roles Mongoid":http://github.com/kristianmandrup/roles_for_mongoid
60
+ * "Roles Simply Stored":https://github.com/kristianmandrup/roles_simply_stored
55
61
 
56
- _Note_: Any role system can be substituted as long as you have a method #has_role? on the user which returns true or false given a string or symbol that identifies the role.
62
+ Any role system can be substituted as long as you have a method #has_role? on the user which returns true or false given a string or symbol that identifies the role.
57
63
 
58
- ### Role Groups
64
+ h3. Role Groups
59
65
 
60
66
  Document DBs such as *Mongo* and *Riak* are ideal for modeling a role-group hierarchical relationship.
61
67
  Role-Group support is planned as a future add-on for the roles strategies integration. (Any assistance appreciated!)
62
68
 
63
- ## ORMs
69
+ h2. ORMs
64
70
 
65
71
  In general, it should now finally be pretty easy to set up a Rails 3 app, with a full Authentication and an Authorization system linked to a Role system using one of the following supported Cream ORMs.
66
72
 
67
- Relational DB:
73
+ Relational Databases:
68
74
 
69
75
  * Active Record
70
76
  * Data Mapper
@@ -77,47 +83,51 @@ Document stores:
77
83
 
78
84
  These ORMs are also supported for the *CanCan Permits* and *Roles* systems.
79
85
 
80
- ## Installation and configuration ##
86
+ h2. Installation and configuration
81
87
 
82
- This gem has been designed for Rails 3 only.
88
+ This gem has been designed for Rails 3 and Ruby 1.9 only. Some users have notified me that it doesn't work on Ruby 1.8.7, so be advised!
83
89
 
84
- ### Install gems
90
+ h3. Install gems
85
91
 
86
92
  Insert <pre>gem 'cream'</pre> in your Rails 3 Gemfile
87
93
  <pre>$ bundle install</pre>
88
94
 
89
- ## Role system
95
+ h2. Role system
90
96
 
91
- Role strategies can be set up using the [Roles Generic](http://github.com/kristianmandrup/roles_generic) gem or any of the ORM specific roles gems such as [Roles Active Record](http://github.com/kristianmandrup/roles_active_record).
97
+ Role strategies can be set up using the "Roles Generic":http://github.com/kristianmandrup/roles_generic gem or any of the ORM specific roles gems such as
98
+ "Roles Active Record":http://github.com/kristianmandrup/roles_active_record.
92
99
 
93
- ## CanCan
100
+ h2. CanCan
94
101
 
95
- Role based authorization for [CanCan](http://github.com/ryanb/cancan) can be achieved by creating a *Permit* class for each role.
102
+ Role based authorization for "CanCan":http://github.com/ryanb/cancan can be achieved by creating a *Permit* class for each role.
96
103
 
97
- ### Permits
104
+ h3. Permits
98
105
 
99
106
  A *Permit* lets a user in a given role do certain actions as defined in the Permit.
100
107
  A Permit can also reuse permission logic in the form of Licenses for a more fine grained design if needed.
101
108
 
102
109
  CanCan Permits comes with generators to generate Permit files which are placed in '/app/permits'. You can then edit the Permits to suit your needs.
103
110
 
104
- The project [CanCan REST links](http://github.com/kristianmandrup/cancan-rest-links) provides a convenient way to handle CanCan REST links, using a flexible API.
111
+ The project "CanCan REST links":http://github.com/kristianmandrup/cancan-rest-links provides a convenient way to handle CanCan REST links, using a flexible API.
105
112
 
106
- Check out [Cancan permits](http://github.com/kristianmandrup/cancan-permits) for more info for how to use Permits.
113
+ Check out "Cancan permits":http://github.com/kristianmandrup/cancan-permits for more info for how to use Permits.
107
114
 
108
115
  *Cancan permits* support all the ORMs that both Devise and Roles support.
109
116
 
110
- ### Permits Editor
117
+ h3. Permits Editor
111
118
 
112
- I have recently created a [Permits editor](http://github.com/kristianmandrup/permits_editor) application that demonstrates how you can let the user edit the Permits, Licenses and even individual User permissions directly as part of an admin section of the web app. The *Permits editor* updates yaml files that are now part of the *cancan-permits* infrastructure (if present and registered).
119
+ I have recently created a "Permits editor":http://github.com/kristianmandrup/permits_editor application that demonstrates how you can let the user edit the Permits, Licenses and even individual User permissions directly as part of an admin section of the web app.
113
120
 
114
- ### Licenses
121
+ The *Permits editor* updates yaml files that are now part of the *cancan-permits* infrastructure (if present and registered).
122
+ I plan to refactor the Permits Editor into a "mountable app":http://piotrsarnacki.com/2010/12/21/mountable-apps-tutorial/ when I have the time.
123
+
124
+ h3. Licenses
115
125
 
116
126
  For more advanced authorization scenarios you can create reusable permission logic in license classed that are placed in '/app/licenses/'. A License can be reused in multiple Permits.
117
127
 
118
- See [CanCan permits demo app](https://github.com/kristianmandrup/cancan-permits-demo) for an example of how to use cancan-permits and licenses.
128
+ See "CanCan permits demo app":https://github.com/kristianmandrup/cancan-permits-demo for an example of how to use cancan-permits and licenses.
119
129
 
120
- ## Generators
130
+ h2. Generators
121
131
 
122
132
  The following generators are currently available:
123
133
 
@@ -136,20 +146,17 @@ Config generators:
136
146
  Other generators:
137
147
 
138
148
  * cancan:restlinks - Create REST links locale file
139
- * devise:links - Create devise links locale file (rename to authlinks?)
140
- * cream:views - Generates partials for menu items
149
+ * devise:links - Create devise links locale file (should I rename this to authlinks?)
150
+ * cream:views - Generates partials for menu items (outdated)
141
151
 
142
- All the above generators have specs included in cream that demonstrate how to use them and should verify that they work as expected (Note: some of the generator specs may be outdated!?).
152
+ All the above generators have specs included in cream that demonstrate how to use them and should verify that they work as expected.
143
153
 
144
- In general, the *cream:full_config* generator can be seen as a kind of "super generator", in that it should call all the sub-generators in succession to fully configure
145
- the Rails 3 app in one go.
154
+ The *cream:full_config* generator should call all the sub-generators in succession to fully configure the Rails 3 app according to your preferences.
146
155
 
147
- ### Full Config Generator ###
156
+ h3. Full Config Generator
148
157
 
149
158
  Master cream generator which calls the sub-generators in succession.
150
159
 
151
- <code>rails g cream:full_config --strategy ROLE_STRATEGY [--admin_user] [--orm ORM] [--roles ROLE1 ROLE2] [--logfile LOGFILE]</code>
152
-
153
160
  * --strategy : role strategy to use (see *roles_generic* gem)
154
161
  * --admin-user : create admin user model with separate devise configuration
155
162
  * --orm : orm to be used
@@ -161,13 +168,13 @@ Example
161
168
 
162
169
  By default creates :guest and :admin roles.
163
170
 
164
- ## Sub generators
171
+ h2. Sub generators
165
172
 
166
173
  To view the run options of any of the sub generators, simply type $ rails g [GENERATOR_NAME]
167
174
 
168
175
  Example: <code>rails g permits:config</code>
169
176
 
170
- ### Views Generator ###
177
+ h3. Cream Views Generator
171
178
 
172
179
  Moves 'user menu' partials views into app/views/_user_menu
173
180
 
@@ -176,9 +183,9 @@ Moves 'user menu' partials views into app/views/_user_menu
176
183
  * scope : The scope folder under views to copy the partials to, fx 'admin'
177
184
  * --haml : Use HAML as template language
178
185
 
179
- _Note_: This *views* generator is based on a similar generator from the devise project. It might be removed in the near future as these menu items would make more sense as simple view helpers (suggestions?).
186
+ The *views* generator is based on a similar generator from the devise project. This generator might be removed in the near future, as the menu items would make more sense as simple view helpers (suggestions welcome).
180
187
 
181
- ## Note on Patches/Pull Requests ##
188
+ h2. Note on Patches/Pull Requests
182
189
 
183
190
  * Fork the project.
184
191
  * Make your feature addition or bug fix.
@@ -188,6 +195,6 @@ _Note_: This *views* generator is based on a similar generator from the devise p
188
195
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
189
196
  * Send me a pull request. Bonus points for topic branches.
190
197
 
191
- ## Copyright ##
198
+ h2. Copyright
192
199
 
193
200
  Copyright (c) 2010 Kristian Mandrup. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.3
1
+ 0.8.4
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cream}
8
- s.version = "0.8.3"
8
+ s.version = "0.8.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = %q{2010-12-20}
12
+ s.date = %q{2011-01-02}
13
13
  s.description = %q{Provides assistance for setting up Session, Role and Permission systems for a Rails 3 app. Support for multiple ORMs}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.markdown"
17
+ "README.textile"
18
18
  ]
19
19
  s.files = [
20
20
  ".bundle/config",
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  "Changelog.txt",
24
24
  "Gemfile",
25
25
  "LICENSE",
26
- "README.markdown",
26
+ "README.textile",
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "app/views/cream/menu/_admin_login_items.html.erb",
@@ -121,7 +121,7 @@ module Devise
121
121
  end
122
122
  end
123
123
 
124
- def routes_configure!
124
+ def routes_configure! orm=nil
125
125
  insert_into_routes do
126
126
  "devise_for #{model_routes}"
127
127
  end
@@ -137,7 +137,7 @@ module Devise
137
137
  end
138
138
 
139
139
 
140
- def protection_configure! orm
140
+ def protection_configure! orm=nil
141
141
  logger.debug "Configuring: devise authentication filter"
142
142
  ## Add Devise protection to Application controller:
143
143
  insert_into_controller :application do
@@ -169,7 +169,7 @@ module Devise
169
169
  File.replace_content_from devise_initializer, :where => orm_statement, :with => orm_replacement
170
170
  end
171
171
 
172
- def mailer_configure! orm
172
+ def mailer_configure! orm=nil
173
173
  logger.debug "Configuring: devise mailer"
174
174
  insert_application_config "action_mailer.default_url_options = { :host => 'localhost:3000' }"
175
175
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 3
9
- version: 0.8.3
8
+ - 4
9
+ version: 0.8.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-20 00:00:00 +01:00
17
+ date: 2011-01-02 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -445,7 +445,7 @@ extensions: []
445
445
 
446
446
  extra_rdoc_files:
447
447
  - LICENSE
448
- - README.markdown
448
+ - README.textile
449
449
  files:
450
450
  - .bundle/config
451
451
  - .document
@@ -453,7 +453,7 @@ files:
453
453
  - Changelog.txt
454
454
  - Gemfile
455
455
  - LICENSE
456
- - README.markdown
456
+ - README.textile
457
457
  - Rakefile
458
458
  - VERSION
459
459
  - app/views/cream/menu/_admin_login_items.html.erb