quietbacktrace 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.1.0 / 2007-12-03
2
+
3
+ * Protected the ActiveSupport snippets with unless defined?(ActiveSupport).
4
+ * That way, alias_method_chain, etc. won't be overridden in Rails apps.
5
+
1
6
  == 0.0.9 / 2007-12-03
2
7
 
3
8
  * Fixed file path bugs with File.expand_path
data/Manifest.txt CHANGED
@@ -2,7 +2,6 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
- bin/quietbacktrace
6
5
  init.rb
7
6
  lib/aliasing.rb
8
7
  lib/attribute_accessors.rb
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
  require './lib/quietbacktrace.rb'
6
6
 
7
- Hoe.new('quietbacktrace', '0.0.9') do |p|
7
+ Hoe.new('quietbacktrace', '0.1.0') do |p|
8
8
  p.rubyforge_name = 'quietbacktrace'
9
9
  p.author = 'Dan Croak'
10
10
  p.email = 'dcroak@thoughtbot.com'
data/lib/aliasing.rb CHANGED
@@ -1,4 +1,10 @@
1
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
+ #
2
8
  # Copyright (c) 2005-2006 David Heinemeier Hansson
3
9
  #
4
10
  # Permission is hereby granted, free of charge, to any person obtaining
@@ -21,62 +27,63 @@
21
27
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
28
 
23
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
24
61
 
25
- class Module # :nodoc:
26
- # Encapsulates the common pattern of:
27
- #
28
- # alias_method :foo_without_feature, :foo
29
- # alias_method :foo, :foo_with_feature
30
- #
31
- # With this, you simply do:
32
- #
33
- # alias_method_chain :foo, :feature
34
- #
35
- # And both aliases are set up for you.
36
- #
37
- # Query and bang methods (foo?, foo!) keep the same punctuation:
38
- #
39
- # alias_method_chain :foo?, :feature
40
- #
41
- # is equivalent to
42
- #
43
- # alias_method :foo_without_feature?, :foo?
44
- # alias_method :foo?, :foo_with_feature?
45
- #
46
- # so you can safely chain foo, foo?, and foo! with the same feature.
47
- def alias_method_chain(target, feature)
48
- # Strip out punctuation on predicates or bang methods since
49
- # e.g. target?_without_feature is not a valid method name.
50
- aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
51
- yield(aliased_target, punctuation) if block_given?
52
- alias_method "#{aliased_target}_without_#{feature}#{punctuation}", target
53
- alias_method target, "#{aliased_target}_with_#{feature}#{punctuation}"
54
- end
55
-
56
- # Allows you to make aliases for attributes, which includes
57
- # getter, setter, and query methods.
58
- #
59
- # Example:
60
- #
61
- # class Content < ActiveRecord::Base
62
- # # has a title attribute
63
- # end
64
- #
65
- # class Email < ActiveRecord::Base
66
- # alias_attribute :subject, :title
67
- # end
68
- #
69
- # e = Email.find(1)
70
- # e.title # => "Superstars"
71
- # e.subject # => "Superstars"
72
- # e.subject? # => true
73
- # e.subject = "Megastars"
74
- # e.title # => "Megastars"
75
- def alias_attribute(new_name, old_name)
76
- module_eval <<-STR, __FILE__, __LINE__+1
77
- def #{new_name}; #{old_name}; end
78
- def #{new_name}?; #{old_name}?; end
79
- def #{new_name}=(v); self.#{old_name} = v; end
80
- STR
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
81
88
  end
82
89
  end
@@ -1,4 +1,10 @@
1
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
+ #
2
8
  # Copyright (c) 2005-2006 David Heinemeier Hansson
3
9
  #
4
10
  # Permission is hereby granted, free of charge, to any person obtaining
@@ -24,100 +30,102 @@
24
30
  #
25
31
  # Extends the module object with module and instance accessors for class attributes,
26
32
  # just like the native attr* accessors for instance attributes.
27
- class Module # :nodoc:
28
- def mattr_reader(*syms)
29
- syms.each do |sym|
30
- next if sym.is_a?(Hash)
31
- class_eval(<<-EOS, __FILE__, __LINE__)
32
- unless defined? @@#{sym}
33
- @@#{sym} = nil
34
- end
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
35
42
 
36
- def self.#{sym}
37
- @@#{sym}
38
- end
43
+ def self.#{sym}
44
+ @@#{sym}
45
+ end
39
46
 
40
- def #{sym}
41
- @@#{sym}
42
- end
43
- EOS
47
+ def #{sym}
48
+ @@#{sym}
49
+ end
50
+ EOS
51
+ end
44
52
  end
45
- end
46
53
 
47
- def mattr_writer(*syms)
48
- options = syms.last.is_a?(Hash) ? syms.pop : {}
49
- syms.each do |sym|
50
- class_eval(<<-EOS, __FILE__, __LINE__)
51
- unless defined? @@#{sym}
52
- @@#{sym} = nil
53
- end
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
54
61
 
55
- def self.#{sym}=(obj)
56
- @@#{sym} = obj
57
- end
62
+ def self.#{sym}=(obj)
63
+ @@#{sym} = obj
64
+ end
58
65
 
59
- #{"
60
- def #{sym}=(obj)
61
- @@#{sym} = obj
62
- end
63
- " unless options[:instance_writer] == false }
64
- EOS
66
+ #{"
67
+ def #{sym}=(obj)
68
+ @@#{sym} = obj
69
+ end
70
+ " unless options[:instance_writer] == false }
71
+ EOS
72
+ end
65
73
  end
66
- end
67
74
 
68
- def mattr_accessor(*syms)
69
- mattr_reader(*syms)
70
- mattr_writer(*syms)
75
+ def mattr_accessor(*syms)
76
+ mattr_reader(*syms)
77
+ mattr_writer(*syms)
78
+ end
71
79
  end
72
- end
73
80
 
74
- # activesupport/lib/activesupport/core_ext/class/attribute_accessors.rb
81
+ # activesupport/lib/activesupport/core_ext/class/attribute_accessors.rb
75
82
 
76
- # Extends the class object with class and instance accessors for class attributes,
77
- # just like the native attr* accessors for instance attributes.
78
- class Class # :nodoc:
79
- def cattr_reader(*syms)
80
- syms.flatten.each do |sym|
81
- next if sym.is_a?(Hash)
82
- class_eval(<<-EOS, __FILE__, __LINE__)
83
- unless defined? @@#{sym}
84
- @@#{sym} = nil
85
- end
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
86
93
 
87
- def self.#{sym}
88
- @@#{sym}
89
- end
94
+ def self.#{sym}
95
+ @@#{sym}
96
+ end
90
97
 
91
- def #{sym}
92
- @@#{sym}
93
- end
94
- EOS
98
+ def #{sym}
99
+ @@#{sym}
100
+ end
101
+ EOS
102
+ end
95
103
  end
96
- end
97
104
 
98
- def cattr_writer(*syms)
99
- options = syms.last.is_a?(Hash) ? syms.pop : {}
100
- syms.flatten.each do |sym|
101
- class_eval(<<-EOS, __FILE__, __LINE__)
102
- unless defined? @@#{sym}
103
- @@#{sym} = nil
104
- end
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
105
112
 
106
- def self.#{sym}=(obj)
107
- @@#{sym} = obj
108
- end
113
+ def self.#{sym}=(obj)
114
+ @@#{sym} = obj
115
+ end
109
116
 
110
- #{"
111
- def #{sym}=(obj)
112
- @@#{sym} = obj
113
- end
114
- " unless options[:instance_writer] == false }
115
- EOS
117
+ #{"
118
+ def #{sym}=(obj)
119
+ @@#{sym} = obj
120
+ end
121
+ " unless options[:instance_writer] == false }
122
+ EOS
123
+ end
116
124
  end
117
- end
118
125
 
119
- def cattr_accessor(*syms)
120
- cattr_reader(*syms)
121
- cattr_writer(*syms)
126
+ def cattr_accessor(*syms)
127
+ cattr_reader(*syms)
128
+ cattr_writer(*syms)
129
+ end
122
130
  end
123
131
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: quietbacktrace
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.9
6
+ version: 0.1.0
7
7
  date: 2007-12-03 00:00:00 -05:00
8
8
  summary: quiet_backtrace suppresses the noise in your Test::Unit backtrace. It also provides hooks for you to add additional filters.
9
9
  require_paths:
@@ -33,7 +33,6 @@ files:
33
33
  - Manifest.txt
34
34
  - README.txt
35
35
  - Rakefile
36
- - bin/quietbacktrace
37
36
  - init.rb
38
37
  - lib/aliasing.rb
39
38
  - lib/attribute_accessors.rb
@@ -48,8 +47,8 @@ extra_rdoc_files:
48
47
  - History.txt
49
48
  - Manifest.txt
50
49
  - README.txt
51
- executables:
52
- - quietbacktrace
50
+ executables: []
51
+
53
52
  extensions: []
54
53
 
55
54
  requirements: []
data/bin/quietbacktrace DELETED
File without changes