diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f516d14 --- /dev/null +++ b/Rakefile @@ -0,0 +1,21 @@ +begin + require 'jeweler' +rescue LoadError + puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" + exit 1 +end +require 'rake/testtask' +require 'rake/rdoctask' +require 'rcov/rcovtask' +require "load_multi_rails_rake_tasks" + +Jeweler::Tasks.new do |s| + s.name = "no_peeping_toms" + s.summary = "Disables observers during testing, allowing you to write model tests that are completely decoupled from the observer." + s.description = s.summary + s.email = "pat.maddox@gmail.com" + s.homepage = "http://github.com/pat-maddox" + s.authors = ["Pat Maddox", "Brandon Keepers"] + s.add_dependency "activerecord", ['>= 1.1'] + s.test_files = Dir['spec/**/*'] +end diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/init.rb b/init.rb index de8fcd6..5f73bc6 100644 --- a/init.rb +++ b/init.rb @@ -1,3 +1 @@ -if "test" == RAILS_ENV - ActiveRecord::Observer.send :include, NoPeepingToms -end +require 'no_peeping_toms' if "test" == RAILS_ENV diff --git a/lib/no_peeping_toms.rb b/lib/no_peeping_toms.rb index 14d3ff5..93d8470 100644 --- a/lib/no_peeping_toms.rb +++ b/lib/no_peeping_toms.rb @@ -27,3 +27,5 @@ def with_observers(*observer_syms) end end end + +ActiveRecord::Observer.send :include, NoPeepingToms \ No newline at end of file diff --git a/no_peeping_toms.gemspec b/no_peeping_toms.gemspec new file mode 100644 index 0000000..2c9a808 --- /dev/null +++ b/no_peeping_toms.gemspec @@ -0,0 +1,52 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{no_peeping_toms} + s.version = "0.1.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Pat Maddox", "Brandon Keepers"] + s.date = %q{2009-08-17} + s.description = %q{Disables observers during testing, allowing you to write model tests that are completely decoupled from the observer.} + s.email = %q{pat.maddox@gmail.com} + s.extra_rdoc_files = [ + "README" + ] + s.files = [ + "README", + "init.rb", + "install.rb", + "lib/no_peeping_toms.rb", + "spec/db/database.yml", + "spec/db/schema.rb", + "spec/no_peeping_toms_spec.rb", + "spec/spec_helper.rb", + "tasks/no_peeping_toms_tasks.rake", + "uninstall.rb" + ] + s.homepage = %q{http://github.com/pat-maddox} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.3} + s.summary = %q{Disables observers during testing, allowing you to write model tests that are completely decoupled from the observer.} + s.test_files = [ + "spec/db", + "spec/db/database.yml", + "spec/db/schema.rb", + "spec/no_peeping_toms_spec.rb", + "spec/spec_helper.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.1"]) + else + s.add_dependency(%q, [">= 1.1"]) + end + else + s.add_dependency(%q, [">= 1.1"]) + end +end