has_roles 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,10 @@
1
1
  == master
2
2
 
3
+ == 0.3.1 / 2010-03-07
4
+
5
+ * Add a generator for db migrations
6
+ * Release gems via rake-gemcutter instead of rubyforge
7
+
3
8
  == 0.3.0 / 2009-04-30
4
9
 
5
10
  * Improve permission lookup performance
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2009 Aaron Pfeifer
1
+ Copyright (c) 2006-2010 Aaron Pfeifer
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -33,6 +33,17 @@ of a controller and action.
33
33
  Note that this is a reference implementation and, most likely, should be
34
34
  modified for your own usage.
35
35
 
36
+ === Installation
37
+
38
+ +has_roles+ requires additional database tables to work. You can generate
39
+ a migration for these tables like so:
40
+
41
+ script/generate has_roles
42
+
43
+ Then simply migrate your database:
44
+
45
+ rake db:migrate
46
+
36
47
  === Adding permissions
37
48
 
38
49
  To add permissions, you can create an initializer like so:
@@ -89,4 +100,4 @@ To run against a specific version of Rails:
89
100
  == Dependencies
90
101
 
91
102
  * Rails 2.3 or later
92
- * enumerate_by[http://github.com/pluginaweek/enumerate_by]
103
+ * enumerate_by[http://github.com/pluginaweek/enumerate_by] 0.4.0 or later
data/Rakefile CHANGED
@@ -1,15 +1,17 @@
1
+ require 'rubygems'
2
+ require 'rake'
1
3
  require 'rake/testtask'
2
4
  require 'rake/rdoctask'
3
5
  require 'rake/gempackagetask'
4
- require 'rake/contrib/sshpublisher'
5
6
 
6
7
  spec = Gem::Specification.new do |s|
7
8
  s.name = 'has_roles'
8
- s.version = '0.3.0'
9
+ s.version = '0.3.1'
9
10
  s.platform = Gem::Platform::RUBY
10
- s.summary = 'Demonstrates a reference implementation for handling role management'
11
+ s.summary = 'Demonstrates a reference implementation for handling role management in ActiveRecord'
12
+ s.description = s.summary
11
13
 
12
- s.files = FileList['{app,db,lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
14
+ s.files = FileList['{app,generators,lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
13
15
  s.require_path = 'lib'
14
16
  s.has_rdoc = true
15
17
  s.test_files = Dir['test/**/*_test.rb']
@@ -53,20 +55,27 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
53
55
  rdoc.options << '--line-numbers' << '--inline-source'
54
56
  rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'LICENSE', 'lib/**/*.rb', 'app/**/*.rb')
55
57
  end
56
-
58
+
59
+ desc 'Generate a gemspec file.'
60
+ task :gemspec do
61
+ File.open("#{spec.name}.gemspec", 'w') do |f|
62
+ f.write spec.to_ruby
63
+ end
64
+ end
65
+
57
66
  Rake::GemPackageTask.new(spec) do |p|
58
67
  p.gem_spec = spec
59
- p.need_tar = true
60
- p.need_zip = true
61
68
  end
62
69
 
63
70
  desc 'Publish the beta gem.'
64
71
  task :pgem => [:package] do
72
+ require 'rake/contrib/sshpublisher'
65
73
  Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{spec.name}-#{spec.version}.gem").upload
66
74
  end
67
75
 
68
76
  desc 'Publish the API documentation.'
69
77
  task :pdoc => [:rdoc] do
78
+ require 'rake/contrib/sshpublisher'
70
79
  Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{spec.name}", 'rdoc').upload
71
80
  end
72
81
 
@@ -75,15 +84,8 @@ task :publish => [:pgem, :pdoc, :release]
75
84
 
76
85
  desc 'Publish the release files to RubyForge.'
77
86
  task :release => [:gem, :package] do
78
- require 'rubyforge'
79
-
80
- ruby_forge = RubyForge.new.configure
81
- ruby_forge.login
87
+ require 'rake/gemcutter'
82
88
 
83
- %w(gem tgz zip).each do |ext|
84
- file = "pkg/#{spec.name}-#{spec.version}.#{ext}"
85
- puts "Releasing #{File.basename(file)}..."
86
-
87
- ruby_forge.add_release(spec.rubyforge_project, spec.name, spec.version, file)
88
- end
89
+ Rake::Gemcutter::Tasks.new(spec)
90
+ Rake::Task['gem:push'].invoke
89
91
  end
@@ -0,0 +1,5 @@
1
+ Usage:
2
+
3
+ script/generate has_roles
4
+
5
+ This will create migrations that will add the proper tables to store roles.
@@ -0,0 +1,13 @@
1
+ class HasRolesGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.migration_template '001_create_permissions.rb', 'db/migrate', :migration_file_name => 'create_permissions'
5
+ m.sleep 1
6
+ m.migration_template '002_create_roles.rb', 'db/migrate', :migration_file_name => 'create_roles'
7
+ m.sleep 1
8
+ m.migration_template '003_create_role_permissions.rb', 'db/migrate', :migration_file_name => 'create_role_permissions'
9
+ m.sleep 1
10
+ m.migration_template '004_create_role_assignments.rb', 'db/migrate', :migration_file_name => 'create_role_assignments'
11
+ end
12
+ end
13
+ end
@@ -1,12 +1,12 @@
1
1
  class MigrateHasRolesToVersion4 < ActiveRecord::Migration
2
2
  def self.up
3
- ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../db/migrate", 0).migrations.each do |migration|
3
+ ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../generators/has_roles/templates", 0).migrations.each do |migration|
4
4
  migration.migrate(:up)
5
5
  end
6
6
  end
7
7
 
8
8
  def self.down
9
- ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../db/migrate", 0).migrations.each do |migration|
9
+ ActiveRecord::Migrator.new(:down, "#{Rails.root}/../../generators/has_roles/templates", 0).migrations.each do |migration|
10
10
  migration.migrate(:down)
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_roles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Pfeifer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-30 00:00:00 -04:00
12
+ date: 2010-03-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.4.0
24
24
  version:
25
- description:
25
+ description: Demonstrates a reference implementation for handling role management in ActiveRecord
26
26
  email: aaron@pluginaweek.org
27
27
  executables: []
28
28
 
@@ -31,51 +31,39 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
34
- - app/models
35
- - app/models/role.rb
36
- - app/models/role_permission.rb
37
34
  - app/models/permission.rb
38
35
  - app/models/role_assignment.rb
39
- - db/migrate
40
- - db/migrate/003_create_role_permissions.rb
41
- - db/migrate/004_create_role_assignments.rb
42
- - db/migrate/002_create_roles.rb
43
- - db/migrate/001_create_permissions.rb
44
- - lib/has_roles
45
- - lib/has_roles/url_helper.rb
36
+ - app/models/role_permission.rb
37
+ - app/models/role.rb
38
+ - generators/has_roles/USAGE
39
+ - generators/has_roles/has_roles_generator.rb
40
+ - generators/has_roles/templates/002_create_roles.rb
41
+ - generators/has_roles/templates/004_create_role_assignments.rb
42
+ - generators/has_roles/templates/003_create_role_permissions.rb
43
+ - generators/has_roles/templates/001_create_permissions.rb
46
44
  - lib/has_roles/authorization_helper.rb
45
+ - lib/has_roles/url_helper.rb
47
46
  - lib/has_roles.rb
48
- - test/factory.rb
49
- - test/test_helper.rb
50
- - test/functional
51
- - test/functional/has_roles_test.rb
52
- - test/functional/application_controller_test.rb
53
- - test/unit
54
- - test/unit/role_test.rb
55
- - test/unit/role_assignment_test.rb
56
47
  - test/unit/role_permission_test.rb
48
+ - test/unit/role_assignment_test.rb
49
+ - test/unit/role_test.rb
57
50
  - test/unit/permission_test.rb
58
- - test/helpers
59
- - test/helpers/url_helper_test.rb
60
- - test/helpers/authorization_helper_test.rb
61
- - test/app_root
62
- - test/app_root/db
63
- - test/app_root/db/migrate
64
- - test/app_root/db/migrate/001_create_users.rb
65
51
  - test/app_root/db/migrate/002_migrate_has_roles_to_version_4.rb
66
- - test/app_root/config
67
- - test/app_root/config/environment.rb
68
- - test/app_root/config/routes.rb
69
- - test/app_root/app
70
- - test/app_root/app/controllers
71
- - test/app_root/app/controllers/home_controller.rb
72
- - test/app_root/app/controllers/application_controller.rb
73
- - test/app_root/app/controllers/admin
52
+ - test/app_root/db/migrate/001_create_users.rb
53
+ - test/app_root/app/models/user.rb
74
54
  - test/app_root/app/controllers/admin/users_controller.rb
75
55
  - test/app_root/app/controllers/admin/base_controller.rb
76
56
  - test/app_root/app/controllers/users_controller.rb
77
- - test/app_root/app/models
78
- - test/app_root/app/models/user.rb
57
+ - test/app_root/app/controllers/home_controller.rb
58
+ - test/app_root/app/controllers/application_controller.rb
59
+ - test/app_root/config/environment.rb
60
+ - test/app_root/config/routes.rb
61
+ - test/test_helper.rb
62
+ - test/factory.rb
63
+ - test/helpers/url_helper_test.rb
64
+ - test/helpers/authorization_helper_test.rb
65
+ - test/functional/has_roles_test.rb
66
+ - test/functional/application_controller_test.rb
79
67
  - CHANGELOG.rdoc
80
68
  - init.rb
81
69
  - LICENSE
@@ -83,6 +71,8 @@ files:
83
71
  - README.rdoc
84
72
  has_rdoc: true
85
73
  homepage: http://www.pluginaweek.org
74
+ licenses: []
75
+
86
76
  post_install_message:
87
77
  rdoc_options: []
88
78
 
@@ -103,16 +93,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
93
  requirements: []
104
94
 
105
95
  rubyforge_project: pluginaweek
106
- rubygems_version: 1.3.1
96
+ rubygems_version: 1.3.5
107
97
  signing_key:
108
- specification_version: 2
109
- summary: Demonstrates a reference implementation for handling role management
98
+ specification_version: 3
99
+ summary: Demonstrates a reference implementation for handling role management in ActiveRecord
110
100
  test_files:
111
- - test/functional/has_roles_test.rb
112
- - test/functional/application_controller_test.rb
113
- - test/unit/role_test.rb
114
- - test/unit/role_assignment_test.rb
115
101
  - test/unit/role_permission_test.rb
102
+ - test/unit/role_assignment_test.rb
103
+ - test/unit/role_test.rb
116
104
  - test/unit/permission_test.rb
117
105
  - test/helpers/url_helper_test.rb
118
106
  - test/helpers/authorization_helper_test.rb
107
+ - test/functional/has_roles_test.rb
108
+ - test/functional/application_controller_test.rb