Skip to content

Commit

Permalink
Merge branch 'feature/rails3' into rails3
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethkalmer committed Feb 2, 2011
2 parents 59b64a6 + fd59f12 commit 4277f99
Show file tree
Hide file tree
Showing 53 changed files with 1,756 additions and 1,177 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
acts_as_audited_plugin.sqlite3.db
test/debug.log
*.log
doc/
coverage/
pkg
pkg
*.swp
.bundle
tmp/*
.yardoc
3 changes: 3 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--no-private
--title acts_as_audited
--exclude lib/generators
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source :gemcutter

gem "rails", "3.0.3"
gem "sqlite3-ruby"
gem "rspec-rails", "~> 2.4.0"
gem "rcov"
gem "yard"
gem "jeweler"
102 changes: 102 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
arel (2.0.7)
builder (2.1.2)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
gemcutter (0.6.1)
git (1.2.5)
i18n (0.5.0)
jeweler (1.4.0)
gemcutter (>= 0.1.0)
git (>= 1.2.5)
rubyforge (>= 2.0.0)
json_pure (1.4.6)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
bundler (~> 1.0)
railties (= 3.0.3)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rcov (0.9.9)
rspec (2.4.0)
rspec-core (~> 2.4.0)
rspec-expectations (~> 2.4.0)
rspec-mocks (~> 2.4.0)
rspec-core (2.4.0)
rspec-expectations (2.4.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.4.0)
rspec-rails (2.4.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.4.0)
rubyforge (2.0.4)
json_pure (>= 1.1.7)
sqlite3-ruby (1.3.2)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.24)
yard (0.6.1)

PLATFORMS
ruby

DEPENDENCIES
jeweler
rails (= 3.0.3)
rcov
rspec-rails (~> 2.4.0)
sqlite3-ruby
yard
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2008 Brandon Keepers - Collective Idea
Copyright © 2010 Brandon Keepers - Collective Idea

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
54 changes: 30 additions & 24 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
= acts_as_audited

+acts_as_audited+ is an ActiveRecord extension that logs all changes to your models in an audits table, with optional revision comments.
+acts_as_audited+ is an ActiveRecord extension that logs all changes to your
models in an audits table, with optional revision comments. +acts_as_audited+
has been updated to work with Rails 3, to use it with older version of Rails,
please see the <tt>rails2</tt> branch.

== Installation

In <tt>environment.rb</tt>:
In <tt>Gemfile</tt>:

Rails::Initializer.run do |config|
...
config.gem 'acts_as_audited'
...
end
gem "acts_as_audited", "2.0.0.rc1"

At your application root, run:
In your application root, run:

$ rake gems:install
$ bundle install

Generate the migration:

* If installing without a previous version of +acts_as_audited+ or you do not mind overwriting your audits table:

$ script/generate audited_migration add_audits_table
$ rails g acts_as_audited:install

* If upgrading from a version of +acts_as_audited+ that does not contain comment functionality:
* If upgrading from a previous version of +acts_as_audited+ you might need some alterations to the audits table:

$ script/generate audited_migration_update update_audits_table
$ rails g acts_as_audited:upgrade

* After running one of the generators:

$ rake db:migrate

== Upgrading

Upgrading to Rails 3, or even between point releases of +acts_as_audited+, might require alterations to the audits table. After every upgrade please run the following generator:

$ rails g acts_as_audited:upgrade

The upgrade generator will only generate migrations that are missing, or no migrations at all if you are up to date.

== Usage

Declare +acts_as_audited+ on your models:

class User < ActiveRecord::Base
acts_as_audited :except => [:password, :mistress]
end

Within a web request, will automatically record the user that made the change if your controller has a +current_user+ method. Comments can be added to an audit by setting <tt>model.audit_comments</tt>
before create/update/destroy. If the <tt>:comment_required</tt> option is given to +acts_as_audited+,
the save/update/destroy action will fail with add an error on <tt>model.audit_comment</tt> and triggering a
Expand All @@ -60,25 +67,24 @@ If your model declares +attr_accessible+ after +acts_as_audited+, you need to se

== Compatability

+acts_as_audited+ works with Rails 2.1 or later.
+acts_as_audited+ works with Rails 3.0.0 or later. For older versions of Rails, please see the <tt>rails2</tt> branch.

== Getting Help

Join the mailing list for getting help or offering suggestions:
http://groups.google.com/group/acts_as_audited
Review the documentation at http://rdoc.info/github/collectiveidea/acts_as_audited

Join the mailing list for getting help or offering suggestions - http://groups.google.com/group/acts_as_audited

== Contributing

Contributions are always welcome. Checkout the latest code on GitHub:
http://github.com/collectiveidea/acts_as_audited
Contributions are always welcome. Checkout the latest code on GitHub - http://github.com/collectiveidea/acts_as_audited

Please include tests with your patches. There are a few gems required to run the tests:
$ gem install multi_rails
$ gem install thoughtbot-shoulda jnunemaker-matchy --source http://gems.github.com

Make sure the tests pass against all versions of Rails since 2.1:
$ bundle install

Make sure the tests pass against the version of Rails specified in the Gemfile

$ rake test:multi_rails:all
$ rake spec test

Please report bugs or feature suggestions on GitHub:
http://github.com/collectiveidea/acts_as_audited/issues
Please report bugs or feature suggestions on GitHub - http://github.com/collectiveidea/acts_as_audited/issues
58 changes: 30 additions & 28 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
require 'rake'
require 'load_multi_rails_rake_tasks'
require 'rspec/core/rake_task'
require 'rake/testtask'
require 'rake/rdoctask'

desc 'Default: run tests.'
task :default => :test
$:.unshift File.expand_path('../lib', __FILE__)

require 'acts_as_audited'

desc 'Default: run specs and tests'
task :default => [:spec, :test]

begin
require 'jeweler'
Expand All @@ -15,45 +18,44 @@ begin
gem.homepage = "http://github.com/collectiveidea/acts_as_audited"
gem.authors = ["Brandon Keepers"]
gem.rdoc_options << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
gem.version = ActsAsAudited::VERSION

gem.add_dependency 'activerecord', '>=2.1'
gem.add_development_dependency "thoughtbot-shoulda"
gem.add_development_dependency "jnunemaker-matchy"
gem.add_dependency 'activerecord', '3.0.3'
gem.add_development_dependency "rails", '3.0.3'
gem.add_development_dependency "rspec-rails", '~> 2.4.0'
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
# Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
puts "Jeweler (or a dependency) not available. Install it with: bundle install"
end

RSpec::Core::RakeTask.new do |t|
t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
t.pattern = 'spec/*_spec.rb'
end

task :spec => :check_dependencies

RSpec::Core::RakeTask.new(:rcov) do |t|
t.rcov = true
t.rcov_opts = %q[--exclude "spec"]
end

desc 'Test the acts_as_audited plugin'
desc 'Test the acts_as_audited generators'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.libs << 'test'
t.pattern = 'test/*_test.rb'
t.verbose = true
end

task :test => :check_dependencies

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
test.rcov_opts = %w(--exclude test,/usr/lib/ruby,/Library/Ruby,$HOME/.gem --sort coverage)
end
require 'yard'
YARD::Rake::YardocTask.new
rescue LoadError
task :rcov do
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
end
puts "YARD (or a dependency) not available. Install it with: bundle install"
end

desc 'Generate documentation for the acts_as_audited plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = 'acts_as_audited'
rdoc.options << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

Loading

0 comments on commit 4277f99

Please sign in to comment.