magic_userstamp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. data/README.rdoc +78 -8
  2. data/Rakefile +2 -1
  3. data/VERSION +1 -1
  4. data/init.rb +5 -7
  5. data/lib/magic_userstamp.rb +27 -0
  6. data/lib/{userstamp → magic_userstamp}/config.rb +11 -12
  7. data/lib/{userstamp → magic_userstamp}/controller.rb +2 -2
  8. data/lib/{userstamp → magic_userstamp}/event.rb +3 -3
  9. data/lib/{userstamp → magic_userstamp}/magic_columns.rb +3 -3
  10. data/lib/magic_userstamp/migration_helper.rb +17 -0
  11. data/lib/{userstamp → magic_userstamp}/stampable.rb +15 -15
  12. data/lib/{userstamp → magic_userstamp}/stamper.rb +5 -5
  13. data/magic_userstamp.gemspec +36 -29
  14. data/rdoc/classes/MagicUserstamp.html +233 -0
  15. data/rdoc/classes/MagicUserstamp/Config.html +408 -0
  16. data/rdoc/classes/MagicUserstamp/Config/Pattern.html +246 -0
  17. data/rdoc/classes/{Ddb → MagicUserstamp}/Controller.html +7 -7
  18. data/rdoc/classes/{Ddb/Controller/Userstamp → MagicUserstamp/Controller}/InstanceMethods.html +7 -7
  19. data/rdoc/classes/MagicUserstamp/Event.html +367 -0
  20. data/rdoc/classes/MagicUserstamp/MagicColumns.html +180 -0
  21. data/rdoc/classes/MagicUserstamp/MagicColumns/ClassMethods.html +225 -0
  22. data/rdoc/classes/MagicUserstamp/MagicUserstampError.html +111 -0
  23. data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/MigrationHelper.html +8 -8
  24. data/rdoc/classes/MagicUserstamp/MigrationHelper/InstanceMethods.html +142 -0
  25. data/rdoc/classes/MagicUserstamp/Stampable.html +157 -0
  26. data/rdoc/classes/MagicUserstamp/Stampable/ClassMethods.html +259 -0
  27. data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper.html +9 -9
  28. data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper/ClassMethods.html +19 -19
  29. data/rdoc/classes/MagicUserstamp/Stamper/InstanceMethods.html +208 -0
  30. data/rdoc/created.rid +1 -1
  31. data/rdoc/files/README_rdoc.html +268 -0
  32. data/rdoc/files/lib/magic_userstamp/config_rb.html +108 -0
  33. data/rdoc/files/lib/magic_userstamp/controller_rb.html +108 -0
  34. data/rdoc/files/lib/{userstamp_rb.html → magic_userstamp/event_rb.html} +14 -7
  35. data/rdoc/files/lib/magic_userstamp/magic_columns_rb.html +108 -0
  36. data/rdoc/files/lib/{migration_helper_rb.html → magic_userstamp/migration_helper_rb.html} +12 -5
  37. data/rdoc/files/lib/magic_userstamp/stampable_rb.html +108 -0
  38. data/rdoc/files/lib/{stamper_rb.html → magic_userstamp/stamper_rb.html} +12 -5
  39. data/rdoc/files/lib/{stampable_rb.html → magic_userstamp_rb.html} +6 -6
  40. data/rdoc/fr_class_index.html +18 -13
  41. data/rdoc/fr_file_index.html +11 -9
  42. data/rdoc/fr_method_index.html +39 -9
  43. data/rdoc/index.html +7 -5
  44. data/spec/compatibility_stamping_spec.rb +3 -3
  45. data/spec/config_spec.rb +5 -5
  46. data/spec/magic_column_spec.rb +8 -8
  47. data/spec/resources/controllers/magic_userstamp_controller.rb +9 -0
  48. data/spec/resources/controllers/posts_controller.rb +2 -2
  49. data/spec/resources/controllers/users_controller.rb +2 -2
  50. data/spec/stamping_spec.rb +1 -1
  51. metadata +36 -29
  52. data/lib/userstamp.rb +0 -17
  53. data/lib/userstamp/migration_helper.rb +0 -17
  54. data/rdoc/classes/Ddb/Controller/Userstamp.html +0 -125
  55. data/rdoc/classes/Ddb/Userstamp.html +0 -121
  56. data/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html +0 -142
  57. data/rdoc/classes/Ddb/Userstamp/Stampable.html +0 -128
  58. data/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html +0 -222
  59. data/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html +0 -207
  60. data/rdoc/files/CHANGELOG.html +0 -137
  61. data/rdoc/files/LICENSE.html +0 -129
  62. data/rdoc/files/README.html +0 -341
  63. data/spec/resources/controllers/userstamp_controller.rb +0 -9
data/lib/userstamp.rb DELETED
@@ -1,17 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Userstamp
3
- autoload :Config, 'userstamp/config'
4
- autoload :Controller, 'userstamp/controller'
5
- autoload :Event, 'userstamp/event'
6
- autoload :MagicColumns, 'userstamp/magic_columns'
7
- autoload :MigrationHelper, 'userstamp/migration_helper'
8
- autoload :Stampable, 'userstamp/stampable'
9
- autoload :Stamper, 'userstamp/stamper'
10
-
11
- class UserstampError < StandardError
12
- end
13
-
14
- def self.config
15
- Config.instance
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- require 'userstamp'
2
-
3
- module Userstamp
4
- module MigrationHelper
5
- def self.included(base) # :nodoc:
6
- base.send(:include, InstanceMethods)
7
- end
8
-
9
- module InstanceMethods
10
- def userstamps(include_deleted_by = false)
11
- column(Userstamp.compatibility_mode ? :created_by : :creator_id, :integer)
12
- column(Userstamp.compatibility_mode ? :updated_by : :updater_id, :integer)
13
- column(Userstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer) if include_deleted_by
14
- end
15
- end
16
- end
17
- end
@@ -1,125 +0,0 @@
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::Controller::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">Ddb::Controller::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
- <div id="description">
76
- <p>
77
- The <a href="Userstamp.html">Userstamp</a> module, when included into a
78
- controller, adds a before filter (named <tt>set_stamper</tt>) and an after
79
- filter (name <tt>reset_stamper</tt>). These methods assume a couple of
80
- things, but can be re-implemented in your controller to better suite your
81
- application.
82
- </p>
83
- <p>
84
- See the documentation for <tt>set_stamper</tt> and <tt>reset_stamper</tt>
85
- for specific implementation details.
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
-
94
- </div>
95
-
96
-
97
- <!-- if includes -->
98
-
99
- <div id="section">
100
-
101
- <div id="class-list">
102
- <h3 class="section-bar">Classes and Modules</h3>
103
-
104
- Module <a href="Userstamp/InstanceMethods.html" class="link">Ddb::Controller::Userstamp::InstanceMethods</a><br />
105
-
106
- </div>
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
- <!-- if method_list -->
115
-
116
-
117
- </div>
118
-
119
-
120
- <div id="validator-badges">
121
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
122
- </div>
123
-
124
- </body>
125
- </html>
@@ -1,121 +0,0 @@
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</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</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/migration_helper_rb.html">
59
- lib/migration_helper.rb
60
- </a>
61
- <br />
62
- <a href="../../files/lib/stampable_rb.html">
63
- lib/stampable.rb
64
- </a>
65
- <br />
66
- <a href="../../files/lib/stamper_rb.html">
67
- lib/stamper.rb
68
- </a>
69
- <br />
70
- </td>
71
- </tr>
72
-
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
-
84
-
85
- </div>
86
-
87
-
88
- </div>
89
-
90
-
91
- <!-- if includes -->
92
-
93
- <div id="section">
94
-
95
- <div id="class-list">
96
- <h3 class="section-bar">Classes and Modules</h3>
97
-
98
- Module <a href="Userstamp/MigrationHelper.html" class="link">Ddb::Userstamp::MigrationHelper</a><br />
99
- Module <a href="Userstamp/Stampable.html" class="link">Ddb::Userstamp::Stampable</a><br />
100
- Module <a href="Userstamp/Stamper.html" class="link">Ddb::Userstamp::Stamper</a><br />
101
-
102
- </div>
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
- <!-- if method_list -->
111
-
112
-
113
- </div>
114
-
115
-
116
- <div id="validator-badges">
117
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
118
- </div>
119
-
120
- </body>
121
- </html>
@@ -1,142 +0,0 @@
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::MigrationHelper::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::MigrationHelper::InstanceMethods</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../../files/lib/migration_helper_rb.html">
59
- lib/migration_helper.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="#M000007">userstamps</a>&nbsp;&nbsp;
84
- </div>
85
- </div>
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
- <div id="methods">
103
- <h3 class="section-bar">Public Instance methods</h3>
104
-
105
- <div id="method-M000007" class="method-detail">
106
- <a name="M000007"></a>
107
-
108
- <div class="method-heading">
109
- <a href="#M000007" class="method-signature">
110
- <span class="method-name">userstamps</span><span class="method-args">(include_deleted_by = false)</span>
111
- </a>
112
- </div>
113
-
114
- <div class="method-description">
115
- <p><a class="source-toggle" href="#"
116
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
117
- <div class="method-source-code" id="M000007-source">
118
- <pre>
119
- <span class="ruby-comment cmt"># File lib/migration_helper.rb, line 9</span>
120
- 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">userstamps</span>(<span class="ruby-identifier">include_deleted_by</span> = <span class="ruby-keyword kw">false</span>)
121
- 10: <span class="ruby-identifier">column</span>(<span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">created_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:creator_id</span>, <span class="ruby-identifier">:integer</span>)
122
- 11: <span class="ruby-identifier">column</span>(<span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">updated_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:updater_id</span>, <span class="ruby-identifier">:integer</span>)
123
- 12: <span class="ruby-identifier">column</span>(<span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">deleted_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:deleter_id</span>, <span class="ruby-identifier">:integer</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">include_deleted_by</span>
124
- 13: <span class="ruby-keyword kw">end</span>
125
- </pre>
126
- </div>
127
- </div>
128
- </div>
129
-
130
-
131
- </div>
132
-
133
-
134
- </div>
135
-
136
-
137
- <div id="validator-badges">
138
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
139
- </div>
140
-
141
- </body>
142
- </html>
@@ -1,128 +0,0 @@
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::Stampable</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::Stampable</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/stampable_rb.html">
59
- lib/stampable.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
- <div id="description">
76
- <p>
77
- Extends the stamping functionality of ActiveRecord by automatically
78
- recording the model responsible for creating, updating, and deleting the
79
- current object. See the <a href="Stamper.html">Stamper</a> and <a
80
- href="../Userstamp.html">Userstamp</a> modules for further documentation on
81
- how the entire process works.
82
- </p>
83
-
84
- </div>
85
-
86
-
87
- </div>
88
-
89
-
90
- </div>
91
-
92
-
93
- <!-- if includes -->
94
- <div id="includes">
95
- <h3 class="section-bar">Included Modules</h3>
96
-
97
- <div id="includes-list">
98
- <span class="include-name">InstanceMethods</span>
99
- </div>
100
- </div>
101
-
102
- <div id="section">
103
-
104
- <div id="class-list">
105
- <h3 class="section-bar">Classes and Modules</h3>
106
-
107
- Module <a href="Stampable/ClassMethods.html" class="link">Ddb::Userstamp::Stampable::ClassMethods</a><br />
108
-
109
- </div>
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
- <!-- if method_list -->
118
-
119
-
120
- </div>
121
-
122
-
123
- <div id="validator-badges">
124
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
125
- </div>
126
-
127
- </body>
128
- </html>