modified_acts_as_versioned 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG +82 -0
- data/MIT-LICENSE +20 -0
- data/README +28 -0
- data/RUNNING_UNIT_TESTS +41 -0
- data/Rakefile +50 -0
- data/VERSION.yml +4 -0
- data/acts_as_versioned.gemspec +29 -0
- data/init.rb +1 -0
- data/lib/acts_as_versioned.rb +488 -0
- data/rdoc/classes/ActiveRecord/Acts/Versioned/ActMethods/ClassMethods.html +336 -0
- data/rdoc/classes/ActiveRecord/Acts/Versioned/ActMethods.html +581 -0
- data/rdoc/classes/ActiveRecord/Acts/Versioned/ClassMethods.html +506 -0
- data/rdoc/classes/ActiveRecord/Acts/Versioned.html +187 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/CHANGELOG.html +288 -0
- data/rdoc/files/README.html +158 -0
- data/rdoc/files/RUNNING_UNIT_TESTS.html +158 -0
- data/rdoc/files/lib/acts_as_versioned_rb.html +129 -0
- data/rdoc/fr_class_index.html +30 -0
- data/rdoc/fr_file_index.html +30 -0
- data/rdoc/fr_method_index.html +54 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/test/abstract_unit.rb +60 -0
- data/test/database.yml +18 -0
- data/test/fixtures/authors.yml +6 -0
- data/test/fixtures/landmark.rb +3 -0
- data/test/fixtures/landmark_versions.yml +7 -0
- data/test/fixtures/landmarks.yml +7 -0
- data/test/fixtures/locked_pages.yml +10 -0
- data/test/fixtures/locked_pages_revisions.yml +27 -0
- data/test/fixtures/migrations/1_add_versioned_tables.rb +15 -0
- data/test/fixtures/page.rb +48 -0
- data/test/fixtures/page_versions.yml +16 -0
- data/test/fixtures/pages.yml +8 -0
- data/test/fixtures/widget.rb +6 -0
- data/test/migration_test.rb +47 -0
- data/test/schema.rb +82 -0
- data/test/versioned_test.rb +379 -0
- metadata +114 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
nbproject
|
data/CHANGELOG
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
*GIT* (version numbers are overrated)
|
2
|
+
|
3
|
+
* (16 Jun 2008) Backwards Compatibility is overrated (big updates for rails 2.1)
|
4
|
+
|
5
|
+
* Use ActiveRecord 2.1's dirty attribute checking instead [Asa Calow]
|
6
|
+
* Remove last traces of #non_versioned_fields
|
7
|
+
* Remove AR::Base.find_version and AR::Base.find_versions, rely on AR association proxies and named_scope
|
8
|
+
* Remove #versions_count, rely on AR association counter caching.
|
9
|
+
* Remove #versioned_attributes, basically the same as AR::Base.versioned_columns
|
10
|
+
|
11
|
+
* (5 Oct 2006) Allow customization of #versions association options [Dan Peterson]
|
12
|
+
|
13
|
+
*0.5.1*
|
14
|
+
|
15
|
+
* (8 Aug 2006) Versioned models now belong to the unversioned model. @article_version.article.class => Article [Aslak Hellesoy]
|
16
|
+
|
17
|
+
*0.5* # do versions even matter for plugins?
|
18
|
+
|
19
|
+
* (21 Apr 2006) Added without_locking and without_revision methods.
|
20
|
+
|
21
|
+
Foo.without_revision do
|
22
|
+
@foo.update_attributes ...
|
23
|
+
end
|
24
|
+
|
25
|
+
*0.4*
|
26
|
+
|
27
|
+
* (28 March 2006) Rename non_versioned_fields to non_versioned_columns (old one is kept for compatibility).
|
28
|
+
* (28 March 2006) Made explicit documentation note that string column names are required for non_versioned_columns.
|
29
|
+
|
30
|
+
*0.3.1*
|
31
|
+
|
32
|
+
* (7 Jan 2006) explicitly set :foreign_key option for the versioned model's belongs_to assocation for STI [Caged]
|
33
|
+
* (7 Jan 2006) added tests to prove has_many :through joins work
|
34
|
+
|
35
|
+
*0.3*
|
36
|
+
|
37
|
+
* (2 Jan 2006) added ability to share a mixin with versioned class
|
38
|
+
* (2 Jan 2006) changed the dynamic version model to MyModel::Version
|
39
|
+
|
40
|
+
*0.2.4*
|
41
|
+
|
42
|
+
* (27 Nov 2005) added note about possible destructive behavior of if_changed? [Michael Schuerig]
|
43
|
+
|
44
|
+
*0.2.3*
|
45
|
+
|
46
|
+
* (12 Nov 2005) fixed bug with old behavior of #blank? [Michael Schuerig]
|
47
|
+
* (12 Nov 2005) updated tests to use ActiveRecord Schema
|
48
|
+
|
49
|
+
*0.2.2*
|
50
|
+
|
51
|
+
* (3 Nov 2005) added documentation note to #acts_as_versioned [Martin Jul]
|
52
|
+
|
53
|
+
*0.2.1*
|
54
|
+
|
55
|
+
* (6 Oct 2005) renamed dirty? to changed? to keep it uniform. it was aliased to keep it backwards compatible.
|
56
|
+
|
57
|
+
*0.2*
|
58
|
+
|
59
|
+
* (6 Oct 2005) added find_versions and find_version class methods.
|
60
|
+
|
61
|
+
* (6 Oct 2005) removed transaction from create_versioned_table().
|
62
|
+
this way you can specify your own transaction around a group of operations.
|
63
|
+
|
64
|
+
* (30 Sep 2005) fixed bug where find_versions() would order by 'version' twice. (found by Joe Clark)
|
65
|
+
|
66
|
+
* (26 Sep 2005) added :sequence_name option to acts_as_versioned to set the sequence name on the versioned model
|
67
|
+
|
68
|
+
*0.1.3* (18 Sep 2005)
|
69
|
+
|
70
|
+
* First RubyForge release
|
71
|
+
|
72
|
+
*0.1.2*
|
73
|
+
|
74
|
+
* check if module is already included when acts_as_versioned is called
|
75
|
+
|
76
|
+
*0.1.1*
|
77
|
+
|
78
|
+
* Adding tests and rdocs
|
79
|
+
|
80
|
+
*0.1*
|
81
|
+
|
82
|
+
* Initial transfer from Rails ticket: http://dev.rubyonrails.com/ticket/1974
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2005 Rick Olson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
= acts_as_versioned
|
2
|
+
|
3
|
+
This library adds simple versioning to an ActiveRecord module. ActiveRecord is required.
|
4
|
+
|
5
|
+
== Resources
|
6
|
+
|
7
|
+
Install
|
8
|
+
|
9
|
+
* gem install acts_as_versioned
|
10
|
+
|
11
|
+
Rubyforge project
|
12
|
+
|
13
|
+
* http://rubyforge.org/projects/ar-versioned
|
14
|
+
|
15
|
+
RDocs
|
16
|
+
|
17
|
+
* http://ar-versioned.rubyforge.org
|
18
|
+
|
19
|
+
Subversion
|
20
|
+
|
21
|
+
* http://techno-weenie.net/svn/projects/acts_as_versioned
|
22
|
+
|
23
|
+
Collaboa
|
24
|
+
|
25
|
+
* http://collaboa.techno-weenie.net/repository/browse/acts_as_versioned
|
26
|
+
|
27
|
+
Special thanks to Dreamer on ##rubyonrails for help in early testing. His ServerSideWiki (http://serversidewiki.com)
|
28
|
+
was the first project to use acts_as_versioned <em>in the wild</em>.
|
data/RUNNING_UNIT_TESTS
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
== Creating the test database
|
2
|
+
|
3
|
+
The default name for the test databases is "activerecord_versioned". If you
|
4
|
+
want to use another database name then be sure to update the connection
|
5
|
+
adapter setups you want to test with in test/connections/<your database>/connection.rb.
|
6
|
+
When you have the database online, you can import the fixture tables with
|
7
|
+
the test/fixtures/db_definitions/*.sql files.
|
8
|
+
|
9
|
+
Make sure that you create database objects with the same user that you specified in i
|
10
|
+
connection.rb otherwise (on Postgres, at least) tests for default values will fail.
|
11
|
+
|
12
|
+
== Running with Rake
|
13
|
+
|
14
|
+
The easiest way to run the unit tests is through Rake. The default task runs
|
15
|
+
the entire test suite for all the adapters. You can also run the suite on just
|
16
|
+
one adapter by using the tasks test_mysql_ruby, test_ruby_mysql, test_sqlite,
|
17
|
+
or test_postresql. For more information, checkout the full array of rake tasks with "rake -T"
|
18
|
+
|
19
|
+
Rake can be found at http://rake.rubyforge.org
|
20
|
+
|
21
|
+
== Running by hand
|
22
|
+
|
23
|
+
Unit tests are located in test directory. If you only want to run a single test suite,
|
24
|
+
or don't want to bother with Rake, you can do so with something like:
|
25
|
+
|
26
|
+
cd test; ruby -I "connections/native_mysql" base_test.rb
|
27
|
+
|
28
|
+
That'll run the base suite using the MySQL-Ruby adapter. Change the adapter
|
29
|
+
and test suite name as needed.
|
30
|
+
|
31
|
+
== Faster tests
|
32
|
+
|
33
|
+
If you are using a database that supports transactions, you can set the
|
34
|
+
"AR_TX_FIXTURES" environment variable to "yes" to use transactional fixtures.
|
35
|
+
This gives a very large speed boost. With rake:
|
36
|
+
|
37
|
+
rake AR_TX_FIXTURES=yes
|
38
|
+
|
39
|
+
Or, by hand:
|
40
|
+
|
41
|
+
AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/packagetask'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
require 'rake/testtask'
|
7
|
+
|
8
|
+
PKG_VERSION = '0.3.1.1'
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'jeweler'
|
12
|
+
Jeweler::Tasks.new do |gem|
|
13
|
+
gem.name = 'modified_acts_as_versioned'
|
14
|
+
gem.summary = "Small added functionality to technoweenie original gen for Rails 2 - Simple versioning with active record models"
|
15
|
+
gem.description = "Small added functionality to technoweenie original gen for Rails 2 - Simple versioning with active record models"
|
16
|
+
gem.email = "dw_henry@yahoo.com.au"
|
17
|
+
gem.homepage = "http://github.com/tom025/acts_as_versioned"
|
18
|
+
gem.authors = ["David Henry","Thomas Brand"]
|
19
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
+
end
|
21
|
+
Jeweler::GemcutterTasks.new
|
22
|
+
rescue LoadError
|
23
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Default: run unit tests.'
|
27
|
+
task :default => :test
|
28
|
+
|
29
|
+
desc 'Test the calculations plugin.'
|
30
|
+
Rake::TestTask.new(:test) do |t|
|
31
|
+
t.libs << 'lib'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
#Rake::GemPackageTask.new(spec) do |pkg|
|
39
|
+
# pkg.need_tar = true
|
40
|
+
#end
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "modified_acts_as_versioned #{PKG_VERSION}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
50
|
+
|
data/VERSION.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{acts_as_versioned}
|
5
|
+
s.version = "0.5.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["technoweenie"]
|
9
|
+
s.date = %q{2009-01-20}
|
10
|
+
s.description = %q{TODO}
|
11
|
+
s.email = %q{technoweenie@bidwell.textdrive.com}
|
12
|
+
s.files = ["VERSION.yml", "lib/acts_as_versioned.rb", "test/abstract_unit.rb", "test/database.yml", "test/fixtures", "test/fixtures/authors.yml", "test/fixtures/landmark.rb", "test/fixtures/landmark_versions.yml", "test/fixtures/landmarks.yml", "test/fixtures/locked_pages.yml", "test/fixtures/locked_pages_revisions.yml", "test/fixtures/migrations", "test/fixtures/migrations/1_add_versioned_tables.rb", "test/fixtures/page.rb", "test/fixtures/page_versions.yml", "test/fixtures/pages.yml", "test/fixtures/widget.rb", "test/migration_test.rb", "test/schema.rb", "test/versioned_test.rb"]
|
13
|
+
s.has_rdoc = true
|
14
|
+
s.homepage = %q{http://github.com/technoweenie/acts_as_versioned}
|
15
|
+
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.3.1}
|
18
|
+
s.summary = %q{TODO}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'acts_as_versioned'
|