putsinator 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ .DS_Store
2
+ log/*.log
3
+ tmp/*
4
+ config/database.yml
5
+ db/*.sqlite3
6
+ coverage.data
7
+ coverage
8
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [name of plugin creator]
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.
@@ -0,0 +1,9 @@
1
+ === Putsinator
2
+
3
+ Prepends the file and line number of any 'puts' statement that occurs within a
4
+ test run, because the first step in reducing noisy test output is figuring out
5
+ where it came from.
6
+
7
+
8
+
9
+ Copyright (c) 2009 Toby Tripp, released under the MIT license
@@ -0,0 +1,37 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ begin
9
+ require 'jeweler'
10
+ Jeweler::Tasks.new do |gemspec|
11
+ gemspec.name = "putsinator"
12
+ gemspec.summary = "Assassinate extraneous test output."
13
+ gemspec.description = "Add File:Line to any 'puts' call made within a test."
14
+ gemspec.email = "toby.tripp+github@gmail.com"
15
+ gemspec.homepage = "http://github.com/tobytripp/Putsinator"
16
+ gemspec.authors = ["Toby Tripp"]
17
+ end
18
+ rescue LoadError
19
+ puts "Jeweler not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ desc 'Test the putsinator plugin.'
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'lib'
25
+ t.libs << 'test'
26
+ t.pattern = 'test/**/*_test.rb'
27
+ t.verbose = true
28
+ end
29
+
30
+ desc 'Generate documentation for the putsinator plugin.'
31
+ Rake::RDocTask.new(:rdoc) do |rdoc|
32
+ rdoc.rdoc_dir = 'rdoc'
33
+ rdoc.title = 'Putsinator'
34
+ rdoc.options << '--line-numbers' << '--inline-source'
35
+ rdoc.rdoc_files.include('README')
36
+ rdoc.rdoc_files.include('lib/**/*.rb')
37
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'putsinator' if RAILS_ENV == 'test'
@@ -0,0 +1 @@
1
+ # Install hook code here
@@ -0,0 +1,21 @@
1
+ module Kernel
2
+ def noisy_puts( *args )
3
+ file, line = caller[0].split(':')
4
+ file = File.basename file
5
+
6
+ default_puts "[#{file}:#{line}]", *args
7
+ end
8
+
9
+ alias_method :default_puts, :puts
10
+ alias_method :puts, :noisy_puts
11
+
12
+ def noisy_p( *args )
13
+ file, line = caller[0].split(':')
14
+ file = File.basename file
15
+
16
+ default_p "[#{file}:#{line}]", *args
17
+ end
18
+
19
+ alias_method :default_p, :p
20
+ alias_method :p, :noisy_p
21
+ end
@@ -0,0 +1,52 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{putsinator}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Toby Tripp"]
12
+ s.date = %q{2010-03-29}
13
+ s.description = %q{Add File:Line to any 'puts' call made within a test.}
14
+ s.email = %q{toby.tripp+github@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "MIT-LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "init.rb",
25
+ "install.rb",
26
+ "lib/putsinator.rb",
27
+ "putsinator.gemspec",
28
+ "test/putsinator_test.rb",
29
+ "test/test_helper.rb",
30
+ "uninstall.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/tobytripp/Putsinator}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.5}
36
+ s.summary = %q{Assassinate extraneous test output.}
37
+ s.test_files = [
38
+ "test/putsinator_test.rb",
39
+ "test/test_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ else
48
+ end
49
+ else
50
+ end
51
+ end
52
+
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ require "stringio"
4
+ require "putsinator"
5
+
6
+ class PutsinatorTest < Test::Unit::TestCase
7
+ def setup
8
+ @file = File.basename __FILE__
9
+ end
10
+
11
+ def test_that_puts_fingers_the_file_that_did_it
12
+ stringy = "I'm putsing from a test whoooo"
13
+
14
+ line = 0
15
+ out = capture_stdout do
16
+ line = __LINE__; puts stringy
17
+ end
18
+
19
+ assert_equal "[#{@file}:#{line}]\n#{stringy}\n", out.string
20
+ end
21
+
22
+ def test_that_p_fingers_the_culprit
23
+ string = "Foo"
24
+ line = 0
25
+ out = capture_stdout do
26
+ line = __LINE__; p string
27
+ end
28
+
29
+ assert_equal "\"[#{@file}:#{line}]\"\n#{string.inspect}\n", out.string
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require "test/unit"
3
+
4
+ module Kernel
5
+ def capture_stdout
6
+ out = StringIO.new
7
+ $stdout = out
8
+ yield
9
+ return out
10
+ ensure
11
+ $stdout = STDOUT
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: putsinator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Toby Tripp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-29 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Add File:Line to any 'puts' call made within a test.
17
+ email: toby.tripp+github@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - .gitignore
26
+ - MIT-LICENSE
27
+ - README.rdoc
28
+ - Rakefile
29
+ - VERSION
30
+ - init.rb
31
+ - install.rb
32
+ - lib/putsinator.rb
33
+ - putsinator.gemspec
34
+ - test/putsinator_test.rb
35
+ - test/test_helper.rb
36
+ - uninstall.rb
37
+ has_rdoc: true
38
+ homepage: http://github.com/tobytripp/Putsinator
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --charset=UTF-8
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.3.5
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: Assassinate extraneous test output.
65
+ test_files:
66
+ - test/putsinator_test.rb
67
+ - test/test_helper.rb