forked from kommen/acts_as_versioned
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.techno-weenie.net/projects/acts_as_versioned@77 567b1171-46fb-0310-a4c9-b4bef9110e78
- Loading branch information
technoweenie
committed
Sep 17, 2005
1 parent
2bd26b9
commit d27c6c6
Showing
24 changed files
with
714 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
*0.1.1* | ||
|
||
* Adding tests and rdocs | ||
|
||
*0.1* | ||
|
||
* Initial transfer from Rails ticket: http://dev.rubyonrails.com/ticket/1974 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
= acts_as_versioned | ||
|
||
This library adds simple versioning to an ActiveRecord module. ActiveRecord is required. | ||
|
||
== Download | ||
|
||
Gem installation: | ||
|
||
gem install acts_as_versioned --source=http://techno-weenie.net/code | ||
|
||
Get a gzipped tar at http://techno-weenie.net/code/pkg | ||
|
||
== Usage | ||
|
||
RDocs are online at http://techno-weenie.net/code/doc/acts_as_versioned/. Start with the | ||
ActiveRecord::Acts::Versioned module. | ||
|
||
Special thanks to Dreamer on #rubyonrails for help in early testing. His ServerSideWiki (http://serversidewiki.com/) | ||
was the first project to use acts_as_versioned <em>in the wild</em>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
== Creating the test database | ||
|
||
The default name for the test databases is "activerecord_versioned". If you | ||
want to use another database name then be sure to update the connection | ||
adapter setups you want to test with in test/connections/<your database>/connection.rb. | ||
When you have the database online, you can import the fixture tables with | ||
the test/fixtures/db_definitions/*.sql files. | ||
|
||
Make sure that you create database objects with the same user that you specified in i | ||
connection.rb otherwise (on Postgres, at least) tests for default values will fail. | ||
|
||
== Running with Rake | ||
|
||
The easiest way to run the unit tests is through Rake. The default task runs | ||
the entire test suite for all the adapters. You can also run the suite on just | ||
one adapter by using the tasks test_mysql_ruby, test_ruby_mysql, test_sqlite, | ||
or test_postresql. For more information, checkout the full array of rake tasks with "rake -T" | ||
|
||
Rake can be found at http://rake.rubyforge.org | ||
|
||
== Running by hand | ||
|
||
Unit tests are located in test directory. If you only want to run a single test suite, | ||
or don't want to bother with Rake, you can do so with something like: | ||
|
||
cd test; ruby -I "connections/native_mysql" base_test.rb | ||
|
||
That'll run the base suite using the MySQL-Ruby adapter. Change the adapter | ||
and test suite name as needed. | ||
|
||
== Faster tests | ||
|
||
If you are using a database that supports transactions, you can set the | ||
"AR_TX_FIXTURES" environment variable to "yes" to use transactional fixtures. | ||
This gives a very large speed boost. With rake: | ||
|
||
rake AR_TX_FIXTURES=yes | ||
|
||
Or, by hand: | ||
|
||
AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
require 'rubygems' | ||
|
||
Gem::manage_gems | ||
|
||
require 'rake/rdoctask' | ||
require 'rake/packagetask' | ||
require 'rake/gempackagetask' | ||
require 'rake/testtask' | ||
require 'rake/contrib/rubyforgepublisher' | ||
|
||
PKG_NAME = 'acts_as_versioned' | ||
PKG_VERSION = '0.1.1' | ||
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" | ||
PROD_HOST = "technoweenie@bidwell.textdrive.com" | ||
|
||
for adapter in %w( mysql postgresql sqlite sqlite3 sqlserver sqlserver_odbc db2 oci ) | ||
Rake::TestTask.new("test_#{adapter}") do |t| | ||
t.libs << "test" << "test/connections/native_#{adapter}" | ||
t.pattern = "test/*_test{,_#{adapter}}.rb" | ||
t.verbose = true | ||
end | ||
end | ||
|
||
Rake::RDocTask.new do |rdoc| | ||
rdoc.rdoc_dir = 'doc' | ||
rdoc.title = "#{PKG_NAME} -- Simple versioning with active record models" | ||
rdoc.options << '--line-numbers --inline-source --accessor cattr_accessor=object' | ||
rdoc.template = "#{ENV['template']}.rb" if ENV['template'] | ||
rdoc.rdoc_files.include('RUNNING_UNIT_TESTS', 'CHANGELOG') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
spec = Gem::Specification.new do |s| | ||
s.name = PKG_NAME | ||
s.version = PKG_VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.summary = "Simple versioning with active record models" | ||
s.files = FileList["{lib,test}/**/*"].to_a + %w(README MIT-LICENSE CHANGELOG RUNNING_UNIT_TESTS) | ||
s.files.delete "test/fixtures/activerecord_versioned.sqlite" | ||
s.files.delete "test/fixtures/activerecord_versioned.sqlite3" | ||
s.require_path = 'lib' | ||
s.autorequire = 'acts_as_versioned' | ||
s.has_rdoc = true | ||
s.test_file = 'test/tests.rb' | ||
s.add_dependency 'activerecord', '>= 1.10.1' | ||
s.add_dependency 'activesupport', '>= 1.1.1' | ||
s.author = "Rick Olson" | ||
s.email = "technoweenie@gmail.com" | ||
s.homepage = "http://techno-weenie.net" | ||
end | ||
|
||
Rake::GemPackageTask.new(spec) do |pkg| | ||
pkg.need_tar = true | ||
end | ||
|
||
desc "Publish the beta gem" | ||
task :pgem => [:package] do | ||
Rake::SshFilePublisher.new(PROD_HOST, "public_html/code/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload | ||
Rake::SshFilePublisher.new(PROD_HOST, "public_html/code/pkg", "pkg", "#{PKG_FILE_NAME}.tgz").upload | ||
%x{ssh #{PROD_HOST} 'update_gems'} | ||
end | ||
|
||
desc "Publish the API documentation" | ||
task :pdoc => [:rdoc] do | ||
Rake::SshDirPublisher.new(PROD_HOST, "public_html/code/doc/acts_as_versioned", "doc").upload | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
$:.unshift(File.dirname(__FILE__) + '/../lib') | ||
|
||
require 'rubygems' | ||
require 'test/unit' | ||
require 'active_record' | ||
require 'active_record/fixtures' | ||
require 'active_support/binding_of_caller' | ||
require 'active_support/breakpoint' | ||
require 'connection' | ||
require 'acts_as_versioned' | ||
|
||
class Test::Unit::TestCase #:nodoc: | ||
def create_fixtures(*table_names) | ||
if block_given? | ||
Fixtures.create_fixtures(File.dirname(__FILE__) + "/fixtures/", table_names) { yield } | ||
else | ||
Fixtures.create_fixtures(File.dirname(__FILE__) + "/fixtures/", table_names) | ||
end | ||
end | ||
end | ||
|
||
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/" | ||
Test::Unit::TestCase.use_instantiated_fixtures = false | ||
Test::Unit::TestCase.use_transactional_fixtures = (ENV['AR_TX_FIXTURES'] == "yes") | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DROP TABLE pages; | ||
DROP TABLE page_versions; | ||
DROP TABLE locked_pages; | ||
DROP TABLE locked_pages_revisions; |
Oops, something went wrong.