roles_data_mapper 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source :rubygems
2
+
3
+ gem "activesupport", ">= 3.0.1"
4
+ gem "sugar-high", "~> 0.3.0"
5
+ gem "require_all", '~> 1.2.0'
6
+ gem "roles_generic", '~> 0.3.2'
7
+ gem 'rails3_artifactor', '>= 0.3.1'
8
+ gem 'logging_assist', '>= 0.1.6'
9
+
10
+ gem "dm-core", "~> 1.0"
11
+ gem "dm-types", "~> 1.0"
12
+ gem "dm-migrations", "~> 1.0"
13
+ gem "dm-validations", "~> 1.0"
14
+ gem "dm-sqlite-adapter", "~> 1.0"
15
+
16
+ group :test do
17
+ gem "rspec", ">= 2.0.1"
18
+ gem "yaml"
19
+ gem "logger"
20
+ gem "generator_spec", '>= 0.7.0'
21
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -14,11 +14,20 @@ module DataMapper
14
14
 
15
15
  class_option :logfile, :type => :string, :default => nil, :desc => "Logfile location"
16
16
  class_option :roles, :type => :array, :default => [], :desc => "Valid roles"
17
+
18
+ class_option :role_class, :type => :string, :aliases => "-rc", :default => 'Role', :desc => "Role class"
19
+ class_option :user_class, :type => :string, :aliases => "-uc", :default => 'User', :desc => "User class"
20
+ class_option :user_role_class, :type => :string, :aliases => "-urc", :default => 'UserRole', :desc => "User Role join class"
17
21
 
18
22
  def apply_role_strategy
19
23
  logger.add_logfile :logfile => logfile if logfile
20
24
  logger.debug "apply_role_strategy for : #{strategy} in model #{name}"
21
25
 
26
+ if !valid_strategy?
27
+ say "Strategy '#{strategy}' is not valid, at least not for Data Mapper", :red
28
+ return
29
+ end
30
+
22
31
  if !has_model_file?(user_model_name)
23
32
  say "User model #{user_model_name} not found", :red
24
33
  return
@@ -30,9 +39,11 @@ module DataMapper
30
39
  end
31
40
  rescue Exeption => e
32
41
  logger.debug"Error: #{e.message}"
33
- end
42
+ end
43
+
44
+ copy_role_models if role_class_strategy?
34
45
  end
35
-
46
+
36
47
  protected
37
48
 
38
49
  extend Rails3::Assist::UseMacro
@@ -40,6 +51,37 @@ module DataMapper
40
51
 
41
52
  use_orm :data_mapper
42
53
 
54
+ def valid_strategy?
55
+ valid_strategies.include? strategy.to_sym
56
+ end
57
+
58
+ def valid_strategies
59
+ [:admin_flag, :role_string, :one_role, :many_roles, :roles_mask]
60
+ end
61
+
62
+ def copy_role_models
63
+ logger.debug 'copy_role_models'
64
+ case strategy.to_sym
65
+ when :one_role
66
+ copy_one_role_model
67
+ when :many_roles
68
+ copy_many_roles_models
69
+ end
70
+ end
71
+
72
+ def copy_one_role_model
73
+ logger.debug "copy_one_role_model: #{role_class.underscore}"
74
+
75
+ template 'one_role/role.rb', "app/models/#{role_class.underscore}.rb"
76
+ end
77
+
78
+ def copy_many_roles_models
79
+ logger.debug "copy_many_roles_models: #{role_class.underscore} and #{user_role_class.underscore}"
80
+
81
+ template 'many_roles/role.rb', "app/models/#{role_class.underscore}.rb"
82
+ template 'many_roles/user_role.rb', "app/models/#{user_role_class.underscore}.rb"
83
+ end
84
+
43
85
  def logfile
44
86
  options[:logfile]
45
87
  end
@@ -55,6 +97,10 @@ module DataMapper
55
97
  def default_roles
56
98
  [:admin, :guest]
57
99
  end
100
+
101
+ def role_class_strategy?
102
+ [:one_role, :many_roles].include? strategy.to_sym
103
+ end
58
104
 
59
105
  def roles_to_add
60
106
  @roles_to_add ||= default_roles.concat(options[:roles]).to_symbols.uniq
@@ -65,14 +111,15 @@ module DataMapper
65
111
  end
66
112
 
67
113
  def role_strategy_statement
68
- "strategy :#{strategy}, :default\n#{role_class_stmt}"
114
+ "strategy :#{strategy} #{strategy_options}"
69
115
  end
70
116
 
71
- def role_class_stmt
72
- " role_class :role" if [:one_role, :many_roles].include? (strategy.to_sym)
117
+ def strategy_options
118
+ return ", :role_class => :#{role_class.to_s.underscore}" if role_class_strategy? && role_class.to_s != 'Role'
119
+ ''
73
120
  end
74
-
75
- def roles_statement
121
+
122
+ def valid_roles_statement
76
123
  return '' if has_valid_roles_statement?
77
124
  roles ? "valid_roles_are #{roles.join(', ')}" : ''
78
125
  end
@@ -84,9 +131,21 @@ module DataMapper
84
131
  def insertion_text
85
132
  %Q{include Roles::#{orm.to_s.camelize}
86
133
  #{role_strategy_statement}
87
- #{roles_statement}}
134
+ #{valid_roles_statement}}
88
135
  end
89
-
136
+
137
+ def user_class
138
+ options[:user_class].classify || 'User'
139
+ end
140
+
141
+ def role_class
142
+ options[:role_class].classify || 'Role'
143
+ end
144
+
145
+ def user_role_class
146
+ options[:user_role_class].classify || 'UserRole'
147
+ end
148
+
90
149
  def strategy
91
150
  options[:strategy]
92
151
  end
@@ -0,0 +1,17 @@
1
+ class <%= role_class %>
2
+ include DataMapper::Resource
3
+
4
+ def self.named role_names
5
+ where(:name.in => role_names.flatten)
6
+ end
7
+
8
+ property :id, Serial
9
+ property :name, String
10
+
11
+ validates_uniqueness_of :name
12
+
13
+ has n, :<%= user_role_class.to_s.pluralize.underscore %>
14
+ has n, :<%= user_class.to_s.pluralize.underscore %>, :through => :<%= user_role_class.to_s.pluralize.underscore %>
15
+
16
+ extend RoleClass::ClassMethods
17
+ end
@@ -0,0 +1,6 @@
1
+ class <%= user_role_class %>
2
+ include DataMapper::Resource
3
+
4
+ belongs_to :<%= user_class.underscore %>, '<%= user_class %>', :key => true
5
+ belongs_to :<%= role_class.underscore %>, '<%= role_class %>', :key => true
6
+ end
@@ -0,0 +1,14 @@
1
+ class <%= role_class %>
2
+ include DataMapper::Resource
3
+
4
+ def self.named role_names
5
+ where(:name.in => role_names.flatten)
6
+ end
7
+
8
+ property :id, Serial
9
+ property :name, String
10
+
11
+ validates_uniqueness_of :name
12
+
13
+ extend RoleClass::ClassMethods
14
+ end
@@ -20,13 +20,69 @@ module Roles
20
20
  :role_string => "property :role_string, String",
21
21
  :roles_string => "property :roles_string, String"
22
22
  }
23
+
24
+ def valid_single_strategies
25
+ [:admin_flag, :one_role, :role_string]
26
+ end
27
+
28
+ def valid_multi_strategies
29
+ [:many_roles, :roles_mask]
30
+ end
31
+
32
+ def valid_strategies
33
+ valid_single_strategies + valid_multi_strategies
34
+ end
23
35
 
24
- def strategy name, options=nil
36
+ def strategy name, options={}
37
+ strategy_name = name.to_sym
38
+ raise ArgumentError, "Unknown role strategy #{strategy_name}" if !valid_strategies.include? strategy_name
39
+
40
+ use_roles_strategy strategy_name
41
+
42
+ set_role_class(strategy_name, options) if strategies_with_role_class.include? strategy_name
43
+
25
44
  if options == :default && MAP[name]
26
45
  instance_eval MAP[name]
27
46
  end
47
+
28
48
  set_role_strategy name, options
29
- end
49
+ end
50
+
51
+ private
52
+
53
+ def set_role_class strategy_name, options = {}
54
+ @role_class_name = !options.kind_of?(Symbol) ? get_role_class(strategy_name, options) : default_role_class(strategy_name)
55
+ end
56
+
57
+ def default_options? options = {}
58
+ return true if options == :default
59
+ if options.kind_of? Hash
60
+ return true # if options[:config] == :default || options == {}
61
+ end
62
+ false
63
+ end
64
+
65
+ def statement code_str
66
+ code_str.gsub /Role/, @role_class_name.to_s
67
+ end
68
+
69
+ def default_role_class strategy_name
70
+ if defined? ::Role
71
+ require "roles_data_mapper/role_class"
72
+ return ::Role
73
+ end
74
+ raise "Default Role class not defined"
75
+ end
76
+
77
+ def strategies_with_role_class
78
+ # :embed_one_role, :embed_many_roles
79
+ [:one_role, :many_roles]
80
+ end
81
+
82
+ def get_role_class strategy_name, options
83
+ options[:role_class] ? options[:role_class].to_s.camelize.constantize : default_role_class(strategy_name)
84
+ end
85
+
30
86
  end
31
87
  end
32
88
  end
@@ -13,15 +13,8 @@ module Roles::Base
13
13
  end
14
14
  end
15
15
 
16
- class Role
17
- include DataMapper::Resource
18
-
19
- property :id, Serial
20
- property :name, String
21
-
22
- validates_uniqueness_of :name
23
-
24
- class << self
16
+ module RoleClass
17
+ module ClassMethods
25
18
  def find_roles(*role_names)
26
19
  all(:name => role_names.flatten)
27
20
  end
@@ -32,4 +25,5 @@ class Role
32
25
  res ? res.first : res
33
26
  end
34
27
  end
35
- end
28
+ end
29
+
@@ -0,0 +1,14 @@
1
+ class Role
2
+ include DataMapper::Resource
3
+
4
+ def self.named role_names
5
+ where(:name.in => role_names.flatten)
6
+ end
7
+
8
+ property :id, Serial
9
+ property :name, String
10
+
11
+ validates_uniqueness_of :name
12
+
13
+ extend RoleClass::ClassMethods
14
+ end
@@ -1,11 +1,8 @@
1
1
  require 'roles_data_mapper/strategy/multi'
2
2
 
3
+ # TODO: Refactor into strategy method to make generic and not hardcoded names and model linking
3
4
  class Role
4
- def self.named role_names
5
- where(:name.in => role_names.flatten)
6
- end
7
-
8
- property :id, Serial
5
+ include DataMapper::Resource
9
6
  has n, :user_roles
10
7
  has n, :users, :through => :user_roles
11
8
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_data_mapper}
8
- s.version = "0.2.2"
8
+ s.version = "0.3.0"
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-01}
13
13
  s.description = %q{Makes it easy to set a role strategy on your User model in DataMapper}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -20,15 +20,20 @@ Gem::Specification.new do |s|
20
20
  ".document",
21
21
  ".rspec",
22
22
  "Changelog.textile",
23
+ "Gemfile",
23
24
  "LICENSE",
24
25
  "README.markdown",
25
26
  "Rakefile",
26
27
  "VERSION",
27
28
  "lib/generators/data_mapper/roles/roles_generator.rb",
29
+ "lib/generators/data_mapper/roles/templates/many_roles/role.rb",
30
+ "lib/generators/data_mapper/roles/templates/many_roles/user_role.rb",
31
+ "lib/generators/data_mapper/roles/templates/one_role/role.rb",
28
32
  "lib/roles_data_mapper.rb",
29
33
  "lib/roles_data_mapper/base.rb",
30
34
  "lib/roles_data_mapper/namespaces.rb",
31
35
  "lib/roles_data_mapper/role.rb",
36
+ "lib/roles_data_mapper/role_class.rb",
32
37
  "lib/roles_data_mapper/strategy.rb",
33
38
  "lib/roles_data_mapper/strategy/multi.rb",
34
39
  "lib/roles_data_mapper/strategy/multi/many_roles.rb",
@@ -73,6 +78,17 @@ Gem::Specification.new do |s|
73
78
  s.specification_version = 3
74
79
 
75
80
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
81
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.1"])
82
+ s.add_runtime_dependency(%q<sugar-high>, ["~> 0.3.0"])
83
+ s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
84
+ s.add_runtime_dependency(%q<roles_generic>, ["~> 0.3.2"])
85
+ s.add_runtime_dependency(%q<rails3_artifactor>, [">= 0.3.1"])
86
+ s.add_runtime_dependency(%q<logging_assist>, [">= 0.1.6"])
87
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.0"])
88
+ s.add_runtime_dependency(%q<dm-types>, ["~> 1.0"])
89
+ s.add_runtime_dependency(%q<dm-migrations>, ["~> 1.0"])
90
+ s.add_runtime_dependency(%q<dm-validations>, ["~> 1.0"])
91
+ s.add_runtime_dependency(%q<dm-sqlite-adapter>, ["~> 1.0"])
76
92
  s.add_development_dependency(%q<rspec>, [">= 2.0.1"])
77
93
  s.add_runtime_dependency(%q<dm-core>, ["~> 1.0"])
78
94
  s.add_runtime_dependency(%q<dm-types>, ["~> 1.0"])
@@ -85,6 +101,17 @@ Gem::Specification.new do |s|
85
101
  s.add_runtime_dependency(%q<rails3_artifactor>, [">= 0.3.2"])
86
102
  s.add_runtime_dependency(%q<logging_assist>, [">= 0.1.6"])
87
103
  else
104
+ s.add_dependency(%q<activesupport>, [">= 3.0.1"])
105
+ s.add_dependency(%q<sugar-high>, ["~> 0.3.0"])
106
+ s.add_dependency(%q<require_all>, ["~> 1.2.0"])
107
+ s.add_dependency(%q<roles_generic>, ["~> 0.3.2"])
108
+ s.add_dependency(%q<rails3_artifactor>, [">= 0.3.1"])
109
+ s.add_dependency(%q<logging_assist>, [">= 0.1.6"])
110
+ s.add_dependency(%q<dm-core>, ["~> 1.0"])
111
+ s.add_dependency(%q<dm-types>, ["~> 1.0"])
112
+ s.add_dependency(%q<dm-migrations>, ["~> 1.0"])
113
+ s.add_dependency(%q<dm-validations>, ["~> 1.0"])
114
+ s.add_dependency(%q<dm-sqlite-adapter>, ["~> 1.0"])
88
115
  s.add_dependency(%q<rspec>, [">= 2.0.1"])
89
116
  s.add_dependency(%q<dm-core>, ["~> 1.0"])
90
117
  s.add_dependency(%q<dm-types>, ["~> 1.0"])
@@ -98,6 +125,17 @@ Gem::Specification.new do |s|
98
125
  s.add_dependency(%q<logging_assist>, [">= 0.1.6"])
99
126
  end
100
127
  else
128
+ s.add_dependency(%q<activesupport>, [">= 3.0.1"])
129
+ s.add_dependency(%q<sugar-high>, ["~> 0.3.0"])
130
+ s.add_dependency(%q<require_all>, ["~> 1.2.0"])
131
+ s.add_dependency(%q<roles_generic>, ["~> 0.3.2"])
132
+ s.add_dependency(%q<rails3_artifactor>, [">= 0.3.1"])
133
+ s.add_dependency(%q<logging_assist>, [">= 0.1.6"])
134
+ s.add_dependency(%q<dm-core>, ["~> 1.0"])
135
+ s.add_dependency(%q<dm-types>, ["~> 1.0"])
136
+ s.add_dependency(%q<dm-migrations>, ["~> 1.0"])
137
+ s.add_dependency(%q<dm-validations>, ["~> 1.0"])
138
+ s.add_dependency(%q<dm-sqlite-adapter>, ["~> 1.0"])
101
139
  s.add_dependency(%q<rspec>, [">= 2.0.1"])
102
140
  s.add_dependency(%q<dm-core>, ["~> 1.0"])
103
141
  s.add_dependency(%q<dm-types>, ["~> 1.0"])
@@ -1,8 +1,11 @@
1
1
  require 'generator_spec_helper'
2
- require_generator :data_mapper => :roles
2
+
3
+ # require_generator :data_mapper => :roles
4
+ require 'generators/data_mapper/roles/roles_generator'
3
5
 
4
6
  # root_dir = Rails3::Assist::Directory.rails_root
5
- root_dir = File.join(Rails.application.config.root_dir, 'rails')
7
+ # root_dir = File.join(Rails.application.config.root_dir, 'rails')
8
+ root_dir = Rails.root
6
9
 
7
10
  describe 'role strategy generator: admin_flag' do
8
11
  describe 'ORM: data_mapper' do
@@ -48,7 +51,7 @@ describe 'role strategy generator: admin_flag' do
48
51
  clazz.should include_module 'DataMapper::Resource'
49
52
  clazz.should include_module 'Roles::DataMapper'
50
53
  clazz.should have_call :valid_roles_are, :args => ':admin, :guest, :user'
51
- clazz.should have_call :role_class, :args => ":role"
54
+ # clazz.should have_call :role_class, :args => ":role"
52
55
  clazz.should have_call :strategy, :args => ":one_role"
53
56
  end
54
57
  end
@@ -1,12 +1,10 @@
1
1
  require 'spec_helper'
2
- use_roles_strategy :many_roles
3
2
 
4
3
  class User
5
4
  include DataMapper::Resource
6
5
  include Roles::DataMapper
7
6
 
8
- strategy :many_roles, :default
9
- role_class :role
7
+ strategy :many_roles
10
8
 
11
9
  property :id, Serial
12
10
  property :name, String
@@ -17,14 +15,6 @@ DataMapper.auto_migrate!
17
15
 
18
16
  User.valid_roles_are :admin, :guest, :user
19
17
 
20
- # def api_migrate
21
- # migrate('many_roles')
22
- # end
23
- #
24
- # def api_fixture
25
- # load 'fixtures/many_roles_setup.rb'
26
- # end
27
-
28
18
  def api_name
29
19
  :many_roles
30
20
  end
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
- use_roles_strategy :one_role
3
2
 
4
3
  class User
5
4
  include DataMapper::Resource
6
5
  include Roles::DataMapper
7
6
 
8
- strategy :one_role, :default
9
- role_class :role
7
+ strategy :one_role
8
+
10
9
  property :id, Serial
11
10
  property :name, String
12
11
  end
@@ -16,10 +15,6 @@ DataMapper.auto_migrate!
16
15
 
17
16
  User.valid_roles_are :admin, :guest, :user
18
17
 
19
- # def api_migrate
20
- # migrate('roles_mask')
21
- # end
22
-
23
18
  def api_name
24
19
  :one_role
25
20
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 2
9
- version: 0.2.2
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,13 +14,172 @@ 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-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: rspec
22
- prerelease: false
21
+ name: activesupport
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 3
29
+ - 0
30
+ - 1
31
+ version: 3.0.1
32
+ type: :runtime
33
+ prerelease: false
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: sugar-high
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 3
45
+ - 0
46
+ version: 0.3.0
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: require_all
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 1
59
+ - 2
60
+ - 0
61
+ version: 1.2.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: roles_generic
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ - 3
75
+ - 2
76
+ version: 0.3.2
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: rails3_artifactor
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ - 3
90
+ - 1
91
+ version: 0.3.1
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: logging_assist
97
+ requirement: &id006 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ - 1
105
+ - 6
106
+ version: 0.1.6
107
+ type: :runtime
108
+ prerelease: false
109
+ version_requirements: *id006
110
+ - !ruby/object:Gem::Dependency
111
+ name: dm-core
112
+ requirement: &id007 !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 1
119
+ - 0
120
+ version: "1.0"
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: *id007
124
+ - !ruby/object:Gem::Dependency
125
+ name: dm-types
126
+ requirement: &id008 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ segments:
132
+ - 1
133
+ - 0
134
+ version: "1.0"
135
+ type: :runtime
136
+ prerelease: false
137
+ version_requirements: *id008
138
+ - !ruby/object:Gem::Dependency
139
+ name: dm-migrations
140
+ requirement: &id009 !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ segments:
146
+ - 1
147
+ - 0
148
+ version: "1.0"
149
+ type: :runtime
150
+ prerelease: false
151
+ version_requirements: *id009
152
+ - !ruby/object:Gem::Dependency
153
+ name: dm-validations
154
+ requirement: &id010 !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ segments:
160
+ - 1
161
+ - 0
162
+ version: "1.0"
163
+ type: :runtime
164
+ prerelease: false
165
+ version_requirements: *id010
166
+ - !ruby/object:Gem::Dependency
167
+ name: dm-sqlite-adapter
168
+ requirement: &id011 !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ segments:
174
+ - 1
175
+ - 0
176
+ version: "1.0"
177
+ type: :runtime
178
+ prerelease: false
179
+ version_requirements: *id011
180
+ - !ruby/object:Gem::Dependency
181
+ name: rspec
182
+ requirement: &id012 !ruby/object:Gem::Requirement
24
183
  none: false
25
184
  requirements:
26
185
  - - ">="
@@ -31,11 +190,11 @@ dependencies:
31
190
  - 1
32
191
  version: 2.0.1
33
192
  type: :development
34
- version_requirements: *id001
193
+ prerelease: false
194
+ version_requirements: *id012
35
195
  - !ruby/object:Gem::Dependency
36
196
  name: dm-core
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
197
+ requirement: &id013 !ruby/object:Gem::Requirement
39
198
  none: false
40
199
  requirements:
41
200
  - - ~>
@@ -45,11 +204,11 @@ dependencies:
45
204
  - 0
46
205
  version: "1.0"
47
206
  type: :runtime
48
- version_requirements: *id002
207
+ prerelease: false
208
+ version_requirements: *id013
49
209
  - !ruby/object:Gem::Dependency
50
210
  name: dm-types
51
- prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
211
+ requirement: &id014 !ruby/object:Gem::Requirement
53
212
  none: false
54
213
  requirements:
55
214
  - - ~>
@@ -59,11 +218,11 @@ dependencies:
59
218
  - 0
60
219
  version: "1.0"
61
220
  type: :runtime
62
- version_requirements: *id003
221
+ prerelease: false
222
+ version_requirements: *id014
63
223
  - !ruby/object:Gem::Dependency
64
224
  name: dm-migrations
65
- prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
225
+ requirement: &id015 !ruby/object:Gem::Requirement
67
226
  none: false
68
227
  requirements:
69
228
  - - ~>
@@ -73,11 +232,11 @@ dependencies:
73
232
  - 0
74
233
  version: "1.0"
75
234
  type: :runtime
76
- version_requirements: *id004
235
+ prerelease: false
236
+ version_requirements: *id015
77
237
  - !ruby/object:Gem::Dependency
78
238
  name: dm-validations
79
- prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
239
+ requirement: &id016 !ruby/object:Gem::Requirement
81
240
  none: false
82
241
  requirements:
83
242
  - - ~>
@@ -87,11 +246,11 @@ dependencies:
87
246
  - 0
88
247
  version: "1.0"
89
248
  type: :runtime
90
- version_requirements: *id005
249
+ prerelease: false
250
+ version_requirements: *id016
91
251
  - !ruby/object:Gem::Dependency
92
252
  name: activesupport
93
- prerelease: false
94
- requirement: &id006 !ruby/object:Gem::Requirement
253
+ requirement: &id017 !ruby/object:Gem::Requirement
95
254
  none: false
96
255
  requirements:
97
256
  - - ">="
@@ -102,11 +261,11 @@ dependencies:
102
261
  - 1
103
262
  version: 3.0.1
104
263
  type: :runtime
105
- version_requirements: *id006
264
+ prerelease: false
265
+ version_requirements: *id017
106
266
  - !ruby/object:Gem::Dependency
107
267
  name: require_all
108
- prerelease: false
109
- requirement: &id007 !ruby/object:Gem::Requirement
268
+ requirement: &id018 !ruby/object:Gem::Requirement
110
269
  none: false
111
270
  requirements:
112
271
  - - ~>
@@ -117,11 +276,11 @@ dependencies:
117
276
  - 0
118
277
  version: 1.2.0
119
278
  type: :runtime
120
- version_requirements: *id007
279
+ prerelease: false
280
+ version_requirements: *id018
121
281
  - !ruby/object:Gem::Dependency
122
282
  name: sugar-high
123
- prerelease: false
124
- requirement: &id008 !ruby/object:Gem::Requirement
283
+ requirement: &id019 !ruby/object:Gem::Requirement
125
284
  none: false
126
285
  requirements:
127
286
  - - ">="
@@ -132,11 +291,11 @@ dependencies:
132
291
  - 1
133
292
  version: 0.3.1
134
293
  type: :runtime
135
- version_requirements: *id008
294
+ prerelease: false
295
+ version_requirements: *id019
136
296
  - !ruby/object:Gem::Dependency
137
297
  name: roles_generic
138
- prerelease: false
139
- requirement: &id009 !ruby/object:Gem::Requirement
298
+ requirement: &id020 !ruby/object:Gem::Requirement
140
299
  none: false
141
300
  requirements:
142
301
  - - ">="
@@ -147,11 +306,11 @@ dependencies:
147
306
  - 2
148
307
  version: 0.3.2
149
308
  type: :runtime
150
- version_requirements: *id009
309
+ prerelease: false
310
+ version_requirements: *id020
151
311
  - !ruby/object:Gem::Dependency
152
312
  name: rails3_artifactor
153
- prerelease: false
154
- requirement: &id010 !ruby/object:Gem::Requirement
313
+ requirement: &id021 !ruby/object:Gem::Requirement
155
314
  none: false
156
315
  requirements:
157
316
  - - ">="
@@ -162,11 +321,11 @@ dependencies:
162
321
  - 2
163
322
  version: 0.3.2
164
323
  type: :runtime
165
- version_requirements: *id010
324
+ prerelease: false
325
+ version_requirements: *id021
166
326
  - !ruby/object:Gem::Dependency
167
327
  name: logging_assist
168
- prerelease: false
169
- requirement: &id011 !ruby/object:Gem::Requirement
328
+ requirement: &id022 !ruby/object:Gem::Requirement
170
329
  none: false
171
330
  requirements:
172
331
  - - ">="
@@ -177,7 +336,8 @@ dependencies:
177
336
  - 6
178
337
  version: 0.1.6
179
338
  type: :runtime
180
- version_requirements: *id011
339
+ prerelease: false
340
+ version_requirements: *id022
181
341
  description: Makes it easy to set a role strategy on your User model in DataMapper
182
342
  email: kmandrup@gmail.com
183
343
  executables: []
@@ -191,15 +351,20 @@ files:
191
351
  - .document
192
352
  - .rspec
193
353
  - Changelog.textile
354
+ - Gemfile
194
355
  - LICENSE
195
356
  - README.markdown
196
357
  - Rakefile
197
358
  - VERSION
198
359
  - lib/generators/data_mapper/roles/roles_generator.rb
360
+ - lib/generators/data_mapper/roles/templates/many_roles/role.rb
361
+ - lib/generators/data_mapper/roles/templates/many_roles/user_role.rb
362
+ - lib/generators/data_mapper/roles/templates/one_role/role.rb
199
363
  - lib/roles_data_mapper.rb
200
364
  - lib/roles_data_mapper/base.rb
201
365
  - lib/roles_data_mapper/namespaces.rb
202
366
  - lib/roles_data_mapper/role.rb
367
+ - lib/roles_data_mapper/role_class.rb
203
368
  - lib/roles_data_mapper/strategy.rb
204
369
  - lib/roles_data_mapper/strategy/multi.rb
205
370
  - lib/roles_data_mapper/strategy/multi/many_roles.rb