thoughtbot-quietbacktrace 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -7,7 +7,7 @@ It also provides hooks for you to add additional silencers and filters.
7
7
  Install
8
8
  -------
9
9
 
10
- sudo gem install quietbacktrace
10
+ sudo gem install thoughtbot-quietbacktrace --source=http://gems.github.com
11
11
 
12
12
  Usage
13
13
  -----
@@ -70,15 +70,13 @@ Requirements
70
70
  ------------
71
71
 
72
72
  * Test::Unit
73
- * aliasing.rb and attribute_accessors.rb, which are sniped from ActiveSupport and
74
- are included in the gem. They allow quietbacktrace.rb to use alias method chain,
75
- cattr accessor, and mattr accessor.
73
+ * ActiveSupport (alias method chain, cattr accessor, & mattr accessor)
76
74
 
77
75
  Resources
78
76
  ---------
79
77
 
80
78
  * [mailing list](http://groups.google.com/group/quiet_backtrace)
81
- * [project site](http://rubyforge.org/projects/quietbacktrace)
79
+ * [project site](http://github.com/thoughtbot/quietbacktrace)
82
80
 
83
81
  Authors
84
82
  -------
@@ -1,89 +1,6 @@
1
- # = Quiet Backtrace
2
- #
3
- # Quiet Backtrace suppresses the noise in your Test::Unit backtrace.
4
- # It also provides hooks for you to add additional silencers and filters.
5
- #
6
- # == Install
7
- #
8
- # sudo gem install quietbacktrace
9
- #
10
- # == Usage
11
- #
12
- # Quiet Backtrace works by adding new attributes to Test::Unit::TestCase.
13
- # By default, their values are:
14
- # self.quiet_backtrace = true
15
- # self.backtrace_silencers = [:test_unit, :gem_root, :e1]
16
- # self.backtrace_filters = [:method_name]
17
- #
18
- # Silencers remove lines from the backtrace that return true for given conditions.
19
- # Filters modify the output of backtrace lines.
20
- #
21
- # Override the defaults by adding your own backtrace_silencers:
22
- # class Test::Unit::TestCase
23
- # self.backtrace_silencers :shoulda do |line|
24
- # line.include? 'vendor/plugins/shoulda'
25
- # end
26
- # end
27
- #
28
- # Or your own backtrace_filters:
29
- # class Test::Unit::TestCase
30
- # self.backtrace_filters :ruby_path do |line|
31
- # ruby_file_path = '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8'
32
- # line.slice!(0..(line =~ ruby_file_path)) if (line =~ ruby_file_path)
33
- # end
34
- # end
35
- #
36
- # Turn Quiet Backtrace off anywhere in your test suite by setting the flag to false:
37
- # Test::Unit::TestCase.quiet_backtrace = false
38
- #
39
- # == Rails-specific usage
40
- #
41
- # Install gemsonrails, add it your Rails app, then freeze quietbacktrace:
42
- #
43
- # * gem install gemsonrails
44
- # * cd rails-app-folder
45
- # * gemsonrails
46
- # * rake gems:freeze GEM=quietbacktrace
47
- #
48
- # Quiet Backtrace comes with an excellent Rails-specific silencer and filter.
49
- # They must be added (usually in test_helper.rb) because they are not turned on by default:
50
- # class Test::Unit::TestCase
51
- # self.backtrace_silencers << :rails_vendor
52
- # self.backtrace_filters << :rails_root
53
- # end
54
- #
55
- # Because Quiet Backtrace works by adding attributes onto Test::Unit::TestCase,
56
- # you can add and remove silencers and filters at any level in your test suite,
57
- # down to the individual test.
58
- #
59
- # == Resources
60
- #
61
- # * mailing list: http://groups.google.com/group/quiet_backtrace
62
- # * project site: http://rubyforge.org/projects/quietbacktrace
63
- #
64
- # == Authors
65
- #
66
- # * Dan Croak (dcroak@thoughtbot.com, http://dancroak.com)
67
- # * James Golick (james@giraffesoft.ca, http://jamesgolick.com)
68
- # * Joe Ferris (jferris@thoughtbot.com)
69
- #
70
- # Special thanks to the Boston.rb group (http://bostonrb.org)
71
- # for cultivating this idea at our inaugural hackfest.
72
- #
73
- # == Requirements
74
- #
75
- # * Test::Unit
76
- # * aliasing.rb and attribute_accessors.rb, which are snipped from ActiveSupport and
77
- # are included in the gem. They allow quiet_backtrace.rb to use alias_method_chain,
78
- # cattr_accessor, and mattr_accessor.
79
- #
80
- # == Copyright
81
- #
82
- # Copyright (c) 2007 Dan Croak, thoughtbot, inc., released under the MIT license
83
-
84
1
  require 'test/unit'
85
- require File.expand_path(File.dirname(__FILE__) + '/attribute_accessors')
86
- require File.expand_path(File.dirname(__FILE__) + '/aliasing')
2
+ require 'rubygems'
3
+ require 'activesupport'
87
4
 
88
5
  module QuietBacktrace # :nodoc: all
89
6
  module BacktraceFilter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thoughtbot-quietbacktrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot, inc.
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2008-09-11 00:00:00 -07:00
14
+ date: 2008-10-02 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
@@ -25,10 +25,7 @@ extra_rdoc_files: []
25
25
 
26
26
  files:
27
27
  - README.markdown
28
- - quietbacktrace.gemspec
29
28
  - lib/quietbacktrace.rb
30
- - lib/aliasing.rb
31
- - lib/attribute_accessors.rb
32
29
  - MIT-LICENSE
33
30
  has_rdoc: false
34
31
  homepage: http://github.com/thoughtbot/quietbacktrace
data/lib/aliasing.rb DELETED
@@ -1,89 +0,0 @@
1
- # :stopdoc:
2
- #
3
- # Snipped directly from ActiveSupport from Rails 1.2.3
4
- # If Quiet Backtrace is run from a Rails app, the actual ActiveSupport
5
- # methods will be used. That way, alias_method_chain will not be
6
- # overridden in your Rails app if Quiet Backtrace is installed.
7
- #
8
- # Copyright (c) 2005-2006 David Heinemeier Hansson
9
- #
10
- # Permission is hereby granted, free of charge, to any person obtaining
11
- # a copy of this software and associated documentation files (the
12
- # "Software"), to deal in the Software without restriction, including
13
- # without limitation the rights to use, copy, modify, merge, publish,
14
- # distribute, sublicense, and/or sell copies of the Software, and to
15
- # permit persons to whom the Software is furnished to do so, subject to
16
- # the following conditions:
17
- #
18
- # The above copyright notice and this permission notice shall be
19
- # included in all copies or substantial portions of the Software.
20
- #
21
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
-
29
- # activesupport/lib/activesupport/core_ext/module/aliasing.rb
30
- unless defined?(ActiveSupport)
31
- class Module # :nodoc:
32
- # Encapsulates the common pattern of:
33
- #
34
- # alias_method :foo_without_feature, :foo
35
- # alias_method :foo, :foo_with_feature
36
- #
37
- # With this, you simply do:
38
- #
39
- # alias_method_chain :foo, :feature
40
- #
41
- # And both aliases are set up for you.
42
- #
43
- # Query and bang methods (foo?, foo!) keep the same punctuation:
44
- #
45
- # alias_method_chain :foo?, :feature
46
- #
47
- # is equivalent to
48
- #
49
- # alias_method :foo_without_feature?, :foo?
50
- # alias_method :foo?, :foo_with_feature?
51
- #
52
- # so you can safely chain foo, foo?, and foo! with the same feature.
53
- def alias_method_chain(target, feature)
54
- # Strip out punctuation on predicates or bang methods since
55
- # e.g. target?_without_feature is not a valid method name.
56
- aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
57
- yield(aliased_target, punctuation) if block_given?
58
- alias_method "#{aliased_target}_without_#{feature}#{punctuation}", target
59
- alias_method target, "#{aliased_target}_with_#{feature}#{punctuation}"
60
- end
61
-
62
- # Allows you to make aliases for attributes, which includes
63
- # getter, setter, and query methods.
64
- #
65
- # Example:
66
- #
67
- # class Content < ActiveRecord::Base
68
- # # has a title attribute
69
- # end
70
- #
71
- # class Email < ActiveRecord::Base
72
- # alias_attribute :subject, :title
73
- # end
74
- #
75
- # e = Email.find(1)
76
- # e.title # => "Superstars"
77
- # e.subject # => "Superstars"
78
- # e.subject? # => true
79
- # e.subject = "Megastars"
80
- # e.title # => "Megastars"
81
- def alias_attribute(new_name, old_name)
82
- module_eval <<-STR, __FILE__, __LINE__+1
83
- def #{new_name}; #{old_name}; end
84
- def #{new_name}?; #{old_name}?; end
85
- def #{new_name}=(v); self.#{old_name} = v; end
86
- STR
87
- end
88
- end
89
- end
@@ -1,131 +0,0 @@
1
- # :stopdoc:
2
- #
3
- # Snipped directly from ActiveSupport from Rails 1.2.3
4
- # If Quiet Backtrace is run from a Rails app, the actual ActiveSupport
5
- # methods will be used. That way, mattr_accessor and cattr_accessor will
6
- # not be overridden in your Rails app if Quiet Backtrace is installed.
7
- #
8
- # Copyright (c) 2005-2006 David Heinemeier Hansson
9
- #
10
- # Permission is hereby granted, free of charge, to any person obtaining
11
- # a copy of this software and associated documentation files (the
12
- # "Software"), to deal in the Software without restriction, including
13
- # without limitation the rights to use, copy, modify, merge, publish,
14
- # distribute, sublicense, and/or sell copies of the Software, and to
15
- # permit persons to whom the Software is furnished to do so, subject to
16
- # the following conditions:
17
- #
18
- # The above copyright notice and this permission notice shall be
19
- # included in all copies or substantial portions of the Software.
20
- #
21
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
-
29
- # activesupport/lib/activesupport/core_ext/module/attribute_accessors.rb
30
- #
31
- # Extends the module object with module and instance accessors for class attributes,
32
- # just like the native attr* accessors for instance attributes.
33
- unless defined?(ActiveSupport)
34
- class Module # :nodoc:
35
- def mattr_reader(*syms)
36
- syms.each do |sym|
37
- next if sym.is_a?(Hash)
38
- class_eval(<<-EOS, __FILE__, __LINE__)
39
- unless defined? @@#{sym}
40
- @@#{sym} = nil
41
- end
42
-
43
- def self.#{sym}
44
- @@#{sym}
45
- end
46
-
47
- def #{sym}
48
- @@#{sym}
49
- end
50
- EOS
51
- end
52
- end
53
-
54
- def mattr_writer(*syms)
55
- options = syms.last.is_a?(Hash) ? syms.pop : {}
56
- syms.each do |sym|
57
- class_eval(<<-EOS, __FILE__, __LINE__)
58
- unless defined? @@#{sym}
59
- @@#{sym} = nil
60
- end
61
-
62
- def self.#{sym}=(obj)
63
- @@#{sym} = obj
64
- end
65
-
66
- #{"
67
- def #{sym}=(obj)
68
- @@#{sym} = obj
69
- end
70
- " unless options[:instance_writer] == false }
71
- EOS
72
- end
73
- end
74
-
75
- def mattr_accessor(*syms)
76
- mattr_reader(*syms)
77
- mattr_writer(*syms)
78
- end
79
- end
80
-
81
- # activesupport/lib/activesupport/core_ext/class/attribute_accessors.rb
82
-
83
- # Extends the class object with class and instance accessors for class attributes,
84
- # just like the native attr* accessors for instance attributes.
85
- class Class # :nodoc:
86
- def cattr_reader(*syms)
87
- syms.flatten.each do |sym|
88
- next if sym.is_a?(Hash)
89
- class_eval(<<-EOS, __FILE__, __LINE__)
90
- unless defined? @@#{sym}
91
- @@#{sym} = nil
92
- end
93
-
94
- def self.#{sym}
95
- @@#{sym}
96
- end
97
-
98
- def #{sym}
99
- @@#{sym}
100
- end
101
- EOS
102
- end
103
- end
104
-
105
- def cattr_writer(*syms)
106
- options = syms.last.is_a?(Hash) ? syms.pop : {}
107
- syms.flatten.each do |sym|
108
- class_eval(<<-EOS, __FILE__, __LINE__)
109
- unless defined? @@#{sym}
110
- @@#{sym} = nil
111
- end
112
-
113
- def self.#{sym}=(obj)
114
- @@#{sym} = obj
115
- end
116
-
117
- #{"
118
- def #{sym}=(obj)
119
- @@#{sym} = obj
120
- end
121
- " unless options[:instance_writer] == false }
122
- EOS
123
- end
124
- end
125
-
126
- def cattr_accessor(*syms)
127
- cattr_reader(*syms)
128
- cattr_writer(*syms)
129
- end
130
- end
131
- end
@@ -1,11 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "quietbacktrace"
3
- s.version = "1.1.4"
4
- s.date = "2008-09-11"
5
- s.email = "dcroak@thoughtbot.com"
6
- s.homepage = "http://github.com/thoughtbot/quietbacktrace"
7
- s.summary = "Quiet Backtrace suppresses the noise in your Test::Unit backtrace."
8
- s.description = "Quiet Backtrace suppresses the noise in your Test::Unit backtrace. It also provides hooks for you to add additional silencers and filters."
9
- s.files = ["README.markdown", "quietbacktrace.gemspec", "lib/quietbacktrace.rb", "lib/aliasing.rb", "lib/attribute_accessors.rb", "MIT-LICENSE"]
10
- s.authors = ["thoughtbot, inc.", "Dan Croak", "James Golick"]
11
- end