simply_versioned 0.9.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +51 -0
- data/MIT-LICENSE +20 -0
- data/README +140 -0
- data/Rakefile +31 -0
- data/generators/simply_versioned_migration/simply_versioned_migration_generator.rb +11 -0
- data/generators/simply_versioned_migration/templates/migration.rb +18 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/simply_versioned.rb +229 -0
- data/lib/version.rb +47 -0
- data/rdoc/classes/SoftwareHeretics.html +122 -0
- data/rdoc/classes/SoftwareHeretics/ActiveRecord.html +111 -0
- data/rdoc/classes/SoftwareHeretics/ActiveRecord/SimplyVersioned.html +149 -0
- data/rdoc/classes/SoftwareHeretics/ActiveRecord/SimplyVersioned/ClassMethods.html +159 -0
- data/rdoc/classes/SoftwareHeretics/ActiveRecord/SimplyVersioned/InstanceMethods.html +178 -0
- data/rdoc/classes/SoftwareHeretics/ActiveRecord/SimplyVersioned/VersionsProxyMethods.html +286 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README.html +216 -0
- data/rdoc/files/lib/simply_versioned_rb.html +112 -0
- data/rdoc/files/lib/version_rb.html +112 -0
- data/rdoc/fr_class_index.html +32 -0
- data/rdoc/fr_file_index.html +29 -0
- data/rdoc/fr_method_index.html +36 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/simply_versioned.gemspec +18 -0
- data/tasks/simply_versioned_tasks.rake +4 -0
- data/test/simply_versioned_test.rb +326 -0
- data/test/test_helper.rb +56 -0
- data/uninstall.rb +1 -0
- metadata +117 -0
data/rdoc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Sun, 30 Dec 2007 11:52:57 +0000
|
@@ -0,0 +1,216 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Sun Dec 30 11:51:41 +0000 2007</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
SimplyVersioned
|
74
|
+
</p>
|
75
|
+
<h6>=========</h6>
|
76
|
+
<p>
|
77
|
+
Release: 0.2 Date: 30-12-2007 Author: Matt Mower <self@mattmower.com>
|
78
|
+
</p>
|
79
|
+
<p>
|
80
|
+
SimplyVersioned is a simple, non-invasive, approach to versioning
|
81
|
+
ActiveRecord models.
|
82
|
+
</p>
|
83
|
+
<p>
|
84
|
+
SimplyVersioned does not require any structural change to the models to be
|
85
|
+
versioned and requires only one versions table to be created (a migration
|
86
|
+
generator is supplied with the plugin) regardless of the number of models
|
87
|
+
being versioned.
|
88
|
+
</p>
|
89
|
+
<p>
|
90
|
+
The plugin introduces a ‘Version’ ActiveRecord model (that
|
91
|
+
reflects changes to model attributes) to which versioned models are
|
92
|
+
polymorphically associated. Version records store the model information as
|
93
|
+
a YAML hash.
|
94
|
+
</p>
|
95
|
+
<p>
|
96
|
+
SimplyVersioned meets a simple need for model versioning. If your needs are
|
97
|
+
more complex maybe try Rick Olsen‘s acts_as_versioned (<a
|
98
|
+
href="http://svn.techno-weenie.net/projects/plugins/acts_as_versioned">svn.techno-weenie.net/projects/plugins/acts_as_versioned</a>/).
|
99
|
+
</p>
|
100
|
+
<p>
|
101
|
+
SimplyVersioned has (so far) been tested and found to work with Rails 2.0.1
|
102
|
+
and Ruby 1.8.6p111.
|
103
|
+
</p>
|
104
|
+
<p>
|
105
|
+
Usage
|
106
|
+
</p>
|
107
|
+
<h5></h5>
|
108
|
+
<ol>
|
109
|
+
<li>Install the plugin
|
110
|
+
|
111
|
+
</li>
|
112
|
+
</ol>
|
113
|
+
<pre>
|
114
|
+
./script/plugin install http://rubymatt.rubyforge.org/svn/simply_versioned
|
115
|
+
</pre>
|
116
|
+
<ol>
|
117
|
+
<li>Generate the migration
|
118
|
+
|
119
|
+
</li>
|
120
|
+
</ol>
|
121
|
+
<pre>
|
122
|
+
./script/generate simply_versioned_migration
|
123
|
+
</pre>
|
124
|
+
<ol>
|
125
|
+
<li>Create the versions table
|
126
|
+
|
127
|
+
</li>
|
128
|
+
</ol>
|
129
|
+
<pre>
|
130
|
+
rake db:migrate
|
131
|
+
</pre>
|
132
|
+
<ol>
|
133
|
+
<li>Annotate the models you want to version specifying how many versions to
|
134
|
+
keep
|
135
|
+
|
136
|
+
<pre>
|
137
|
+
class Thing < ActiveRecord::Base
|
138
|
+
simply_versioned :keep => 10
|
139
|
+
end
|
140
|
+
</pre>
|
141
|
+
</li>
|
142
|
+
<li>Create versions
|
143
|
+
|
144
|
+
<pre>
|
145
|
+
thing = Thing.create!( :foo => bar ) # creates v1
|
146
|
+
thing.foo = baz
|
147
|
+
thing.save! # creates v2
|
148
|
+
</pre>
|
149
|
+
</li>
|
150
|
+
<li>Find versions
|
151
|
+
|
152
|
+
<pre>
|
153
|
+
thing.versions.each do |version| ... end
|
154
|
+
render :partial => 'thing_version', :collection => thing.versions
|
155
|
+
thing.versions.current
|
156
|
+
thing.versions.first
|
157
|
+
thing.versions.get( 3 )
|
158
|
+
</pre>
|
159
|
+
</li>
|
160
|
+
<li>Revert to a previous version
|
161
|
+
|
162
|
+
<pre>
|
163
|
+
thing.revert_to_version( 5 )
|
164
|
+
</pre>
|
165
|
+
</li>
|
166
|
+
<li>Traverse versions
|
167
|
+
|
168
|
+
<pre>
|
169
|
+
thing.versions.current.previous
|
170
|
+
thing.versions.first.next
|
171
|
+
</pre>
|
172
|
+
</li>
|
173
|
+
<li>Obtain a copy of a previous versioned model
|
174
|
+
|
175
|
+
<pre>
|
176
|
+
thing.versions.first.model # => Instantiated Thing with versioned values
|
177
|
+
</pre>
|
178
|
+
</li>
|
179
|
+
</ol>
|
180
|
+
<p>
|
181
|
+
Copyright (c) 2007 Matt Mower <self@mattmower.com> and released under
|
182
|
+
the MIT license
|
183
|
+
</p>
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
|
188
|
+
</div>
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
<!-- if includes -->
|
195
|
+
|
196
|
+
<div id="section">
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<!-- if method_list -->
|
206
|
+
|
207
|
+
|
208
|
+
</div>
|
209
|
+
|
210
|
+
|
211
|
+
<div id="validator-badges">
|
212
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
</body>
|
216
|
+
</html>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: simply_versioned.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>simply_versioned.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/simply_versioned.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Sun Dec 30 11:46:53 +0000 2007</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
SimplyVersioned 0.1
|
74
|
+
</p>
|
75
|
+
<p>
|
76
|
+
Simple ActiveRecord versioning Copyright (c) 2007 Matt Mower
|
77
|
+
<self@mattmower.com> Released under the MIT license (see accompany
|
78
|
+
MIT-LICENSE file)
|
79
|
+
</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<div id="validator-badges">
|
108
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: version.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>version.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/version.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Sun Dec 30 11:31:55 +0000 2007</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
SimplyVersioned 0.1
|
74
|
+
</p>
|
75
|
+
<p>
|
76
|
+
Simple ActiveRecord versioning Copyright (c) 2007 Matt Mower
|
77
|
+
<self@mattmower.com> Released under the MIT license (see accompany
|
78
|
+
MIT-LICENSE file)
|
79
|
+
</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<div id="validator-badges">
|
108
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/SoftwareHeretics.html">SoftwareHeretics</a><br />
|
24
|
+
<a href="classes/SoftwareHeretics/ActiveRecord.html">SoftwareHeretics::ActiveRecord</a><br />
|
25
|
+
<a href="classes/SoftwareHeretics/ActiveRecord/SimplyVersioned.html">SoftwareHeretics::ActiveRecord::SimplyVersioned</a><br />
|
26
|
+
<a href="classes/SoftwareHeretics/ActiveRecord/SimplyVersioned/ClassMethods.html">SoftwareHeretics::ActiveRecord::SimplyVersioned::ClassMethods</a><br />
|
27
|
+
<a href="classes/SoftwareHeretics/ActiveRecord/SimplyVersioned/InstanceMethods.html">SoftwareHeretics::ActiveRecord::SimplyVersioned::InstanceMethods</a><br />
|
28
|
+
<a href="classes/SoftwareHeretics/ActiveRecord/SimplyVersioned/VersionsProxyMethods.html">SoftwareHeretics::ActiveRecord::SimplyVersioned::VersionsProxyMethods</a><br />
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</body>
|
32
|
+
</html>
|