structured_warnings 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +200 -0
  3. data/lib/{structured_warnings/dynamic.rb → dynamic.rb} +0 -0
  4. data/lib/structured_warnings.rb +19 -9
  5. data/lib/structured_warnings/base.rb +132 -0
  6. data/lib/structured_warnings/kernel.rb +5 -65
  7. data/lib/structured_warnings/minitest.rb +5 -0
  8. data/lib/structured_warnings/test.rb +3 -5
  9. data/lib/structured_warnings/test/assertions.rb +93 -98
  10. data/lib/structured_warnings/test/warner.rb +32 -35
  11. data/lib/structured_warnings/test_unit.rb +5 -0
  12. data/lib/structured_warnings/version.rb +3 -0
  13. data/lib/structured_warnings/warner.rb +13 -11
  14. data/lib/structured_warnings/warning.rb +61 -119
  15. data/lib/warning.rb +9 -0
  16. metadata +53 -92
  17. data/Gemfile +0 -3
  18. data/Gemfile.lock +0 -21
  19. data/History.txt +0 -36
  20. data/License.txt +0 -20
  21. data/README.rdoc +0 -137
  22. data/Rakefile +0 -55
  23. data/doc/DeprecatedMethodWarning.html +0 -105
  24. data/doc/DeprecatedSignatureWarning.html +0 -106
  25. data/doc/DeprecationWarning.html +0 -106
  26. data/doc/Dynamic.html +0 -125
  27. data/doc/Object.html +0 -117
  28. data/doc/README_rdoc.html +0 -283
  29. data/doc/StandardWarning.html +0 -104
  30. data/doc/StructuredWarnings.html +0 -125
  31. data/doc/StructuredWarnings/ClassMethods.html +0 -192
  32. data/doc/StructuredWarnings/Kernel.html +0 -222
  33. data/doc/StructuredWarnings/Test.html +0 -97
  34. data/doc/StructuredWarnings/Test/Assertions.html +0 -272
  35. data/doc/StructuredWarnings/Test/Warner.html +0 -208
  36. data/doc/StructuredWarnings/Warner.html +0 -162
  37. data/doc/Test.html +0 -95
  38. data/doc/Test/Unit.html +0 -95
  39. data/doc/Warning.html +0 -398
  40. data/doc/Warning/ClassMethods.html +0 -278
  41. data/doc/created.rid +0 -10
  42. data/doc/css/fonts.css +0 -167
  43. data/doc/css/rdoc.css +0 -590
  44. data/doc/fonts/Lato-Light.ttf +0 -0
  45. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  46. data/doc/fonts/Lato-Regular.ttf +0 -0
  47. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  48. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  49. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  50. data/doc/images/add.png +0 -0
  51. data/doc/images/arrow_up.png +0 -0
  52. data/doc/images/brick.png +0 -0
  53. data/doc/images/brick_link.png +0 -0
  54. data/doc/images/bug.png +0 -0
  55. data/doc/images/bullet_black.png +0 -0
  56. data/doc/images/bullet_toggle_minus.png +0 -0
  57. data/doc/images/bullet_toggle_plus.png +0 -0
  58. data/doc/images/date.png +0 -0
  59. data/doc/images/delete.png +0 -0
  60. data/doc/images/find.png +0 -0
  61. data/doc/images/loadingAnimation.gif +0 -0
  62. data/doc/images/macFFBgHack.png +0 -0
  63. data/doc/images/package.png +0 -0
  64. data/doc/images/page_green.png +0 -0
  65. data/doc/images/page_white_text.png +0 -0
  66. data/doc/images/page_white_width.png +0 -0
  67. data/doc/images/plugin.png +0 -0
  68. data/doc/images/ruby.png +0 -0
  69. data/doc/images/tag_blue.png +0 -0
  70. data/doc/images/tag_green.png +0 -0
  71. data/doc/images/transparent.png +0 -0
  72. data/doc/images/wrench.png +0 -0
  73. data/doc/images/wrench_orange.png +0 -0
  74. data/doc/images/zoom.png +0 -0
  75. data/doc/index.html +0 -121
  76. data/doc/js/darkfish.js +0 -161
  77. data/doc/js/jquery.js +0 -4
  78. data/doc/js/navigation.js +0 -142
  79. data/doc/js/navigation.js.gz +0 -0
  80. data/doc/js/search.js +0 -109
  81. data/doc/js/search_index.js +0 -1
  82. data/doc/js/search_index.js.gz +0 -0
  83. data/doc/js/searcher.js +0 -228
  84. data/doc/js/searcher.js.gz +0 -0
  85. data/doc/table_of_contents.html +0 -200
  86. data/structured_warnings.gemspec +0 -24
  87. data/test/structured_warnings_test.rb +0 -187
@@ -0,0 +1,9 @@
1
+ module Warning
2
+ KERNEL_WARN = Kernel.instance_method(:warn).bind(self)
3
+
4
+ def warn(*args)
5
+ KERNEL_WARN.call(*args)
6
+ end
7
+
8
+ extend self
9
+ end
metadata CHANGED
@@ -1,137 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structured_warnings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregor Schmidt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ">="
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: '0'
47
+ version: '5.0'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - ">="
52
+ - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '0'
54
+ version: '5.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: test-unit
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - ">="
59
+ - - "~>"
32
60
  - !ruby/object:Gem::Version
33
- version: '0'
61
+ version: '3.2'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - ">="
66
+ - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: '0'
41
- description: "\n This is an implementation of Daniel Berger's proposal of structured\n
42
- \ warnings for Ruby.\n "
43
- email: ruby@schmidtwisser.de
68
+ version: '3.2'
69
+ description: This is an implementation of Daniel Berger's proposal of structured warnings
70
+ for Ruby.
71
+ email:
72
+ - schmidt@nach-vorne.eu
44
73
  executables: []
45
74
  extensions: []
46
- extra_rdoc_files:
47
- - README.rdoc
75
+ extra_rdoc_files: []
48
76
  files:
49
- - Gemfile
50
- - Gemfile.lock
51
- - History.txt
52
- - License.txt
53
- - README.rdoc
54
- - Rakefile
55
- - doc/DeprecatedMethodWarning.html
56
- - doc/DeprecatedSignatureWarning.html
57
- - doc/DeprecationWarning.html
58
- - doc/Dynamic.html
59
- - doc/Object.html
60
- - doc/README_rdoc.html
61
- - doc/StandardWarning.html
62
- - doc/StructuredWarnings.html
63
- - doc/StructuredWarnings/ClassMethods.html
64
- - doc/StructuredWarnings/Kernel.html
65
- - doc/StructuredWarnings/Test.html
66
- - doc/StructuredWarnings/Test/Assertions.html
67
- - doc/StructuredWarnings/Test/Warner.html
68
- - doc/StructuredWarnings/Warner.html
69
- - doc/Test.html
70
- - doc/Test/Unit.html
71
- - doc/Warning.html
72
- - doc/Warning/ClassMethods.html
73
- - doc/created.rid
74
- - doc/css/fonts.css
75
- - doc/css/rdoc.css
76
- - doc/fonts/Lato-Light.ttf
77
- - doc/fonts/Lato-LightItalic.ttf
78
- - doc/fonts/Lato-Regular.ttf
79
- - doc/fonts/Lato-RegularItalic.ttf
80
- - doc/fonts/SourceCodePro-Bold.ttf
81
- - doc/fonts/SourceCodePro-Regular.ttf
82
- - doc/images/add.png
83
- - doc/images/arrow_up.png
84
- - doc/images/brick.png
85
- - doc/images/brick_link.png
86
- - doc/images/bug.png
87
- - doc/images/bullet_black.png
88
- - doc/images/bullet_toggle_minus.png
89
- - doc/images/bullet_toggle_plus.png
90
- - doc/images/date.png
91
- - doc/images/delete.png
92
- - doc/images/find.png
93
- - doc/images/loadingAnimation.gif
94
- - doc/images/macFFBgHack.png
95
- - doc/images/package.png
96
- - doc/images/page_green.png
97
- - doc/images/page_white_text.png
98
- - doc/images/page_white_width.png
99
- - doc/images/plugin.png
100
- - doc/images/ruby.png
101
- - doc/images/tag_blue.png
102
- - doc/images/tag_green.png
103
- - doc/images/transparent.png
104
- - doc/images/wrench.png
105
- - doc/images/wrench_orange.png
106
- - doc/images/zoom.png
107
- - doc/index.html
108
- - doc/js/darkfish.js
109
- - doc/js/jquery.js
110
- - doc/js/navigation.js
111
- - doc/js/navigation.js.gz
112
- - doc/js/search.js
113
- - doc/js/search_index.js
114
- - doc/js/search_index.js.gz
115
- - doc/js/searcher.js
116
- - doc/js/searcher.js.gz
117
- - doc/table_of_contents.html
77
+ - README.md
78
+ - lib/dynamic.rb
118
79
  - lib/structured_warnings.rb
119
- - lib/structured_warnings/dynamic.rb
80
+ - lib/structured_warnings/base.rb
120
81
  - lib/structured_warnings/kernel.rb
82
+ - lib/structured_warnings/minitest.rb
121
83
  - lib/structured_warnings/test.rb
122
84
  - lib/structured_warnings/test/assertions.rb
123
85
  - lib/structured_warnings/test/warner.rb
86
+ - lib/structured_warnings/test_unit.rb
87
+ - lib/structured_warnings/version.rb
124
88
  - lib/structured_warnings/warner.rb
125
89
  - lib/structured_warnings/warning.rb
126
- - structured_warnings.gemspec
127
- - test/structured_warnings_test.rb
90
+ - lib/warning.rb
128
91
  homepage: http://github.com/schmidt/structured_warnings
129
92
  licenses:
130
93
  - MIT
131
94
  metadata: {}
132
95
  post_install_message:
133
- rdoc_options:
134
- - "--charset=UTF-8"
96
+ rdoc_options: []
135
97
  require_paths:
136
98
  - lib
137
99
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -146,10 +108,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
108
  version: '0'
147
109
  requirements: []
148
110
  rubyforge_project:
149
- rubygems_version: 2.4.1
111
+ rubygems_version: 2.6.10
150
112
  signing_key:
151
113
  specification_version: 4
152
114
  summary: Provides structured warnings for Ruby, using an exception-like interface
153
115
  and hierarchy
154
- test_files:
155
- - test/structured_warnings_test.rb
116
+ test_files: []
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
@@ -1,21 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- structured_warnings (0.2.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- power_assert (0.2.2)
10
- rake (10.4.2)
11
- test-unit (3.0.9)
12
- power_assert
13
-
14
- PLATFORMS
15
- java
16
- ruby
17
-
18
- DEPENDENCIES
19
- rake
20
- structured_warnings!
21
- test-unit
@@ -1,36 +0,0 @@
1
- == 0.2.0 2015-01-15
2
-
3
- * Merging pull requests #4, and #5
4
- * Fixes to dynamic.rb to support forking from non-main thread
5
- * Improve compatibility with other libs overriding Kernel#warn
6
- * Testing on latest Ruby VMs (Ruby 2 variants, JRuby and Rubinius)
7
-
8
- == 0.1.4 2013-01-23
9
- * Reorganized Rakefile and tasks, removed Jeweler dependency.
10
- * Updated tests, fixed circular dependency error.
11
- * Removed version.yml.
12
-
13
- == 0.1.3 2009-11-28
14
-
15
- * major enhancements
16
- * improved API of assert_warn and assert_no_warn
17
-
18
- == 0.1.2 2009-11-27
19
-
20
- * major enhancements
21
- * moved to gemcutter
22
- * minor enhancements
23
- * removed all old cruft
24
-
25
- == 0.1.1 2008-02-22
26
-
27
- * 1 major enhancement:
28
- * Fully documented library
29
- * 1 minor fix
30
- * Warnings can no longer be disabled twice
31
-
32
- == 0.1.0 2008-02-21
33
-
34
- * 1 major enhancement:
35
- * Initial release
36
- * No documentation yet
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 Gregor Schmidt
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.
@@ -1,137 +0,0 @@
1
- = Structured Warnings
2
-
3
- This is an implementation of Daniel Berger's {proposal of structured warnings
4
- for Ruby}[http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html]. They provide dynamic suppression and activation, as well as, an
5
- inheritance hierarchy to model their relations. This library preserves the old
6
- <code>warn</code> signature, but additionally allows a <code>raise</code>-like
7
- use.
8
-
9
- For more information on the usage and benefits of this library have a look at
10
- the inspiring article at O'Reilly.
11
-
12
- http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html
13
-
14
- == Installation & Compatibility
15
-
16
- gem install structured_warnings
17
-
18
- structured_warnings works with all interpreters, it was tested with.
19
-
20
- * Ruby 1.8-2.2
21
- * Rubinius 2.4
22
- * JRuby 1.7
23
-
24
- Please let me know, of any other compatibilities or file a bug for any
25
- incompatibilities.
26
-
27
- == Example Usage
28
-
29
- To get you started - here is a short example
30
-
31
- In order to use structured_warnings in library code, use the following code.
32
-
33
- # in lib/...
34
- require 'structured_warnings'
35
-
36
- class Foo
37
- def old_method
38
- warn DeprecatedMethodWarning, 'This method is deprecated. Use new_method instead'
39
- # Do stuff
40
- end
41
- end
42
-
43
- # in test/...
44
- require 'test/unit'
45
- require 'structured_warnings'
46
-
47
- class FooTests < Test::Unit::TestCase
48
- def setup
49
- @foo = Foo.new
50
- end
51
-
52
- def test_old_method_emits_deprecation_warning
53
- assert_warn(DeprecatedMethodWarning){ @foo.old_method }
54
- end
55
- end
56
-
57
- DeprecatedMethodWarning is only one of multiple predefined warning types. You
58
- may add your own types by subclassing Warning if you like.
59
-
60
- Client code of your library will look as follows:
61
-
62
- require "foo"
63
-
64
- foo = Foo.new
65
- foo.old_method # => will print
66
- # ... `old_method' : This method is deprecated. Use new_method instead (DeprecatedMethodWarning)
67
-
68
- But the main difference to the standard warning concept shipped with ruby, is
69
- that the client is able to selectively disable certain warnings s/he is aware
70
- of and not willing to fix.
71
-
72
- DeprecatedMethodWarning.disable # Globally disable warnings about deprecated methods!
73
-
74
- foo.old_method # => will print nothing
75
-
76
- DeprecatedMethodWarning.enable # Reenable warnings again.
77
-
78
- And there is an even more powerful option for your clients, the can selectively
79
- disable warnings in a dynamic block scope.
80
-
81
- # Don't bug me about deprecated method warnings within this block, I know
82
- # what I'm doing.
83
- #
84
- DeprecatedMethodWarning.disable do
85
- foo.old_method
86
- end
87
-
88
- These settings are scoped to the local thread (and all threads spawned in the
89
- block scope) and automatically reset after the block.
90
-
91
- == Detailed Documentation
92
-
93
- Have closer look at the RDoc of StructuredWarnings::Kernel, Warning and
94
- Warning::ClassMethods.
95
-
96
- Part of this library is a set of different warnings:
97
-
98
- * Warning
99
- * StandardWarning
100
- * DeprecationWarning
101
- * DeprecatedMethodWarning
102
- * DeprecatedSignatureWarning
103
-
104
- You are encourage to use your own subclasses of Warning to give as much
105
- feedback to your users as possible.
106
-
107
-
108
- == Resources
109
-
110
- * {Inspiring article}[http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html]
111
- * {Implementation Highlights}[http://www.nach-vorne.de/2008/2/22/structured_warnings-highlights]
112
- * {Project's website}[https://github.com/schmidt/structured_warnings/]
113
- * {API doc}[http://rdoc.info/projects/schmidt/structured_warnings]
114
- * {Build status}[https://travis-ci.org/schmidt/structured_warnings]
115
-
116
-
117
- == How to submit patches
118
-
119
- In order to submit patches, please fork the repository on GitHub, add your
120
- patches to your own copy and send a "Pull Request" afterwards. I will then try
121
- to add your submissions as soon as possible. Patches containing corresponding
122
- tests are always welcome.
123
-
124
- Bug reports or general feature requests should be added using GitHub Issues.
125
-
126
- == Known Issues
127
-
128
- Although the library transparently coorperates with Ruby's built-in
129
- <code>Kernel#warn</code>, it may not override +rb_warn+ which is used internally to emit
130
- "method redefined", "void context", and "parenthesis" warnings. They may not be
131
- manipulated by structured_warnings.
132
-
133
- == License
134
-
135
- This code is free to use under the terms of the MIT license.
136
-
137
- :include: License.txt
data/Rakefile DELETED
@@ -1,55 +0,0 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
-
5
- CLEAN.include('**/*.gem', '**/*.rbx', '**/*.rbc')
6
-
7
- namespace :gem do
8
- desc "Create the structured_warnings gem"
9
- task :create => [:clean] do
10
- spec = eval(IO.read('structured_warnings.gemspec'))
11
- Gem::Builder.new(spec).build
12
- end
13
-
14
- desc "Install the structured_warnings gem"
15
- task :install => [:create] do
16
- file = Dir['*.gem'].first
17
- sh "gem install #{file}"
18
- end
19
- end
20
-
21
- Rake::TestTask.new do |t|
22
- t.verbose = true
23
- t.warning = true
24
- t.test_files = Dir['test/*.rb']
25
- end
26
-
27
- task :default => :test
28
-
29
-
30
-
31
- begin
32
- require 'rdoc/task'
33
- Rake::RDocTask.new(:doc) do |doc|
34
- doc.rdoc_dir = 'doc'
35
- doc.title = 'structured_warnings'
36
- doc.options << '--line-numbers' << '--inline-source'
37
- doc.rdoc_files.include('README.rdoc')
38
- doc.rdoc_files.include('lib/**/*.rb')
39
- end
40
-
41
- rescue LoadError
42
- desc 'Remove RDoc HTML files'
43
- task :clobber_doc => :rdoc_warning
44
-
45
- desc 'Build RDoc HTML files'
46
- task :doc => :rdoc_warning
47
-
48
- desc 'Rebuild RDoc HTML files'
49
- task :redoc => :rdoc_warning
50
-
51
- task :rdoc_warning do
52
- puts "To run the rdoc task, you need to install the rdoc gem"
53
- puts " gem install rdoc"
54
- end
55
- end