roles_active_record 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -7
- data/VERSION +1 -1
- data/lib/generators/active_record/roles/roles_generator.rb +2 -2
- data/lib/generators/active_record/roles_migration/roles_migration_generator.rb +5 -2
- data/lib/roles_active_record/base.rb +1 -1
- data/roles_active_record.gemspec +11 -3
- metadata +48 -4
- data/lib/generators/active_record/setup/setup_generator.rb +0 -40
data/Rakefile
CHANGED
@@ -11,13 +11,16 @@ begin
|
|
11
11
|
gem.add_development_dependency 'database_cleaner', '~> 0.5.2'
|
12
12
|
gem.add_development_dependency "generator-spec", '~> 0.6.5'
|
13
13
|
|
14
|
-
gem.add_dependency "activerecord",
|
15
|
-
gem.add_dependency "activesupport",
|
16
|
-
gem.add_dependency "arel",
|
17
|
-
gem.add_dependency "meta_where",
|
18
|
-
gem.add_dependency "sugar-high",
|
19
|
-
gem.add_dependency "require_all",
|
20
|
-
gem.add_dependency "roles_generic",
|
14
|
+
gem.add_dependency "activerecord", "~> 3.0.0"
|
15
|
+
gem.add_dependency "activesupport", "~> 3.0.0"
|
16
|
+
gem.add_dependency "arel", "~> 1.0.0"
|
17
|
+
gem.add_dependency "meta_where", "~> 0.9.3"
|
18
|
+
gem.add_dependency "sugar-high", "~> 0.2.11"
|
19
|
+
gem.add_dependency "require_all", '~> 1.2.0'
|
20
|
+
gem.add_dependency "roles_generic", '~> 0.2.5'
|
21
|
+
gem.add_dependency 'rails3_artifactor', '>= 0.2.6'
|
22
|
+
gem.add_dependency 'logging_assist', '>= 0.1.5'
|
23
|
+
gem.add_dependency 'migration_assist', '>= 0.1.5'
|
21
24
|
|
22
25
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
23
26
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -16,8 +16,8 @@ module ActiveRecord
|
|
16
16
|
|
17
17
|
|
18
18
|
def apply_role_strategy
|
19
|
-
|
20
|
-
|
19
|
+
# logger.add_logfile
|
20
|
+
# logger.debug "apply_role_strategy for : #{strategy} in model #{name}"
|
21
21
|
begin
|
22
22
|
insert_into_model name do
|
23
23
|
insertion_text
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'migration_assist'
|
2
|
+
require 'logging_assist'
|
2
3
|
|
3
4
|
module ActiveRecord
|
4
5
|
module Generators
|
5
6
|
class RolesMigrationGenerator < Rails::Generators::NamedBase
|
6
|
-
include
|
7
|
+
include Rails3::Migration::Assist
|
7
8
|
|
8
9
|
desc "Generates user role migrations"
|
9
10
|
|
@@ -20,7 +21,7 @@ module ActiveRecord
|
|
20
21
|
|
21
22
|
def valid_strategy?
|
22
23
|
if !strategies.include?(strategy.to_sym)
|
23
|
-
info "Unknown role strategy #{strategy}"
|
24
|
+
logger.info "Unknown role strategy #{strategy}"
|
24
25
|
raise ArgumentError, "Unknown role strategy #{strategy}"
|
25
26
|
end
|
26
27
|
end
|
@@ -35,6 +36,8 @@ module ActiveRecord
|
|
35
36
|
|
36
37
|
protected
|
37
38
|
|
39
|
+
include Rails::Assist::BasicLogging
|
40
|
+
|
38
41
|
def strategies
|
39
42
|
[:admin_flag, :role_string, :one_role, :many_roles, :roles_mask]
|
40
43
|
end
|
data/roles_active_record.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{roles_active_record}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.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-10-
|
12
|
+
s.date = %q{2010-10-11}
|
13
13
|
s.description = %q{Makes it easy to set a role strategy on your User model in Active Record}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,7 +33,6 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/generators/active_record/roles_migration/templates/add_one_role_strategy.erb",
|
34
34
|
"lib/generators/active_record/roles_migration/templates/add_role_string_strategy.erb",
|
35
35
|
"lib/generators/active_record/roles_migration/templates/add_roles_mask_strategy.erb",
|
36
|
-
"lib/generators/active_record/setup/setup_generator.rb",
|
37
36
|
"lib/roles_active_record.rb",
|
38
37
|
"lib/roles_active_record/base.rb",
|
39
38
|
"lib/roles_active_record/namespaces.rb",
|
@@ -143,6 +142,9 @@ Gem::Specification.new do |s|
|
|
143
142
|
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.11"])
|
144
143
|
s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
|
145
144
|
s.add_runtime_dependency(%q<roles_generic>, ["~> 0.2.5"])
|
145
|
+
s.add_runtime_dependency(%q<rails3_artifactor>, [">= 0.2.6"])
|
146
|
+
s.add_runtime_dependency(%q<logging_assist>, [">= 0.1.5"])
|
147
|
+
s.add_runtime_dependency(%q<migration_assist>, [">= 0.1.5"])
|
146
148
|
else
|
147
149
|
s.add_dependency(%q<rspec>, [">= 2.0.0.rc"])
|
148
150
|
s.add_dependency(%q<database_cleaner>, ["~> 0.5.2"])
|
@@ -154,6 +156,9 @@ Gem::Specification.new do |s|
|
|
154
156
|
s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
|
155
157
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
156
158
|
s.add_dependency(%q<roles_generic>, ["~> 0.2.5"])
|
159
|
+
s.add_dependency(%q<rails3_artifactor>, [">= 0.2.6"])
|
160
|
+
s.add_dependency(%q<logging_assist>, [">= 0.1.5"])
|
161
|
+
s.add_dependency(%q<migration_assist>, [">= 0.1.5"])
|
157
162
|
end
|
158
163
|
else
|
159
164
|
s.add_dependency(%q<rspec>, [">= 2.0.0.rc"])
|
@@ -166,6 +171,9 @@ Gem::Specification.new do |s|
|
|
166
171
|
s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
|
167
172
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
168
173
|
s.add_dependency(%q<roles_generic>, ["~> 0.2.5"])
|
174
|
+
s.add_dependency(%q<rails3_artifactor>, [">= 0.2.6"])
|
175
|
+
s.add_dependency(%q<logging_assist>, [">= 0.1.5"])
|
176
|
+
s.add_dependency(%q<migration_assist>, [">= 0.1.5"])
|
169
177
|
end
|
170
178
|
end
|
171
179
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.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-10-
|
17
|
+
date: 2010-10-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -168,6 +168,51 @@ dependencies:
|
|
168
168
|
version: 0.2.5
|
169
169
|
type: :runtime
|
170
170
|
version_requirements: *id010
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
name: rails3_artifactor
|
173
|
+
prerelease: false
|
174
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
175
|
+
none: false
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
segments:
|
180
|
+
- 0
|
181
|
+
- 2
|
182
|
+
- 6
|
183
|
+
version: 0.2.6
|
184
|
+
type: :runtime
|
185
|
+
version_requirements: *id011
|
186
|
+
- !ruby/object:Gem::Dependency
|
187
|
+
name: logging_assist
|
188
|
+
prerelease: false
|
189
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
190
|
+
none: false
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
segments:
|
195
|
+
- 0
|
196
|
+
- 1
|
197
|
+
- 5
|
198
|
+
version: 0.1.5
|
199
|
+
type: :runtime
|
200
|
+
version_requirements: *id012
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: migration_assist
|
203
|
+
prerelease: false
|
204
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
205
|
+
none: false
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
segments:
|
210
|
+
- 0
|
211
|
+
- 1
|
212
|
+
- 5
|
213
|
+
version: 0.1.5
|
214
|
+
type: :runtime
|
215
|
+
version_requirements: *id013
|
171
216
|
description: Makes it easy to set a role strategy on your User model in Active Record
|
172
217
|
email: kmandrup@gmail.com
|
173
218
|
executables: []
|
@@ -194,7 +239,6 @@ files:
|
|
194
239
|
- lib/generators/active_record/roles_migration/templates/add_one_role_strategy.erb
|
195
240
|
- lib/generators/active_record/roles_migration/templates/add_role_string_strategy.erb
|
196
241
|
- lib/generators/active_record/roles_migration/templates/add_roles_mask_strategy.erb
|
197
|
-
- lib/generators/active_record/setup/setup_generator.rb
|
198
242
|
- lib/roles_active_record.rb
|
199
243
|
- lib/roles_active_record/base.rb
|
200
244
|
- lib/roles_active_record/namespaces.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'generators/migration_helper'
|
2
|
-
require 'generators/role_migrations'
|
3
|
-
require 'auth_assistant/model/user_config'
|
4
|
-
|
5
|
-
module AuthAssistant
|
6
|
-
module Generators
|
7
|
-
class SetupGenerator < Rails::Generators::NamedBase
|
8
|
-
desc "Sets up Devise Users and creates Role migrations"
|
9
|
-
|
10
|
-
class_option :devise, :type => :boolean, :aliases => "-d", :default => false,
|
11
|
-
:desc => "Initialize devise."
|
12
|
-
|
13
|
-
class_option :admin, :type => :boolean, :aliases => "-a", :default => false,
|
14
|
-
:desc => "Create admin user."
|
15
|
-
|
16
|
-
|
17
|
-
class_option :migration, :type => :boolean, :aliases => "-m", :default => true,
|
18
|
-
:desc => "To generate a user role migration."
|
19
|
-
|
20
|
-
hook_for :orm
|
21
|
-
|
22
|
-
def self.source_root
|
23
|
-
@source_root ||= File.expand_path("../../templates", __FILE__)
|
24
|
-
end
|
25
|
-
|
26
|
-
def run_migration
|
27
|
-
clear_relations :user
|
28
|
-
return nil if !options[:migration]
|
29
|
-
clazz = AuthAssist::RoleMigrations.clazz(name)
|
30
|
-
mig_obj = clazz.new(self)
|
31
|
-
mig_obj.run_migration if mig_obj.respond_to? :run_migration
|
32
|
-
mig_obj.configure if mig_obj.respond_to? :configure
|
33
|
-
end
|
34
|
-
|
35
|
-
protected
|
36
|
-
include ::AuthAssist::MigrationHelper
|
37
|
-
include ::AuthAssist::RoleMigrations
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|