magiclabs-userstamp 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/CHANGELOG +26 -0
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +55 -0
  4. data/LICENSE +20 -0
  5. data/Rakefile +38 -0
  6. data/Readme.rdoc +163 -0
  7. data/VERSION +1 -0
  8. data/init.rb +1 -0
  9. data/lib/migration_helper.rb +19 -0
  10. data/lib/stampable.rb +154 -0
  11. data/lib/stamper.rb +43 -0
  12. data/lib/userstamp.rb +52 -0
  13. data/magiclabs-userstamp.gemspec +85 -0
  14. data/rdoc/classes/Ddb/Controller.html +111 -0
  15. data/rdoc/classes/Ddb/Controller/Userstamp.html +125 -0
  16. data/rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html +105 -0
  17. data/rdoc/classes/Ddb/Userstamp.html +121 -0
  18. data/rdoc/classes/Ddb/Userstamp/MigrationHelper.html +111 -0
  19. data/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html +142 -0
  20. data/rdoc/classes/Ddb/Userstamp/Stampable.html +128 -0
  21. data/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html +225 -0
  22. data/rdoc/classes/Ddb/Userstamp/Stamper.html +112 -0
  23. data/rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html +142 -0
  24. data/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html +207 -0
  25. data/rdoc/classes/Userstamp.html +118 -0
  26. data/rdoc/created.rid +1 -0
  27. data/rdoc/files/CHANGELOG.html +137 -0
  28. data/rdoc/files/LICENSE.html +129 -0
  29. data/rdoc/files/Readme_rdoc.html +301 -0
  30. data/rdoc/files/lib/migration_helper_rb.html +101 -0
  31. data/rdoc/files/lib/stampable_rb.html +101 -0
  32. data/rdoc/files/lib/stamper_rb.html +101 -0
  33. data/rdoc/files/lib/userstamp_rb.html +110 -0
  34. data/rdoc/fr_class_index.html +38 -0
  35. data/rdoc/fr_file_index.html +33 -0
  36. data/rdoc/fr_method_index.html +33 -0
  37. data/rdoc/index.html +24 -0
  38. data/rdoc/rdoc-style.css +208 -0
  39. data/test/compatibility_stamping_test.rb +69 -0
  40. data/test/controllers/posts_controller.rb +26 -0
  41. data/test/controllers/users_controller.rb +12 -0
  42. data/test/controllers/userstamp_controller.rb +9 -0
  43. data/test/helper.rb +61 -0
  44. data/test/models/comment.rb +5 -0
  45. data/test/models/foo.rb +3 -0
  46. data/test/models/person.rb +3 -0
  47. data/test/models/post.rb +13 -0
  48. data/test/models/user.rb +3 -0
  49. data/test/schema.rb +54 -0
  50. data/test/stamping_test.rb +138 -0
  51. data/test/userstamp_controller_test.rb +103 -0
  52. data/test/userstamp_test.rb +7 -0
  53. metadata +105 -0
@@ -0,0 +1,207 @@
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>Module: Ddb::Userstamp::Stamper::InstanceMethods</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="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Ddb::Userstamp::Stamper::InstanceMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/stamper_rb.html">
59
+ lib/stamper.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000004">reset_stamper</a>&nbsp;&nbsp;
84
+ <a href="#M000003">stamper</a>&nbsp;&nbsp;
85
+ <a href="#M000002">stamper=</a>&nbsp;&nbsp;
86
+ </div>
87
+ </div>
88
+
89
+ </div>
90
+
91
+
92
+ <!-- if includes -->
93
+
94
+ <div id="section">
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <!-- if method_list -->
104
+ <div id="methods">
105
+ <h3 class="section-bar">Public Instance methods</h3>
106
+
107
+ <div id="method-M000004" class="method-detail">
108
+ <a name="M000004"></a>
109
+
110
+ <div class="method-heading">
111
+ <a href="#M000004" class="method-signature">
112
+ <span class="method-name">reset_stamper</span><span class="method-args">()</span>
113
+ </a>
114
+ </div>
115
+
116
+ <div class="method-description">
117
+ <p>
118
+ Sets the <a href="InstanceMethods.html#M000003">stamper</a> back to
119
+ <tt>nil</tt> to prepare for the next request.
120
+ </p>
121
+ <p><a class="source-toggle" href="#"
122
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
123
+ <div class="method-source-code" id="M000004-source">
124
+ <pre>
125
+ <span class="ruby-comment cmt"># File lib/stamper.rb, line 35</span>
126
+ 35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset_stamper</span>
127
+ 36: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">&quot;#{self.to_s.downcase}_#{self.object_id}_stamper&quot;</span>] = <span class="ruby-keyword kw">nil</span>
128
+ 37: <span class="ruby-keyword kw">end</span>
129
+ </pre>
130
+ </div>
131
+ </div>
132
+ </div>
133
+
134
+ <div id="method-M000003" class="method-detail">
135
+ <a name="M000003"></a>
136
+
137
+ <div class="method-heading">
138
+ <a href="#M000003" class="method-signature">
139
+ <span class="method-name">stamper</span><span class="method-args">()</span>
140
+ </a>
141
+ </div>
142
+
143
+ <div class="method-description">
144
+ <p>
145
+ Retrieves the existing <a href="InstanceMethods.html#M000003">stamper</a>
146
+ for the current request.
147
+ </p>
148
+ <p><a class="source-toggle" href="#"
149
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
150
+ <div class="method-source-code" id="M000003-source">
151
+ <pre>
152
+ <span class="ruby-comment cmt"># File lib/stamper.rb, line 30</span>
153
+ 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stamper</span>
154
+ 31: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">&quot;#{self.to_s.downcase}_#{self.object_id}_stamper&quot;</span>]
155
+ 32: <span class="ruby-keyword kw">end</span>
156
+ </pre>
157
+ </div>
158
+ </div>
159
+ </div>
160
+
161
+ <div id="method-M000002" class="method-detail">
162
+ <a name="M000002"></a>
163
+
164
+ <div class="method-heading">
165
+ <a href="#M000002" class="method-signature">
166
+ <span class="method-name">stamper=</span><span class="method-args">(object)</span>
167
+ </a>
168
+ </div>
169
+
170
+ <div class="method-description">
171
+ <p>
172
+ Used to set the <a href="InstanceMethods.html#M000003">stamper</a> for a
173
+ particular request. See the <a href="../../Userstamp.html">Userstamp</a>
174
+ module for more details on how to use this method.
175
+ </p>
176
+ <p><a class="source-toggle" href="#"
177
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
178
+ <div class="method-source-code" id="M000002-source">
179
+ <pre>
180
+ <span class="ruby-comment cmt"># File lib/stamper.rb, line 19</span>
181
+ 19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stamper=</span>(<span class="ruby-identifier">object</span>)
182
+ 20: <span class="ruby-identifier">object_stamper</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>)
183
+ 21: <span class="ruby-identifier">object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{object.class.primary_key}&quot;</span>.<span class="ruby-identifier">to_sym</span>)
184
+ 22: <span class="ruby-keyword kw">else</span>
185
+ 23: <span class="ruby-identifier">object</span>
186
+ 24: <span class="ruby-keyword kw">end</span>
187
+ 25:
188
+ 26: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">&quot;#{self.to_s.downcase}_#{self.object_id}_stamper&quot;</span>] = <span class="ruby-identifier">object_stamper</span>
189
+ 27: <span class="ruby-keyword kw">end</span>
190
+ </pre>
191
+ </div>
192
+ </div>
193
+ </div>
194
+
195
+
196
+ </div>
197
+
198
+
199
+ </div>
200
+
201
+
202
+ <div id="validator-badges">
203
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
204
+ </div>
205
+
206
+ </body>
207
+ </html>
@@ -0,0 +1,118 @@
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>Module: Userstamp</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="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Userstamp</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/userstamp_rb.html">
59
+ lib/userstamp.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+
80
+ </div>
81
+
82
+
83
+ <!-- if includes -->
84
+
85
+ <div id="section">
86
+
87
+
88
+ <div id="constants-list">
89
+ <h3 class="section-bar">Constants</h3>
90
+
91
+ <div class="name-list">
92
+ <table summary="Constants">
93
+ <tr class="top-aligned-row context-row">
94
+ <td class="context-item-name">VERSION</td>
95
+ <td>=</td>
96
+ <td class="context-item-value">File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip</td>
97
+ </tr>
98
+ </table>
99
+ </div>
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+
109
+
110
+ </div>
111
+
112
+
113
+ <div id="validator-badges">
114
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
115
+ </div>
116
+
117
+ </body>
118
+ </html>
@@ -0,0 +1 @@
1
+ Mon, 09 Aug 2010 21:09:48 +0200
@@ -0,0 +1,137 @@
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: CHANGELOG</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>CHANGELOG</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>CHANGELOG
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Apr 30 22:27:47 +0200 2010</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
+ 2.0 (2-17-2008)
74
+ </p>
75
+ <pre>
76
+ * [Ben Wyrosdick] - Added a migration helper that gives migration scripts a &lt;tt&gt;userstamps&lt;/tt&gt;
77
+ method.
78
+ * [Marshall Roch] - Stamping can be temporarily turned off using the 'without_stamps' class
79
+ method.
80
+ Example:
81
+ Post.without_stamps do
82
+ post = Post.find(params[:id])
83
+ post.update_attributes(params[:post])
84
+ post.save
85
+ end
86
+
87
+ * Models that should receive updates made by 'stampers' now use the acts_as_stampable class
88
+ method. This sets up the belongs_to relationships and also injects private methods for use by
89
+ the individual callback filter methods.
90
+
91
+ * Models that are responsible for updating now use the acts_as_stamper class method. This
92
+ injects the stamper= and stamper methods that are thread safe and should be updated per
93
+ request by a controller.
94
+
95
+ * The Userstamp module is now meant to be included with one of your project's controllers (the
96
+ Application Controller is recommended). It creates a before filter called 'set_stampers' that
97
+ is responsible for setting all the current Stampers.
98
+ </pre>
99
+ <p>
100
+ 1.0 (01-18-2006)
101
+ </p>
102
+ <pre>
103
+ * Initial Release
104
+ </pre>
105
+
106
+ </div>
107
+
108
+
109
+ </div>
110
+
111
+
112
+ </div>
113
+
114
+
115
+ <!-- if includes -->
116
+
117
+ <div id="section">
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <!-- if method_list -->
127
+
128
+
129
+ </div>
130
+
131
+
132
+ <div id="validator-badges">
133
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
134
+ </div>
135
+
136
+ </body>
137
+ </html>