cream 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.txt +4 -0
- data/Gemfile +2 -2
- data/README.markdown +49 -93
- data/VERSION +1 -1
- data/cream.gemspec +8 -8
- data/lib/generators/cream/full_config/full_config_generator.rb +42 -9
- data/lib/generators/devise/config/config_generator.rb +24 -7
- metadata +7 -7
data/Changelog.txt
CHANGED
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@ source :rubygems
|
|
2
2
|
source 'http://gems.github.com/'
|
3
3
|
|
4
4
|
group :default do
|
5
|
-
gem "devise-links", "
|
5
|
+
gem "devise-links", ">= 0.2.0"
|
6
6
|
gem "cancan-rest-links", ">= 0.2.0"
|
7
7
|
gem "cancan-permits", ">= 0.3.4"
|
8
8
|
|
@@ -12,7 +12,7 @@ group :default do
|
|
12
12
|
gem "cancan", ">= 1.4.0"
|
13
13
|
gem "rails", ">= 3.0.1"
|
14
14
|
|
15
|
-
gem "rails3_artifactor", "
|
15
|
+
gem "rails3_artifactor", ">= 0.3.2"
|
16
16
|
gem 'logging_assist', "~> 0.1.6"
|
17
17
|
|
18
18
|
gem "r3_plugin_toolbox", ">= 0.4.0"
|
data/README.markdown
CHANGED
@@ -1,52 +1,36 @@
|
|
1
1
|
# Cream
|
2
2
|
|
3
|
-
This project aims to assist you in setting up a complete Authentication and Authorization system for your Rails 3 app.
|
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
|
+
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.
|
4
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
|
+
Cream targets smooth integration of the following systems:
|
6
9
|
|
7
10
|
* [Devise](http://github.com/plataformatec/devise) - Authorization
|
8
11
|
* [CanCan](http://github.com/ryanb/cancan) - Authentication
|
9
12
|
* [Roles Generic](http://github.com/kristianmandrup/roles_generic) - Roles
|
10
13
|
|
11
|
-
For more advanced Authorization configuration, cream uses cancan-permits to
|
12
|
-
The gems *devise-links* and *cancan-rest-links* provide view helpers to facilitate working with authentication links and
|
13
|
-
Cream itself provides generators to easily configure your Rails 3 app with these gems and also includes various view and controller helpers to guard view or controller logic.
|
14
|
+
For more advanced Authorization configuration, cream uses *cancan-permits* to enable use of *Permits* and *Licenses*.
|
15
|
+
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.
|
16
|
+
Cream itself provides generators to easily configure your Rails 3 app with these gems and also includes various view and controller helpers to guard specific view and/or controller logic with permission requirements. Cream targets a set of common ORMs for Rails for Relational and Document based datastores.
|
14
17
|
|
15
|
-
The
|
18
|
+
The objectives of this project:
|
16
19
|
|
17
20
|
* Integrate all these sub-systems
|
18
|
-
* Provide generators that can auto-configure your Rails 3 app with these
|
19
|
-
|
20
|
-
_UPDATE_: 1. Dec 2010
|
21
|
-
Rhe 'full_config' generator ha snow been tested in a fresh Rails 3.0.3 app and works with the following orms:
|
22
|
-
* active_record
|
23
|
-
* mongoid
|
24
|
-
|
25
|
-
I will shortly go through the other ORMs and create Rails 3 demo apps for each with instructions.
|
21
|
+
* Provide generators that can auto-configure your Rails 3 app with these systems for a given ORM
|
26
22
|
|
27
23
|
## Rails 3 demo apps with Cream
|
28
24
|
|
29
|
-
The following Rails 3 demo apps use Cream 0.7.7 and above and were created Dec 1. 2010
|
25
|
+
The following Rails 3 demo apps use Cream 0.7.7 and above and were created around Dec 1. 2010
|
30
26
|
|
31
27
|
* [Cream app with Active Record](https://github.com/kristianmandrup/cream-app-active_record)
|
32
28
|
* [Cream app with Mongoid](https://github.com/kristianmandrup/cream-app-mongoid)
|
33
29
|
* [Cream app with Mongo Mapper](https://github.com/kristianmandrup/cream-app-mongo_mapper)
|
34
30
|
|
35
|
-
## Status
|
36
|
-
|
37
|
-
[CanCan permits demo](https://github.com/kristianmandrup/cancan-permits-demo) is a recent Rails 3 app I created to demonstrate configuration of a Rails 3 app using
|
38
|
-
*cancan-permits* and *cancan-rest-links*. I will build on this in the near future to provide a full Rails 3 app with all the cream features enabled.
|
39
|
-
Stay tuned! Or even better, help me create such template/tutorial projects ;)
|
40
|
-
|
41
|
-
### Update Nov 28, 2010
|
42
|
-
|
43
|
-
Finally cream again installs from a clean base without any dependency problems :) I just switched to Ruby 1.9.3-dev and tested cream from a clean ruby gems.
|
44
|
-
|
45
31
|
## Authentication systems
|
46
32
|
|
47
|
-
Cream targets [
|
48
|
-
|
49
|
-
* [devise](http://github.com/plataformatec/devise)
|
33
|
+
Cream targets [devise](http://github.com/plataformatec/devise) as the Authentication system of choice
|
50
34
|
|
51
35
|
### Devise links
|
52
36
|
|
@@ -57,52 +41,41 @@ The project [devise links](http://github.com/kristianmandrup/devise-links) adds
|
|
57
41
|
There is support for the [CanCan](http://github.com/ryanb/cancan) Authorization system.
|
58
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).
|
59
43
|
|
60
|
-
_Note:_
|
61
|
-
You are most welcome to provide "plugins" for other permission frameworks!
|
62
|
-
|
63
44
|
## Roles
|
64
45
|
|
65
|
-
I have developed a flexible
|
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.
|
66
47
|
|
67
|
-
*
|
68
|
-
|
69
|
-
Roles for popular ORMs
|
70
|
-
|
71
|
-
The Roles Generic API has been implemented for the following ORMs
|
48
|
+
The *Roles Generic API* has been implemented for the following ORMs
|
72
49
|
|
73
50
|
* [Roles Active Record](http://github.com/kristianmandrup/roles_active_record)
|
74
51
|
* [Roles DataMapper](http://github.com/kristianmandrup/roles_data_mapper)
|
75
52
|
* [Roles MongoMapper](http://github.com/kristianmandrup/roles_mongo_mapper)
|
76
53
|
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
|
77
|
-
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
|
78
54
|
* [Roles Simply Stored](https://github.com/kristianmandrup/roles_simply_stored)
|
79
55
|
|
80
|
-
|
81
|
-
Document DBs such as *Mongo* and *Riak* are good for modeling a role-group hierarchical relationship.
|
82
|
-
Role-Group support is planned as a future add-on for the roles strategies integration. (Any assistance appreciated!)
|
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.
|
83
57
|
|
84
|
-
|
85
|
-
You are most welcome to provide "plugins" for any other role frameworks. Please follow the API conventions of Roles generic.
|
58
|
+
### Role Groups
|
86
59
|
|
87
|
-
|
88
|
-
|
89
|
-
easier/simpler to add more strategies and Datastore adapters.
|
60
|
+
Document DBs such as *Mongo* and *Riak* are ideal for modeling a role-group hierarchical relationship.
|
61
|
+
Role-Group support is planned as a future add-on for the roles strategies integration. (Any assistance appreciated!)
|
90
62
|
|
91
63
|
## ORMs
|
92
64
|
|
93
65
|
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.
|
94
66
|
|
95
67
|
Relational DB:
|
68
|
+
|
96
69
|
* Active Record
|
97
70
|
* Data Mapper
|
98
71
|
|
99
|
-
Document
|
100
|
-
|
101
|
-
|
102
|
-
|
72
|
+
Document stores:
|
73
|
+
|
74
|
+
* Mongo Mapper
|
75
|
+
* Mongoid
|
103
76
|
* Couch DB
|
104
77
|
|
105
|
-
These ORMs are also supported for the CanCan Permits and Roles systems.
|
78
|
+
These ORMs are also supported for the *CanCan Permits* and *Roles* systems.
|
106
79
|
|
107
80
|
## Installation and configuration ##
|
108
81
|
|
@@ -115,25 +88,11 @@ Insert <pre>gem 'cream'</pre> in your Rails 3 Gemfile
|
|
115
88
|
|
116
89
|
## Role system
|
117
90
|
|
118
|
-
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
|
119
|
-
|
120
|
-
* Active Record
|
121
|
-
* Data Mapper
|
122
|
-
* Mongo Mapper
|
123
|
-
* Mongoid
|
124
|
-
* Couch DB (via SimplyStored)
|
125
|
-
|
126
|
-
_Note_:
|
127
|
-
Roles for SimplyStored is "shaky" and works only with the admin_flag strategy. I won't develop more on this particular ORM adapter until requested to do so.
|
128
|
-
If you need to use Roles with Couch DB, please help implement this adapter, maybe using another (better?) object-mapping solution for Couch DB.
|
129
|
-
|
130
|
-
### Update
|
131
|
-
|
132
|
-
The Role systems all ORMs (except SimplyStored which is in progress) have recently been upgraded to take advantage of a new Roles Generic API and archictecture.
|
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).
|
133
92
|
|
134
93
|
## CanCan
|
135
94
|
|
136
|
-
Role based authorization for [CanCan](http://github.com/ryanb/cancan) can be
|
95
|
+
Role based authorization for [CanCan](http://github.com/ryanb/cancan) can be achieved by creating a *Permit* class for each role.
|
137
96
|
|
138
97
|
### Permits
|
139
98
|
|
@@ -146,7 +105,11 @@ The project [CanCan REST links](http://github.com/kristianmandrup/cancan-rest-li
|
|
146
105
|
|
147
106
|
Check out [Cancan permits](http://github.com/kristianmandrup/cancan-permits) for more info for how to use Permits.
|
148
107
|
|
149
|
-
*Cancan permits* support all the ORMs that both Devise and Roles
|
108
|
+
*Cancan permits* support all the ORMs that both Devise and Roles support.
|
109
|
+
|
110
|
+
### Permits Editor
|
111
|
+
|
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).
|
150
113
|
|
151
114
|
### Licenses
|
152
115
|
|
@@ -156,45 +119,36 @@ See [CanCan permits demo app](https://github.com/kristianmandrup/cancan-permits-
|
|
156
119
|
|
157
120
|
## Generators
|
158
121
|
|
159
|
-
The following generators are currently available
|
122
|
+
The following generators are currently available:
|
123
|
+
|
124
|
+
Main generator:
|
160
125
|
|
161
|
-
* cream:
|
126
|
+
* cream:full_config - Configure Rails 3 application with Cream (master generator)
|
162
127
|
|
163
|
-
|
128
|
+
Config generators:
|
164
129
|
|
165
|
-
* cream:views - Generates partials for menu items
|
166
130
|
* devise:config - Configure Rails 3 application with Devise
|
167
131
|
* devise:users - Configure Rails 3 application with Devise users
|
168
132
|
* cancan:config - Configures app with CanCan
|
169
133
|
* permits:config - Configures app with CanCan Permits
|
170
134
|
* roles:config - Configures app with Roles
|
171
135
|
|
172
|
-
|
173
|
-
* devise:links - create devise links locale file (should maybe be renamed authlinks?)
|
136
|
+
Other generators:
|
174
137
|
|
175
|
-
|
138
|
+
* 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
|
176
141
|
|
177
|
-
|
178
|
-
the Rails 3 app in one go. I need more people to test this out to see how well it works. I am sure there are still a few bugs and issues here...
|
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!?).
|
179
143
|
|
180
|
-
|
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.
|
181
146
|
|
182
|
-
|
183
|
-
* Active Record
|
184
|
-
* Data Mapper
|
185
|
-
|
186
|
-
Mongo Mapper (NoSQL Document store)
|
187
|
-
* Mongo Mapper
|
188
|
-
* Mongoid
|
189
|
-
|
190
|
-
Couch DB (NoSQL Document store)
|
191
|
-
* SimplyStored ()
|
192
|
-
|
193
|
-
### Config Generator ###
|
147
|
+
### Full Config Generator ###
|
194
148
|
|
195
149
|
Master cream generator which calls the sub-generators in succession.
|
196
150
|
|
197
|
-
<code>rails g cream
|
151
|
+
<code>rails g cream:full_config --strategy ROLE_STRATEGY [--admin_user] [--orm ORM] [--roles ROLE1 ROLE2] [--logfile LOGFILE]</code>
|
198
152
|
|
199
153
|
* --strategy : role strategy to use (see *roles_generic* gem)
|
200
154
|
* --admin-user : create admin user model with separate devise configuration
|
@@ -203,7 +157,7 @@ Master cream generator which calls the sub-generators in succession.
|
|
203
157
|
|
204
158
|
Example
|
205
159
|
|
206
|
-
<code>rails g cream:
|
160
|
+
<code>rails g cream:full_config --strategy admin_flag --admin-user --orm AR</code>
|
207
161
|
|
208
162
|
By default creates :guest and :admin roles.
|
209
163
|
|
@@ -217,11 +171,13 @@ Example: <code>rails g permits:config</code>
|
|
217
171
|
|
218
172
|
Moves 'user menu' partials views into app/views/_user_menu
|
219
173
|
|
220
|
-
<code>rails g cream
|
174
|
+
<code>rails g cream:views [scope] [--haml]</code>
|
221
175
|
|
222
176
|
* scope : The scope folder under views to copy the partials to, fx 'admin'
|
223
177
|
* --haml : Use HAML as template language
|
224
178
|
|
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?).
|
180
|
+
|
225
181
|
## Note on Patches/Pull Requests ##
|
226
182
|
|
227
183
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.2
|
data/cream.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cream}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.2"
|
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-
|
12
|
+
s.date = %q{2010-12-18}
|
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 = [
|
@@ -118,14 +118,14 @@ Gem::Specification.new do |s|
|
|
118
118
|
s.specification_version = 3
|
119
119
|
|
120
120
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
121
|
-
s.add_runtime_dependency(%q<devise-links>, ["
|
121
|
+
s.add_runtime_dependency(%q<devise-links>, [">= 0.2.0"])
|
122
122
|
s.add_runtime_dependency(%q<cancan-rest-links>, [">= 0.2.0"])
|
123
123
|
s.add_runtime_dependency(%q<cancan-permits>, [">= 0.3.4"])
|
124
124
|
s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
|
125
125
|
s.add_runtime_dependency(%q<devise>, [">= 1.1.5"])
|
126
126
|
s.add_runtime_dependency(%q<cancan>, [">= 1.4.0"])
|
127
127
|
s.add_runtime_dependency(%q<rails>, [">= 3.0.1"])
|
128
|
-
s.add_runtime_dependency(%q<rails3_artifactor>, ["
|
128
|
+
s.add_runtime_dependency(%q<rails3_artifactor>, [">= 0.3.2"])
|
129
129
|
s.add_runtime_dependency(%q<logging_assist>, ["~> 0.1.6"])
|
130
130
|
s.add_runtime_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
131
131
|
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.3.1"])
|
@@ -147,14 +147,14 @@ Gem::Specification.new do |s|
|
|
147
147
|
s.add_runtime_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
148
148
|
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.3.1"])
|
149
149
|
else
|
150
|
-
s.add_dependency(%q<devise-links>, ["
|
150
|
+
s.add_dependency(%q<devise-links>, [">= 0.2.0"])
|
151
151
|
s.add_dependency(%q<cancan-rest-links>, [">= 0.2.0"])
|
152
152
|
s.add_dependency(%q<cancan-permits>, [">= 0.3.4"])
|
153
153
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
154
154
|
s.add_dependency(%q<devise>, [">= 1.1.5"])
|
155
155
|
s.add_dependency(%q<cancan>, [">= 1.4.0"])
|
156
156
|
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
157
|
-
s.add_dependency(%q<rails3_artifactor>, ["
|
157
|
+
s.add_dependency(%q<rails3_artifactor>, [">= 0.3.2"])
|
158
158
|
s.add_dependency(%q<logging_assist>, ["~> 0.1.6"])
|
159
159
|
s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
160
160
|
s.add_dependency(%q<sugar-high>, ["~> 0.3.1"])
|
@@ -177,14 +177,14 @@ Gem::Specification.new do |s|
|
|
177
177
|
s.add_dependency(%q<sugar-high>, ["~> 0.3.1"])
|
178
178
|
end
|
179
179
|
else
|
180
|
-
s.add_dependency(%q<devise-links>, ["
|
180
|
+
s.add_dependency(%q<devise-links>, [">= 0.2.0"])
|
181
181
|
s.add_dependency(%q<cancan-rest-links>, [">= 0.2.0"])
|
182
182
|
s.add_dependency(%q<cancan-permits>, [">= 0.3.4"])
|
183
183
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
184
184
|
s.add_dependency(%q<devise>, [">= 1.1.5"])
|
185
185
|
s.add_dependency(%q<cancan>, [">= 1.4.0"])
|
186
186
|
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
187
|
-
s.add_dependency(%q<rails3_artifactor>, ["
|
187
|
+
s.add_dependency(%q<rails3_artifactor>, [">= 0.3.2"])
|
188
188
|
s.add_dependency(%q<logging_assist>, ["~> 0.1.6"])
|
189
189
|
s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
190
190
|
s.add_dependency(%q<sugar-high>, ["~> 0.3.1"])
|
@@ -3,6 +3,7 @@ require 'sugar-high/module'
|
|
3
3
|
require 'cream'
|
4
4
|
require 'rails3_artifactor'
|
5
5
|
require 'logging_assist'
|
6
|
+
require 'active_support'
|
6
7
|
|
7
8
|
module Cream
|
8
9
|
module Generators
|
@@ -28,9 +29,10 @@ module Cream
|
|
28
29
|
class_option :gems, :type => :boolean, :default => true, :desc => "Add gems to gemfile?"
|
29
30
|
class_option :migrations, :type => :boolean, :default => false, :desc => "Autorun database migrations?", :aliases => '-m'
|
30
31
|
|
31
|
-
def main_flow
|
32
|
+
def main_flow
|
33
|
+
return nil if !validate_orm
|
32
34
|
cream_initializer
|
33
|
-
cream_gems if gems?
|
35
|
+
# cream_gems if gems?
|
34
36
|
run_generators
|
35
37
|
run_migrations if run_migrations?
|
36
38
|
end
|
@@ -43,6 +45,14 @@ module Cream
|
|
43
45
|
|
44
46
|
use_helpers :app, :special, :file
|
45
47
|
|
48
|
+
def validate_orm
|
49
|
+
if !valid_orms.include?(orm)
|
50
|
+
say "ORM #{orm} is not currently supported. Please use one of: #{valid_orms}", :red
|
51
|
+
false
|
52
|
+
end
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
46
56
|
def run_migrations?
|
47
57
|
options[:migrations]
|
48
58
|
end
|
@@ -105,7 +115,31 @@ module Cream
|
|
105
115
|
end
|
106
116
|
|
107
117
|
def orm
|
108
|
-
options[:orm]
|
118
|
+
@orm ||= get_orm options[:orm].underscore.to_sym
|
119
|
+
end
|
120
|
+
|
121
|
+
def valid_orms
|
122
|
+
active_record + data_mapper + mongo_mapper + [:couch_db, :mongoid]
|
123
|
+
end
|
124
|
+
|
125
|
+
def active_record
|
126
|
+
[:ar, :active_record]
|
127
|
+
end
|
128
|
+
|
129
|
+
def mongo_mapper
|
130
|
+
[:mm, :mongo_mapper]
|
131
|
+
end
|
132
|
+
|
133
|
+
def data_mapper
|
134
|
+
[:dm, :data_mapper]
|
135
|
+
end
|
136
|
+
|
137
|
+
def get_orm orm_name
|
138
|
+
return :active_record if active_record.include? orm_name
|
139
|
+
return :mongo_mapper if mongo_mapper.include? orm_name
|
140
|
+
return :data_mapper if data_mapper.include? orm_name
|
141
|
+
return :couch_db if orm_name == :couch_db
|
142
|
+
return :mongoid if orm_name == :mongoid
|
109
143
|
end
|
110
144
|
|
111
145
|
def default_roles?
|
@@ -141,12 +175,11 @@ module Cream
|
|
141
175
|
end
|
142
176
|
|
143
177
|
|
144
|
-
def cream_gems
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
end
|
178
|
+
# def cream_gems
|
179
|
+
# if !has_gem? :cream
|
180
|
+
# gem 'cream'
|
181
|
+
# end
|
182
|
+
# end
|
150
183
|
|
151
184
|
def cream_initializer
|
152
185
|
create_initializer :cream do
|
@@ -71,6 +71,18 @@ module Devise
|
|
71
71
|
def gems_mongo_db
|
72
72
|
add_gem 'bson_ext', '>= 1.1.4'
|
73
73
|
end
|
74
|
+
|
75
|
+
def is_active_record?
|
76
|
+
[:ar, :active_record].include? orm.to_sym
|
77
|
+
end
|
78
|
+
|
79
|
+
def is_mongo_mapper?
|
80
|
+
[:mm, :mongo_mapper].include? orm.to_sym
|
81
|
+
end
|
82
|
+
|
83
|
+
def is_data_mapper?
|
84
|
+
[:dm, :data_mapper].include? orm.to_sym
|
85
|
+
end
|
74
86
|
|
75
87
|
def devise_gems
|
76
88
|
say "Configuring devise gems for #{orm}", :green
|
@@ -78,19 +90,24 @@ module Devise
|
|
78
90
|
|
79
91
|
# Devise ORM integration
|
80
92
|
case orm.to_sym
|
93
|
+
when is_active_record?
|
94
|
+
say "Configuring for Active Record"
|
95
|
+
when is_mongo_mapper?
|
96
|
+
say "Configuring for Mongo Mapper"
|
97
|
+
add_gem 'mm-devise'
|
98
|
+
gems_mongo_db
|
99
|
+
when is_data_mapper?
|
100
|
+
say "Configuring for Data Mapper"
|
101
|
+
add_gem 'dm-devise'
|
81
102
|
when :mongoid
|
103
|
+
say "Configuring for Mongoid"
|
82
104
|
say "Please configure Devise for Mongoid similar to Rails 3 example app: http://github.com/fortuity/rails3-mongoid-devise"
|
83
105
|
add_gem 'mongoid', '>= 2.0.0.beta.20'
|
84
106
|
gems_mongo_db
|
85
|
-
when :mongo_mapper
|
86
|
-
add_gem 'mm-devise'
|
87
|
-
gems_mongo_db
|
88
|
-
when :data_mapper
|
89
|
-
add_gem 'dm-devise'
|
90
107
|
when :couch_db
|
108
|
+
say "Configuring for Couch DB"
|
91
109
|
add_gem 'devise_couch'
|
92
|
-
say "Please note that Couch DB does not currently have a Roles implementation.
|
93
|
-
say "Look at Roles DataMapper (roles_data_mapper) for an example ;)"
|
110
|
+
say "Please note that Couch DB does not currently have a complete Roles implementation. Please help implement strategies for this adapter."
|
94
111
|
else
|
95
112
|
say "Orm #{orm} is not currently supported by Cream. You are most welcome to provide a Cream adapter for that ORM ;)"
|
96
113
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
8
|
+
- 2
|
9
|
+
version: 0.8.2
|
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-
|
17
|
+
date: 2010-12-18 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
@@ -127,13 +127,13 @@ dependencies:
|
|
127
127
|
requirement: &id008 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
segments:
|
133
133
|
- 0
|
134
134
|
- 3
|
135
|
-
-
|
136
|
-
version: 0.3.
|
135
|
+
- 2
|
136
|
+
version: 0.3.2
|
137
137
|
type: :runtime
|
138
138
|
prerelease: false
|
139
139
|
version_requirements: *id008
|