Permalink
Browse files

bump the gemspec - removed mattr_accessor, alias_method_chain definit…

…ions, replaced with require activesupport
  • Loading branch information...
1 parent fbef4dc commit 7a4954fdd01657f9793b9e79054e2f8523407fc3 @croaky croaky committed Oct 2, 2008
Showing with 8 additions and 313 deletions.
  1. +3 −5 README.markdown
  2. +0 −89 lib/aliasing.rb
  3. +0 −131 lib/attribute_accessors.rb
  4. +2 −85 lib/quietbacktrace.rb
  5. +2 −2 quietbacktrace.gemspec
  6. +1 −1 test/quiet_backtrace_test.rb
View
@@ -7,7 +7,7 @@ It also provides hooks for you to add additional silencers and filters.
Install
-------
-sudo gem install quietbacktrace
+sudo gem install thoughtbot-quietbacktrace --source=http://gems.github.com
Usage
-----
@@ -70,15 +70,13 @@ Requirements
------------
* Test::Unit
-* aliasing.rb and attribute_accessors.rb, which are sniped from ActiveSupport and
- are included in the gem. They allow quietbacktrace.rb to use alias method chain,
- cattr accessor, and mattr accessor.
+* ActiveSupport (alias method chain, cattr accessor, & mattr accessor)
Resources
---------
* [mailing list](http://groups.google.com/group/quiet_backtrace)
-* [project site](http://rubyforge.org/projects/quietbacktrace)
+* [project site](http://github.com/thoughtbot/quietbacktrace)
Authors
-------
View
@@ -1,89 +0,0 @@
-# :stopdoc:
-#
-# Snipped directly from ActiveSupport from Rails 1.2.3
-# If Quiet Backtrace is run from a Rails app, the actual ActiveSupport
-# methods will be used. That way, alias_method_chain will not be
-# overridden in your Rails app if Quiet Backtrace is installed.
-#
-# Copyright (c) 2005-2006 David Heinemeier Hansson
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# activesupport/lib/activesupport/core_ext/module/aliasing.rb
-unless defined?(ActiveSupport)
- class Module # :nodoc:
- # Encapsulates the common pattern of:
- #
- # alias_method :foo_without_feature, :foo
- # alias_method :foo, :foo_with_feature
- #
- # With this, you simply do:
- #
- # alias_method_chain :foo, :feature
- #
- # And both aliases are set up for you.
- #
- # Query and bang methods (foo?, foo!) keep the same punctuation:
- #
- # alias_method_chain :foo?, :feature
- #
- # is equivalent to
- #
- # alias_method :foo_without_feature?, :foo?
- # alias_method :foo?, :foo_with_feature?
- #
- # so you can safely chain foo, foo?, and foo! with the same feature.
- def alias_method_chain(target, feature)
- # Strip out punctuation on predicates or bang methods since
- # e.g. target?_without_feature is not a valid method name.
- aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
- yield(aliased_target, punctuation) if block_given?
- alias_method "#{aliased_target}_without_#{feature}#{punctuation}", target
- alias_method target, "#{aliased_target}_with_#{feature}#{punctuation}"
- end
-
- # Allows you to make aliases for attributes, which includes
- # getter, setter, and query methods.
- #
- # Example:
- #
- # class Content < ActiveRecord::Base
- # # has a title attribute
- # end
- #
- # class Email < ActiveRecord::Base
- # alias_attribute :subject, :title
- # end
- #
- # e = Email.find(1)
- # e.title # => "Superstars"
- # e.subject # => "Superstars"
- # e.subject? # => true
- # e.subject = "Megastars"
- # e.title # => "Megastars"
- def alias_attribute(new_name, old_name)
- module_eval <<-STR, __FILE__, __LINE__+1
- def #{new_name}; #{old_name}; end
- def #{new_name}?; #{old_name}?; end
- def #{new_name}=(v); self.#{old_name} = v; end
- STR
- end
- end
-end
@@ -1,131 +0,0 @@
-# :stopdoc:
-#
-# Snipped directly from ActiveSupport from Rails 1.2.3
-# If Quiet Backtrace is run from a Rails app, the actual ActiveSupport
-# methods will be used. That way, mattr_accessor and cattr_accessor will
-# not be overridden in your Rails app if Quiet Backtrace is installed.
-#
-# Copyright (c) 2005-2006 David Heinemeier Hansson
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# activesupport/lib/activesupport/core_ext/module/attribute_accessors.rb
-#
-# Extends the module object with module and instance accessors for class attributes,
-# just like the native attr* accessors for instance attributes.
-unless defined?(ActiveSupport)
- class Module # :nodoc:
- def mattr_reader(*syms)
- syms.each do |sym|
- next if sym.is_a?(Hash)
- class_eval(<<-EOS, __FILE__, __LINE__)
- unless defined? @@#{sym}
- @@#{sym} = nil
- end
-
- def self.#{sym}
- @@#{sym}
- end
-
- def #{sym}
- @@#{sym}
- end
- EOS
- end
- end
-
- def mattr_writer(*syms)
- options = syms.last.is_a?(Hash) ? syms.pop : {}
- syms.each do |sym|
- class_eval(<<-EOS, __FILE__, __LINE__)
- unless defined? @@#{sym}
- @@#{sym} = nil
- end
-
- def self.#{sym}=(obj)
- @@#{sym} = obj
- end
-
- #{"
- def #{sym}=(obj)
- @@#{sym} = obj
- end
- " unless options[:instance_writer] == false }
- EOS
- end
- end
-
- def mattr_accessor(*syms)
- mattr_reader(*syms)
- mattr_writer(*syms)
- end
- end
-
- # activesupport/lib/activesupport/core_ext/class/attribute_accessors.rb
-
- # Extends the class object with class and instance accessors for class attributes,
- # just like the native attr* accessors for instance attributes.
- class Class # :nodoc:
- def cattr_reader(*syms)
- syms.flatten.each do |sym|
- next if sym.is_a?(Hash)
- class_eval(<<-EOS, __FILE__, __LINE__)
- unless defined? @@#{sym}
- @@#{sym} = nil
- end
-
- def self.#{sym}
- @@#{sym}
- end
-
- def #{sym}
- @@#{sym}
- end
- EOS
- end
- end
-
- def cattr_writer(*syms)
- options = syms.last.is_a?(Hash) ? syms.pop : {}
- syms.flatten.each do |sym|
- class_eval(<<-EOS, __FILE__, __LINE__)
- unless defined? @@#{sym}
- @@#{sym} = nil
- end
-
- def self.#{sym}=(obj)
- @@#{sym} = obj
- end
-
- #{"
- def #{sym}=(obj)
- @@#{sym} = obj
- end
- " unless options[:instance_writer] == false }
- EOS
- end
- end
-
- def cattr_accessor(*syms)
- cattr_reader(*syms)
- cattr_writer(*syms)
- end
- end
-end
View
@@ -1,89 +1,6 @@
-# = Quiet Backtrace
-#
-# Quiet Backtrace suppresses the noise in your Test::Unit backtrace.
-# It also provides hooks for you to add additional silencers and filters.
-#
-# == Install
-#
-# sudo gem install quietbacktrace
-#
-# == Usage
-#
-# Quiet Backtrace works by adding new attributes to Test::Unit::TestCase.
-# By default, their values are:
-# self.quiet_backtrace = true
-# self.backtrace_silencers = [:test_unit, :gem_root, :e1]
-# self.backtrace_filters = [:method_name]
-#
-# Silencers remove lines from the backtrace that return true for given conditions.
-# Filters modify the output of backtrace lines.
-#
-# Override the defaults by adding your own backtrace_silencers:
-# class Test::Unit::TestCase
-# self.backtrace_silencers :shoulda do |line|
-# line.include? 'vendor/plugins/shoulda'
-# end
-# end
-#
-# Or your own backtrace_filters:
-# class Test::Unit::TestCase
-# self.backtrace_filters :ruby_path do |line|
-# ruby_file_path = '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8'
-# line.slice!(0..(line =~ ruby_file_path)) if (line =~ ruby_file_path)
-# end
-# end
-#
-# Turn Quiet Backtrace off anywhere in your test suite by setting the flag to false:
-# Test::Unit::TestCase.quiet_backtrace = false
-#
-# == Rails-specific usage
-#
-# Install gemsonrails, add it your Rails app, then freeze quietbacktrace:
-#
-# * gem install gemsonrails
-# * cd rails-app-folder
-# * gemsonrails
-# * rake gems:freeze GEM=quietbacktrace
-#
-# Quiet Backtrace comes with an excellent Rails-specific silencer and filter.
-# They must be added (usually in test_helper.rb) because they are not turned on by default:
-# class Test::Unit::TestCase
-# self.backtrace_silencers << :rails_vendor
-# self.backtrace_filters << :rails_root
-# end
-#
-# Because Quiet Backtrace works by adding attributes onto Test::Unit::TestCase,
-# you can add and remove silencers and filters at any level in your test suite,
-# down to the individual test.
-#
-# == Resources
-#
-# * mailing list: http://groups.google.com/group/quiet_backtrace
-# * project site: http://rubyforge.org/projects/quietbacktrace
-#
-# == Authors
-#
-# * Dan Croak (dcroak@thoughtbot.com, http://dancroak.com)
-# * James Golick (james@giraffesoft.ca, http://jamesgolick.com)
-# * Joe Ferris (jferris@thoughtbot.com)
-#
-# Special thanks to the Boston.rb group (http://bostonrb.org)
-# for cultivating this idea at our inaugural hackfest.
-#
-# == Requirements
-#
-# * Test::Unit
-# * aliasing.rb and attribute_accessors.rb, which are snipped from ActiveSupport and
-# are included in the gem. They allow quiet_backtrace.rb to use alias_method_chain,
-# cattr_accessor, and mattr_accessor.
-#
-# == Copyright
-#
-# Copyright (c) 2007 Dan Croak, thoughtbot, inc., released under the MIT license
-
require 'test/unit'
-require File.expand_path(File.dirname(__FILE__) + '/attribute_accessors')
-require File.expand_path(File.dirname(__FILE__) + '/aliasing')
+require 'rubygems'
+require 'activesupport'
module QuietBacktrace # :nodoc: all
module BacktraceFilter
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = "quietbacktrace"
- s.version = "1.1.4"
- s.date = "2008-09-11"
+ s.version = "1.1.5"
+ s.date = "2008-10-0002"
s.email = "dcroak@thoughtbot.com"
s.homepage = "http://github.com/thoughtbot/quietbacktrace"
s.summary = "Quiet Backtrace suppresses the noise in your Test::Unit backtrace."
@@ -10,7 +10,7 @@
# context "Setting quiet backtrace to false" do
#
# setup do
-# self.quiet_backtrace = false
+# Test::Unit::TestCase.quiet_backtrace = false
# end
#
# should "keep the backtrace noisy" do

0 comments on commit 7a4954f

Please sign in to comment.