structured_warnings 0.1.3 → 0.1.4

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 (69) hide show
  1. data/History.txt +5 -0
  2. data/License.txt +1 -1
  3. data/README.rdoc +20 -11
  4. data/Rakefile +46 -29
  5. data/doc/DeprecatedMethodWarning.html +170 -0
  6. data/doc/DeprecatedSignatureWarning.html +171 -0
  7. data/doc/DeprecationWarning.html +171 -0
  8. data/doc/Dynamic.html +172 -0
  9. data/doc/Object.html +186 -0
  10. data/doc/README_rdoc.html +296 -0
  11. data/doc/StandardWarning.html +169 -0
  12. data/doc/StructuredWarnings.html +187 -0
  13. data/doc/StructuredWarnings/ClassMethods.html +254 -0
  14. data/doc/StructuredWarnings/Kernel.html +274 -0
  15. data/doc/StructuredWarnings/Test.html +176 -0
  16. data/doc/StructuredWarnings/Test/Assertions.html +322 -0
  17. data/doc/StructuredWarnings/Test/Warner.html +271 -0
  18. data/doc/StructuredWarnings/Warner.html +226 -0
  19. data/doc/Warning.html +460 -0
  20. data/doc/Warning/ClassMethods.html +334 -0
  21. data/doc/created.rid +10 -0
  22. data/doc/images/brick.png +0 -0
  23. data/doc/images/brick_link.png +0 -0
  24. data/doc/images/bug.png +0 -0
  25. data/doc/images/bullet_black.png +0 -0
  26. data/doc/images/bullet_toggle_minus.png +0 -0
  27. data/doc/images/bullet_toggle_plus.png +0 -0
  28. data/doc/images/date.png +0 -0
  29. data/doc/images/find.png +0 -0
  30. data/doc/images/loadingAnimation.gif +0 -0
  31. data/doc/images/macFFBgHack.png +0 -0
  32. data/doc/images/package.png +0 -0
  33. data/doc/images/page_green.png +0 -0
  34. data/doc/images/page_white_text.png +0 -0
  35. data/doc/images/page_white_width.png +0 -0
  36. data/doc/images/plugin.png +0 -0
  37. data/doc/images/ruby.png +0 -0
  38. data/doc/images/tag_green.png +0 -0
  39. data/doc/images/wrench.png +0 -0
  40. data/doc/images/wrench_orange.png +0 -0
  41. data/doc/images/zoom.png +0 -0
  42. data/doc/index.html +120 -0
  43. data/doc/js/darkfish.js +116 -0
  44. data/doc/js/jquery.js +32 -0
  45. data/doc/js/quicksearch.js +114 -0
  46. data/doc/js/thickbox-compressed.js +10 -0
  47. data/doc/lib/structured_warnings/dynamic_rb.html +65 -0
  48. data/doc/lib/structured_warnings/kernel_rb.html +52 -0
  49. data/doc/lib/structured_warnings/test/assertions_rb.html +52 -0
  50. data/doc/lib/structured_warnings/test/warner_rb.html +52 -0
  51. data/doc/lib/structured_warnings/test_rb.html +56 -0
  52. data/doc/lib/structured_warnings/warner_rb.html +52 -0
  53. data/doc/lib/structured_warnings/warning_rb.html +64 -0
  54. data/doc/lib/structured_warnings_rb.html +62 -0
  55. data/doc/rdoc.css +763 -0
  56. data/lib/structured_warnings.rb +6 -9
  57. data/lib/structured_warnings/dynamic.rb +6 -6
  58. data/lib/structured_warnings/kernel.rb +9 -9
  59. data/lib/structured_warnings/test.rb +2 -3
  60. data/lib/structured_warnings/test/assertions.rb +21 -9
  61. data/lib/structured_warnings/test/warner.rb +2 -2
  62. data/lib/structured_warnings/warner.rb +1 -1
  63. data/lib/structured_warnings/warning.rb +11 -11
  64. data/structured_warnings.gemspec +15 -58
  65. data/test/structured_warnings_test.rb +7 -6
  66. metadata +85 -62
  67. data/.gitignore +0 -2
  68. data/test/test_helper.rb +0 -4
  69. data/version.yml +0 -4
@@ -0,0 +1,296 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: README.rdoc [structured_warnings]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+
47
+
48
+ <div id="classindex-section" class="section project-section">
49
+ <h3 class="section-header">Class Index
50
+ <span class="search-toggle"><img src="./images/find.png"
51
+ height="16" width="16" alt="[+]"
52
+ title="show/hide quicksearch" /></span></h3>
53
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
54
+ <fieldset>
55
+ <legend>Quicksearch</legend>
56
+ <input type="text" name="quicksearch" value=""
57
+ class="quicksearch-field" />
58
+ </fieldset>
59
+ </form>
60
+
61
+ <ul class="link-list">
62
+
63
+ <li><a href="./StructuredWarnings.html">StructuredWarnings</a></li>
64
+
65
+ <li><a href="./StructuredWarnings/ClassMethods.html">StructuredWarnings::ClassMethods</a></li>
66
+
67
+ <li><a href="./StructuredWarnings/Kernel.html">StructuredWarnings::Kernel</a></li>
68
+
69
+ <li><a href="./StructuredWarnings/Test.html">StructuredWarnings::Test</a></li>
70
+
71
+ <li><a href="./StructuredWarnings/Test/Assertions.html">StructuredWarnings::Test::Assertions</a></li>
72
+
73
+ <li><a href="./StructuredWarnings/Test/Warner.html">StructuredWarnings::Test::Warner</a></li>
74
+
75
+ <li><a href="./StructuredWarnings/Warner.html">StructuredWarnings::Warner</a></li>
76
+
77
+ <li><a href="./Warning.html">Warning</a></li>
78
+
79
+ <li><a href="./Warning/ClassMethods.html">Warning::ClassMethods</a></li>
80
+
81
+ <li><a href="./DeprecatedMethodWarning.html">DeprecatedMethodWarning</a></li>
82
+
83
+ <li><a href="./DeprecatedSignatureWarning.html">DeprecatedSignatureWarning</a></li>
84
+
85
+ <li><a href="./DeprecationWarning.html">DeprecationWarning</a></li>
86
+
87
+ <li><a href="./Dynamic.html">Dynamic</a></li>
88
+
89
+ <li><a href="./Object.html">Object</a></li>
90
+
91
+ <li><a href="./StandardWarning.html">StandardWarning</a></li>
92
+
93
+ </ul>
94
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
95
+ </div>
96
+
97
+
98
+ </div>
99
+ </div>
100
+
101
+ <div id="documentation">
102
+
103
+ <h1>Structured Warnings</h1>
104
+
105
+ <p>This is an implementation of Daniel Berger’s <a
106
+ href="http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html">proposal
107
+ of structured warnings for Ruby</a>. They provide dynamic suppression and
108
+ activation, as well as, an inheritance hierarchy to model their relations.
109
+ This library preserves the old <tt>warn</tt> signature, but additionally
110
+ allows a <tt>raise</tt>-like use.</p>
111
+
112
+ <p>For more information on the usage and benefits of this library have a look
113
+ at the inspiring article at O’Reilly.</p>
114
+
115
+ <p><a
116
+ href="http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html">www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html</a></p>
117
+
118
+ <h2>Installation &amp; Compatibility</h2>
119
+
120
+ <pre>gem install structured_warnings</pre>
121
+
122
+ <p>structured_warnings works with all interpreters, it was tested with.</p>
123
+ <ul><li>
124
+ <p>Ruby 1.8.5 and later</p>
125
+ </li><li>
126
+ <p>Ruby 1.9.1 and later</p>
127
+ </li><li>
128
+ <p>JRuby 1.x</p>
129
+ </li></ul>
130
+
131
+ <p>Please let me know, of any other compatibilities or file a bug for any
132
+ incompatibilities.</p>
133
+
134
+ <h2>Example Usage</h2>
135
+
136
+ <p>To get you started - here is a short example</p>
137
+
138
+ <p>In order to use structured_warnings in library code, use the following
139
+ code.</p>
140
+
141
+ <pre># in lib/...
142
+ require 'structured_warnings'
143
+
144
+ class Foo
145
+ def old_method
146
+ warn DeprecatedMethodWarning, 'This method is deprecated. Use new_method instead'
147
+ # Do stuff
148
+ end
149
+ end
150
+
151
+ # in test/...
152
+ require 'test/unit'
153
+ require 'structured_warnings'
154
+
155
+ class FooTests &lt; Test::Unit::TestCase
156
+ def setup
157
+ @foo = Foo.new
158
+ end
159
+
160
+ def test_old_method_emits_deprecation_warning
161
+ assert_warn(DeprecatedMethodWarning){ @foo.old_method }
162
+ end
163
+ end</pre>
164
+
165
+ <p><a href="DeprecatedMethodWarning.html">DeprecatedMethodWarning</a> is only
166
+ one of multiple predefined warning types. You may add your own types by
167
+ subclassing <a href="Warning.html">Warning</a> if you like.</p>
168
+
169
+ <p>Client code of your library will look as follows:</p>
170
+
171
+ <pre>require &quot;foo&quot;
172
+
173
+ foo = Foo.new
174
+ foo.old_method # =&gt; will print
175
+ # ... `old_method' : This method is deprecated. Use new_method instead (DeprecatedMethodWarning)</pre>
176
+
177
+ <p>But the main difference to the standard warning concept shipped with ruby,
178
+ is that the client is able to selectively disable certain warnings s/he is
179
+ aware of and not willing to fix.</p>
180
+
181
+ <pre>DeprecatedMethodWarning.disable # Globally disable warnings about deprecated methods!
182
+
183
+ foo.old_method # =&gt; will print nothing
184
+
185
+ DeprecatedMethodWarning.enable # Reenable warnings again.</pre>
186
+
187
+ <p>And there is an even more powerful option for your clients, the can
188
+ selectively disable warnings in a dynamic block scope.</p>
189
+
190
+ <pre># Don't bug me about deprecated method warnings within this block, I know
191
+ # what I'm doing.
192
+ #
193
+ DeprecatedMethodWarning.disable do
194
+ foo.old_method
195
+ end</pre>
196
+
197
+ <p>These settings are scoped to the local thread (and all threads spawned in
198
+ the block scope) and automatically reset after the block.</p>
199
+
200
+ <h2>Detailed Documentation</h2>
201
+
202
+ <p>Have closer look at the RDoc of <a
203
+ href="StructuredWarnings/Kernel.html">StructuredWarnings::Kernel</a>, <a
204
+ href="Warning.html">Warning</a> and <a
205
+ href="Warning/ClassMethods.html">Warning::ClassMethods</a>.</p>
206
+
207
+ <p>Part of this library is a set of different warnings:</p>
208
+ <ul><li>
209
+ <p><a href="Warning.html">Warning</a></p>
210
+ <ul><li>
211
+ <p><a href="StandardWarning.html">StandardWarning</a></p>
212
+ </li><li>
213
+ <p><a href="DeprecationWarning.html">DeprecationWarning</a></p>
214
+ <ul><li>
215
+ <p><a href="DeprecatedMethodWarning.html">DeprecatedMethodWarning</a></p>
216
+ </li><li>
217
+ <p><a href="DeprecatedSignatureWarning.html">DeprecatedSignatureWarning</a></p>
218
+ </li></ul>
219
+ </li></ul>
220
+ </li></ul>
221
+
222
+ <p>You are encourage to use your own subclasses of <a
223
+ href="Warning.html">Warning</a> to give as much feedback to your users as
224
+ possible.</p>
225
+
226
+ <h2>Resources</h2>
227
+ <ul><li>
228
+ <p><a
229
+ href="http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html">Inspiring
230
+ article</a></p>
231
+ </li><li>
232
+ <p><a
233
+ href="http://www.nach-vorne.de/2008/2/22/structured_warnings-highlights">Implementation
234
+ Highlights</a></p>
235
+ </li><li>
236
+ <p><a href="http://github.com/schmidt/structured_warnings/">Project's
237
+ website</a></p>
238
+ </li><li>
239
+ <p><a href="http://rdoc.info/projects/schmidt/structured_warnings">API doc</a></p>
240
+ </li><li>
241
+ <p><a href="http://runcoderun.com/schmidt/structured_warnings">Build Status on
242
+ RunCodeRun</a></p>
243
+ </li></ul>
244
+
245
+ <h2>How to submit patches</h2>
246
+
247
+ <p>In order to submit patches, please fork the repository on GitHub, add your
248
+ patches to your own copy and send a “Pull Request” afterwards. I will then
249
+ try to add your submissions as soon as possible. Patches containing
250
+ corresponding tests are always welcome.</p>
251
+
252
+ <p>Bug reports or general feature requests should be added using GitHub
253
+ Issues.</p>
254
+
255
+ <h2>Known Issues</h2>
256
+
257
+ <p>Although the library transparently coorperates with Ruby’s built-in
258
+ <tt>Kernel#warn</tt>, it may not override <tt>rb_warn</tt> which is used
259
+ internally to emit “method redefined”, “void context”, and “parenthesis”
260
+ warnings. They may not be manipulated by structured_warnings.</p>
261
+
262
+ <h2>License</h2>
263
+
264
+ <p>This code is free to use under the terms of the MIT license.</p>
265
+
266
+ <pre>Copyright (c) 2008 Gregor Schmidt
267
+
268
+ Permission is hereby granted, free of charge, to any person obtaining
269
+ a copy of this software and associated documentation files (the
270
+ &quot;Software&quot;), to deal in the Software without restriction, including
271
+ without limitation the rights to use, copy, modify, merge, publish,
272
+ distribute, sublicense, and/or sell copies of the Software, and to
273
+ permit persons to whom the Software is furnished to do so, subject to
274
+ the following conditions:
275
+
276
+ The above copyright notice and this permission notice shall be
277
+ included in all copies or substantial portions of the Software.
278
+
279
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
280
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
281
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
282
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
283
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
284
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
285
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</pre>
286
+
287
+ </div>
288
+
289
+ <div id="validator-badges">
290
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
291
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
292
+ Rdoc Generator</a> 2</small>.</p>
293
+ </div>
294
+ </body>
295
+ </html>
296
+
@@ -0,0 +1,169 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: StandardWarning</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="./index.html">Home</a>
25
+ <a href="./index.html#classes">Classes</a>
26
+ <a href="./index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="./lib/structured_warnings/warning_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/structured_warnings/warning.rb">lib/structured_warnings/warning.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link"><a href="Warning.html">Warning</a></p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ </div>
66
+
67
+ <div id="project-metadata">
68
+
69
+
70
+ <div id="fileindex-section" class="section project-section">
71
+ <h3 class="section-header">Files</h3>
72
+ <ul>
73
+
74
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
75
+
76
+ </ul>
77
+ </div>
78
+
79
+
80
+ <div id="classindex-section" class="section project-section">
81
+ <h3 class="section-header">Class/Module Index
82
+ <span class="search-toggle"><img src="./images/find.png"
83
+ height="16" width="16" alt="[+]"
84
+ title="show/hide quicksearch" /></span></h3>
85
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
86
+ <fieldset>
87
+ <legend>Quicksearch</legend>
88
+ <input type="text" name="quicksearch" value=""
89
+ class="quicksearch-field" />
90
+ </fieldset>
91
+ </form>
92
+
93
+ <ul class="link-list">
94
+
95
+ <li><a href="./StructuredWarnings.html">StructuredWarnings</a></li>
96
+
97
+ <li><a href="./StructuredWarnings/ClassMethods.html">StructuredWarnings::ClassMethods</a></li>
98
+
99
+ <li><a href="./StructuredWarnings/Kernel.html">StructuredWarnings::Kernel</a></li>
100
+
101
+ <li><a href="./StructuredWarnings/Test.html">StructuredWarnings::Test</a></li>
102
+
103
+ <li><a href="./StructuredWarnings/Test/Assertions.html">StructuredWarnings::Test::Assertions</a></li>
104
+
105
+ <li><a href="./StructuredWarnings/Test/Warner.html">StructuredWarnings::Test::Warner</a></li>
106
+
107
+ <li><a href="./StructuredWarnings/Warner.html">StructuredWarnings::Warner</a></li>
108
+
109
+ <li><a href="./Warning.html">Warning</a></li>
110
+
111
+ <li><a href="./Warning/ClassMethods.html">Warning::ClassMethods</a></li>
112
+
113
+ <li><a href="./DeprecatedMethodWarning.html">DeprecatedMethodWarning</a></li>
114
+
115
+ <li><a href="./DeprecatedSignatureWarning.html">DeprecatedSignatureWarning</a></li>
116
+
117
+ <li><a href="./DeprecationWarning.html">DeprecationWarning</a></li>
118
+
119
+ <li><a href="./Dynamic.html">Dynamic</a></li>
120
+
121
+ <li><a href="./Object.html">Object</a></li>
122
+
123
+ <li><a href="./StandardWarning.html">StandardWarning</a></li>
124
+
125
+ </ul>
126
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
127
+ </div>
128
+
129
+
130
+ </div>
131
+ </div>
132
+
133
+ <div id="documentation">
134
+ <h1 class="class">StandardWarning</h1>
135
+
136
+ <div id="description" class="description">
137
+
138
+ <p>This warning is used when calling #Kernel.warn without arguments.</p>
139
+
140
+ </div><!-- description -->
141
+
142
+
143
+
144
+
145
+ <div id="5Buntitled-5D" class="documentation-section">
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ <!-- Methods -->
155
+
156
+ </div><!-- 5Buntitled-5D -->
157
+
158
+
159
+ </div><!-- documentation -->
160
+
161
+ <div id="validator-badges">
162
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
163
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
164
+ Rdoc Generator</a> 2</small>.</p>
165
+ </div>
166
+
167
+ </body>
168
+ </html>
169
+