acts_as_audited_rails3 1.1.1.4

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.
Files changed (39) hide show
  1. data/.gitignore +4 -0
  2. data/CHANGELOG +25 -0
  3. data/LICENSE +19 -0
  4. data/README +76 -0
  5. data/Rakefile +60 -0
  6. data/VERSION +1 -0
  7. data/acts_as_audited.gemspec +90 -0
  8. data/acts_as_audited_rails3.gemspec +90 -0
  9. data/doc/classes/Audit.html +407 -0
  10. data/doc/classes/CollectiveIdea/Acts/Audited/ClassMethods.html +226 -0
  11. data/doc/classes/CollectiveIdea/Acts/Audited/InstanceMethods.html +330 -0
  12. data/doc/classes/CollectiveIdea/Acts/Audited/SingletonMethods.html +254 -0
  13. data/doc/created.rid +1 -0
  14. data/doc/files/README.html +226 -0
  15. data/doc/files/lib/acts_as_audited/audit_rb.html +108 -0
  16. data/doc/files/lib/acts_as_audited/audit_sweeper_rb.html +101 -0
  17. data/doc/files/lib/acts_as_audited_rb.html +129 -0
  18. data/doc/fr_class_index.html +30 -0
  19. data/doc/fr_file_index.html +30 -0
  20. data/doc/fr_method_index.html +47 -0
  21. data/doc/index.html +24 -0
  22. data/doc/rdoc-style.css +208 -0
  23. data/lib/acts_as_audited/audit.rb +119 -0
  24. data/lib/acts_as_audited/audit_sweeper.rb +37 -0
  25. data/lib/acts_as_audited/base.rb +316 -0
  26. data/lib/acts_as_audited.rb +9 -0
  27. data/lib/generators/audited_migration/USAGE +7 -0
  28. data/lib/generators/audited_migration/audited_migration_generator.rb +24 -0
  29. data/lib/generators/audited_migration/templates/migration.rb +29 -0
  30. data/lib/generators/audited_migration_update/USAGE +7 -0
  31. data/lib/generators/audited_migration_update/audited_migration_update_generator.rb +24 -0
  32. data/lib/generators/audited_migration_update/templates/migration.rb +9 -0
  33. data/test/acts_as_audited_test.rb +437 -0
  34. data/test/audit_sweeper_test.rb +31 -0
  35. data/test/audit_test.rb +179 -0
  36. data/test/db/database.yml +21 -0
  37. data/test/db/schema.rb +33 -0
  38. data/test/test_helper.rb +75 -0
  39. metadata +152 -0
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ acts_as_audited_plugin.sqlite3.db
2
+ test/debug.log
3
+ coverage/
4
+ pkg
data/CHANGELOG ADDED
@@ -0,0 +1,25 @@
1
+ acts_as_audited ChangeLog
2
+ -------------------------------------------------------------------------------
3
+ * 2009-01-27 - Store old and new values for updates, and store all attributes on destroy.
4
+ Refactored revisioning methods to work as expected
5
+ * 2008-10-10 - changed to make it work in development mode
6
+ * 2008-04-19 - refactored to make compatible with dirty tracking in edge rails
7
+ and to stop storing both old and new values in a single audit
8
+ * 2008-04-18 - Fix NoMethodError when trying to access the :previous revision
9
+ on a model that doesn't have previous revisions [Alex Soto]
10
+ * 2008-03-21 - added #changed_attributes to get access to the changes before a
11
+ save [Chris Parker]
12
+ * 2007-12-16 - Added #revision_at for retrieving a revision from a specific
13
+ time [Jacob Atzen]
14
+ * 2007-12-16 - Fix error when getting revision from audit with no changes
15
+ [Geoffrey Wiseman]
16
+ * 2007-12-16 - Remove dependency on acts_as_list
17
+ * 2007-06-17 - Added support getting previous revisions
18
+ * 2006-11-17 - Replaced use of singleton User.current_user with cache sweeper
19
+ implementation for auditing the user that made the change
20
+ * 2006-11-17 - added migration generator
21
+ * 2006-08-14 - incorporated changes from Michael Schuerig to write_attribute
22
+ that saves the new value after every change and not just the
23
+ first, and performs proper type-casting before doing comparisons
24
+ * 2006-08-14 - The "changes" are now saved as a serialized hash
25
+ * 2006-07-21 - initial version
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright © 2008 Brandon Keepers - Collective Idea
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,76 @@
1
+ = acts_as_audited
2
+
3
+ acts_as_audited is an ActiveRecord extension that logs all changes to your models in an audits table.
4
+
5
+ The purpose of this fork is to add comments to audits.
6
+
7
+ == Installation
8
+
9
+ script/plugin install git://github.com/EmFi/acts_as_audited.git
10
+
11
+ * Generate the migration
12
+
13
+ * If installing without a previous version of acts_as_audited or you do not mind overwriting your audits table:
14
+
15
+ script/generate audited_migration add_audits_table
16
+
17
+ * If upgrading from a version of acts_as_audited that does not contain comment functionality:
18
+
19
+ script/generate audited_migration_update update_audits_table
20
+
21
+ * After running one of the generators:
22
+
23
+ rake db:migrate
24
+
25
+ == Usage
26
+
27
+ Declare <tt>acts_as_audited</tt> on your models:
28
+
29
+ class User < ActiveRecord::Base
30
+ acts_as_audited :except => [:password, :mistress]
31
+ end
32
+
33
+ Within a web request, will automatically record the user that made the change if your controller has a <tt>current_user</tt> method. Comments can be added to an audit by setting model.audit_comments
34
+ before create/update/destroy. If the :comment_required option is given to acts_as_audited,
35
+ the save/update/destroy action will fail with add an error on model.audit_comment and triggering a
36
+ transaction rollback if model.audit_comment is nil.
37
+
38
+ To record a user in the audits outside of a web request, you can use <tt>as_user</tt>:
39
+
40
+ Audit.as_user(user) do
41
+ # Perform changes on audited models
42
+ end
43
+
44
+ == Caveats
45
+
46
+ If your model declares +attr_accessible+ after +acts_as_audited+, you need to set +:protect+ to false. acts_as_audited uses +attr_protected+ internally to prevent malicious users from unassociating your audits, and Rails does not allow both +attr_protected+ and +attr_accessible+. It will default to false if +attr_accessible+ is called before +acts_as_audited+, but needs to be explicitly set if it is called after.
47
+
48
+ class User < ActiveRecord::Base
49
+ acts_as_audited :protect => false
50
+ attr_accessible :name
51
+ end
52
+
53
+ == Compatability
54
+
55
+ acts_as_audited works with Rails 2.1 or later.
56
+
57
+ == Getting Help
58
+
59
+ Join the mailing list for getting help or offering suggestions:
60
+ http://groups.google.com/group/acts_as_audited
61
+
62
+ == Contributing
63
+
64
+ Contributions are always welcome. Checkout the latest code on GitHub:
65
+ http://github.com/collectiveidea/acts_as_audited
66
+
67
+ Please include tests with your patches. There are a few gems required to run the tests:
68
+ $ gem install multi_rails
69
+ $ gem install thoughtbot-shoulda jnunemaker-matchy --source http://gems.github.com
70
+
71
+ Make sure the tests pass against all versions of Rails since 2.1:
72
+
73
+ $ rake test:multi_rails:all
74
+
75
+ Please report bugs or feature suggestions on GitHub:
76
+ http://github.com/collectiveidea/acts_as_audited/issues
data/Rakefile ADDED
@@ -0,0 +1,60 @@
1
+ require 'rake'
2
+ require 'load_multi_rails_rake_tasks'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ desc 'Default: run tests.'
7
+ task :default => :test
8
+
9
+ begin
10
+ require 'jeweler'
11
+ Jeweler::Tasks.new do |gem|
12
+ gem.name = "acts_as_audited_rails3"
13
+ gem.summary = %Q{ActiveRecord extension that logs all changes to your models in an audits table}
14
+ gem.description = %Q{ActiveRecord extension that logs all changes to your models in an audits table description}
15
+ gem.email = "brandon@opensoul.org"
16
+ gem.homepage = "http://github.com/collectiveidea/acts_as_audited"
17
+ gem.authors = ["Brandon Keepers"]
18
+ gem.add_dependency 'activerecord', '>=2.1'
19
+ gem.add_development_dependency "thoughtbot-shoulda"
20
+ gem.add_development_dependency "jnunemaker-matchy"
21
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
22
+ #gem.rubyforge_project = 'acts_as_audited_rails3' # This line would be new
23
+ end
24
+
25
+ Jeweler::GemcutterTasks.new
26
+ rescue LoadError
27
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
28
+ end
29
+
30
+ desc 'Test the acts_as_audited plugin'
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs << 'lib'
33
+ t.pattern = 'test/**/*_test.rb'
34
+ t.verbose = true
35
+ end
36
+
37
+ task :test => :check_dependencies
38
+
39
+ begin
40
+ require 'rcov/rcovtask'
41
+ Rcov::RcovTask.new do |test|
42
+ test.libs << 'test'
43
+ test.pattern = 'test/**/*_test.rb'
44
+ test.verbose = true
45
+ test.rcov_opts = %w(--exclude test,/usr/lib/ruby,/Library/Ruby,$HOME/.gem --sort coverage)
46
+ end
47
+ rescue LoadError
48
+ task :rcov do
49
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
50
+ end
51
+ end
52
+
53
+ desc 'Generate documentation for the acts_as_audited plugin.'
54
+ Rake::RDocTask.new(:rdoc) do |rdoc|
55
+ rdoc.rdoc_dir = 'doc'
56
+ rdoc.title = 'acts_as_audited'
57
+ rdoc.options << '--line-numbers' << '--inline-source'
58
+ rdoc.rdoc_files.include('README')
59
+ rdoc.rdoc_files.include('lib/**/*.rb')
60
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.1.4
@@ -0,0 +1,90 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{acts_as_audited}
8
+ s.version = "1.1.1.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Brandon Keepers"]
12
+ s.date = %q{2010-09-16}
13
+ s.description = %q{ActiveRecord extension that logs all changes to your models in an audits table description}
14
+ s.email = %q{brandon@opensoul.org}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "CHANGELOG",
22
+ "LICENSE",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "acts_as_audited.gemspec",
27
+ "acts_as_audited_rails3.gemspec",
28
+ "doc/classes/Audit.html",
29
+ "doc/classes/CollectiveIdea/Acts/Audited/ClassMethods.html",
30
+ "doc/classes/CollectiveIdea/Acts/Audited/InstanceMethods.html",
31
+ "doc/classes/CollectiveIdea/Acts/Audited/SingletonMethods.html",
32
+ "doc/created.rid",
33
+ "doc/files/README.html",
34
+ "doc/files/lib/acts_as_audited/audit_rb.html",
35
+ "doc/files/lib/acts_as_audited/audit_sweeper_rb.html",
36
+ "doc/files/lib/acts_as_audited_rb.html",
37
+ "doc/fr_class_index.html",
38
+ "doc/fr_file_index.html",
39
+ "doc/fr_method_index.html",
40
+ "doc/index.html",
41
+ "doc/rdoc-style.css",
42
+ "lib/acts_as_audited.rb",
43
+ "lib/acts_as_audited/audit.rb",
44
+ "lib/acts_as_audited/audit_sweeper.rb",
45
+ "lib/acts_as_audited/base.rb",
46
+ "lib/generators/audited_migration/USAGE",
47
+ "lib/generators/audited_migration/audited_migration_generator.rb",
48
+ "lib/generators/audited_migration/templates/migration.rb",
49
+ "lib/generators/audited_migration_update/USAGE",
50
+ "lib/generators/audited_migration_update/audited_migration_update_generator.rb",
51
+ "lib/generators/audited_migration_update/templates/migration.rb",
52
+ "test/acts_as_audited_test.rb",
53
+ "test/audit_sweeper_test.rb",
54
+ "test/audit_test.rb",
55
+ "test/db/database.yml",
56
+ "test/db/schema.rb",
57
+ "test/test_helper.rb"
58
+ ]
59
+ s.homepage = %q{http://github.com/collectiveidea/acts_as_audited}
60
+ s.require_paths = ["lib"]
61
+ s.rubygems_version = %q{1.3.7}
62
+ s.summary = %q{ActiveRecord extension that logs all changes to your models in an audits table}
63
+ s.test_files = [
64
+ "test/acts_as_audited_test.rb",
65
+ "test/audit_sweeper_test.rb",
66
+ "test/audit_test.rb",
67
+ "test/db/schema.rb",
68
+ "test/test_helper.rb"
69
+ ]
70
+
71
+ if s.respond_to? :specification_version then
72
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
73
+ s.specification_version = 3
74
+
75
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
76
+ s.add_runtime_dependency(%q<activerecord>, [">= 2.1"])
77
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
78
+ s.add_development_dependency(%q<jnunemaker-matchy>, [">= 0"])
79
+ else
80
+ s.add_dependency(%q<activerecord>, [">= 2.1"])
81
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
82
+ s.add_dependency(%q<jnunemaker-matchy>, [">= 0"])
83
+ end
84
+ else
85
+ s.add_dependency(%q<activerecord>, [">= 2.1"])
86
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
87
+ s.add_dependency(%q<jnunemaker-matchy>, [">= 0"])
88
+ end
89
+ end
90
+
@@ -0,0 +1,90 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{acts_as_audited_rails3}
8
+ s.version = "1.1.1.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Brandon Keepers"]
12
+ s.date = %q{2010-09-16}
13
+ s.description = %q{ActiveRecord extension that logs all changes to your models in an audits table description}
14
+ s.email = %q{brandon@opensoul.org}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "CHANGELOG",
22
+ "LICENSE",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "acts_as_audited.gemspec",
27
+ "acts_as_audited_rails3.gemspec",
28
+ "doc/classes/Audit.html",
29
+ "doc/classes/CollectiveIdea/Acts/Audited/ClassMethods.html",
30
+ "doc/classes/CollectiveIdea/Acts/Audited/InstanceMethods.html",
31
+ "doc/classes/CollectiveIdea/Acts/Audited/SingletonMethods.html",
32
+ "doc/created.rid",
33
+ "doc/files/README.html",
34
+ "doc/files/lib/acts_as_audited/audit_rb.html",
35
+ "doc/files/lib/acts_as_audited/audit_sweeper_rb.html",
36
+ "doc/files/lib/acts_as_audited_rb.html",
37
+ "doc/fr_class_index.html",
38
+ "doc/fr_file_index.html",
39
+ "doc/fr_method_index.html",
40
+ "doc/index.html",
41
+ "doc/rdoc-style.css",
42
+ "lib/acts_as_audited.rb",
43
+ "lib/acts_as_audited/audit.rb",
44
+ "lib/acts_as_audited/audit_sweeper.rb",
45
+ "lib/acts_as_audited/base.rb",
46
+ "lib/generators/audited_migration/USAGE",
47
+ "lib/generators/audited_migration/audited_migration_generator.rb",
48
+ "lib/generators/audited_migration/templates/migration.rb",
49
+ "lib/generators/audited_migration_update/USAGE",
50
+ "lib/generators/audited_migration_update/audited_migration_update_generator.rb",
51
+ "lib/generators/audited_migration_update/templates/migration.rb",
52
+ "test/acts_as_audited_test.rb",
53
+ "test/audit_sweeper_test.rb",
54
+ "test/audit_test.rb",
55
+ "test/db/database.yml",
56
+ "test/db/schema.rb",
57
+ "test/test_helper.rb"
58
+ ]
59
+ s.homepage = %q{http://github.com/collectiveidea/acts_as_audited}
60
+ s.require_paths = ["lib"]
61
+ s.rubygems_version = %q{1.3.7}
62
+ s.summary = %q{ActiveRecord extension that logs all changes to your models in an audits table}
63
+ s.test_files = [
64
+ "test/acts_as_audited_test.rb",
65
+ "test/audit_sweeper_test.rb",
66
+ "test/audit_test.rb",
67
+ "test/db/schema.rb",
68
+ "test/test_helper.rb"
69
+ ]
70
+
71
+ if s.respond_to? :specification_version then
72
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
73
+ s.specification_version = 3
74
+
75
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
76
+ s.add_runtime_dependency(%q<activerecord>, [">= 2.1"])
77
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
78
+ s.add_development_dependency(%q<jnunemaker-matchy>, [">= 0"])
79
+ else
80
+ s.add_dependency(%q<activerecord>, [">= 2.1"])
81
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
82
+ s.add_dependency(%q<jnunemaker-matchy>, [">= 0"])
83
+ end
84
+ else
85
+ s.add_dependency(%q<activerecord>, [">= 2.1"])
86
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
87
+ s.add_dependency(%q<jnunemaker-matchy>, [">= 0"])
88
+ end
89
+ end
90
+