roles_mongo_mapper 0.1.2 → 0.1.3
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
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -6,15 +6,13 @@ module MongoMapper
|
|
6
6
|
class RolesGenerator < Rails::Generators::NamedBase
|
7
7
|
desc "Add role strategy to a model"
|
8
8
|
|
9
|
-
class_option :strategy, :type => :string, :
|
9
|
+
class_option :strategy, :type => :string, :default => 'role_string',
|
10
10
|
:desc => "Role strategy to use (admin_flag, role_string, roles_string, role_strings, one_role, many_roles, roles_mask)"
|
11
11
|
|
12
12
|
|
13
|
-
class_option :roles, :type => :array, :
|
13
|
+
class_option :roles, :type => :array, :default => [], :desc => "Valid roles"
|
14
14
|
|
15
15
|
def apply_role_strategy
|
16
|
-
logger.add_logfile
|
17
|
-
logger.debug "apply_role_strategy for : #{strategy} in model #{name}"
|
18
16
|
insert_into_model name do
|
19
17
|
insertion_text
|
20
18
|
end
|
data/roles_mongo_mapper.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{roles_mongo_mapper}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
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-09-
|
12
|
+
s.date = %q{2010-09-26}
|
13
13
|
s.description = %q{Makes it easy to set a role strategy on your User model in MongoMapper}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -36,7 +36,6 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/roles_mongo_mapper/strategy/single/admin_flag.rb",
|
37
37
|
"lib/roles_mongo_mapper/strategy/single/one_role.rb",
|
38
38
|
"lib/roles_mongo_mapper/strategy/single/role_string.rb",
|
39
|
-
"logging.log",
|
40
39
|
"roles_mongo_mapper.gemspec",
|
41
40
|
"sandbox/test.rb",
|
42
41
|
"spec/generator_spec_helper.rb",
|
@@ -16,7 +16,7 @@ describe 'role strategy generator: admin_flag' do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
after :each do
|
19
|
-
|
19
|
+
remove_model :user
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should configure 'admin_flag' strategy" do
|
@@ -37,6 +37,24 @@ describe 'role strategy generator: admin_flag' do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
it "should configure 'admin_flag' strategy using -s shortcut and defaut roles :admin and :guest" do
|
41
|
+
create_model :user do
|
42
|
+
'# content'
|
43
|
+
end
|
44
|
+
with_generator do |g|
|
45
|
+
arguments = "User --strategy admin_flag"
|
46
|
+
puts "arguments: #{arguments}"
|
47
|
+
g.run_generator arguments.args
|
48
|
+
g.should generate_model :user do |clazz|
|
49
|
+
clazz.should include_module 'MongoMapper::Document'
|
50
|
+
clazz.should include_module 'Roles::MongoMapper'
|
51
|
+
puts "clazz: #{clazz}"
|
52
|
+
clazz.should have_call :valid_roles_are, :args => ':admin, :guest'
|
53
|
+
clazz.should have_call :strategy, :args => ":admin_flag"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
40
58
|
it "should configure 'one_role' strategy" do
|
41
59
|
create_model :user do
|
42
60
|
'# content'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
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-09-
|
17
|
+
date: 2010-09-26 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -168,7 +168,6 @@ files:
|
|
168
168
|
- lib/roles_mongo_mapper/strategy/single/admin_flag.rb
|
169
169
|
- lib/roles_mongo_mapper/strategy/single/one_role.rb
|
170
170
|
- lib/roles_mongo_mapper/strategy/single/role_string.rb
|
171
|
-
- logging.log
|
172
171
|
- roles_mongo_mapper.gemspec
|
173
172
|
- sandbox/test.rb
|
174
173
|
- spec/generator_spec_helper.rb
|
data/logging.log
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
[Rails::Assist::Logging]
|
2
|
-
apply_role_strategy for : admin_flag in model User
|
3
|
-
[Rails::Assist::Logging]
|
4
|
-
apply_role_strategy for : one_role in model User
|
5
|
-
[Rails3::Assist::Logging]
|
6
|
-
apply_role_strategy for : admin_flag in model User
|
7
|
-
[Rails3::Assist::Logging]
|
8
|
-
apply_role_strategy for : one_role in model User
|