roles 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc
CHANGED
@@ -8,19 +8,18 @@ module Roles
|
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
9
9
|
argument :role_cname, :type => :string, :default => "Role"
|
10
10
|
argument :user_cname, :type => :string, :default => "User"
|
11
|
-
argument :orm_adapter, :type => :string, :default => "active_record"
|
12
11
|
|
13
12
|
desc "Generates a model with the given NAME and a migration file."
|
14
13
|
|
15
14
|
def generate_role
|
16
|
-
template "role
|
15
|
+
template "role-active_record.rb", "app/models/#{role_cname.underscore}.rb"
|
17
16
|
inject_into_file(model_path, :after => inject_roles_method) do
|
18
|
-
"
|
17
|
+
" rolify" + (role_cname == "Role" ? "" : " :role_cname => '#{role_cname.camelize}'") + "\n"
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
21
|
def copy_role_file
|
23
|
-
migration_template "migration.rb", "db/migrate/roles_create_#{role_cname.tableize}"
|
22
|
+
migration_template "migration.rb", "db/migrate/roles_create_#{role_cname.tableize}"
|
24
23
|
end
|
25
24
|
|
26
25
|
def model_path
|
@@ -32,15 +31,11 @@ module Roles
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def show_readme
|
35
|
-
readme "README
|
34
|
+
readme "README-active_record" if behavior == :invoke
|
36
35
|
end
|
37
36
|
|
38
37
|
def inject_roles_method
|
39
|
-
|
40
|
-
/class #{user_cname.camelize}\n|class #{user_cname.camelize} .*\n/
|
41
|
-
else
|
42
|
-
/include Mongoid::Document\n|include Mongoid::Document .*\n/
|
43
|
-
end
|
38
|
+
/class #{user_cname.camelize}\n|class #{user_cname.camelize} .*\n/
|
44
39
|
end
|
45
40
|
end
|
46
41
|
end
|
data/lib/roles/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|