putsinator 1.0.0 → 1.1.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.
data/Rakefile CHANGED
@@ -1,24 +1,10 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  desc 'Default: run unit tests.'
6
6
  task :default => :test
7
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
8
  desc 'Test the putsinator plugin.'
23
9
  Rake::TestTask.new(:test) do |t|
24
10
  t.libs << 'lib'
@@ -2,20 +2,21 @@ module Kernel
2
2
  def noisy_puts( *args )
3
3
  file, line = caller[0].split(':')
4
4
  file = File.basename file
5
-
5
+
6
6
  default_puts "[#{file}:#{line}]", *args
7
7
  end
8
-
8
+
9
9
  alias_method :default_puts, :puts
10
10
  alias_method :puts, :noisy_puts
11
-
11
+
12
12
  def noisy_p( *args )
13
13
  file, line = caller[0].split(':')
14
14
  file = File.basename file
15
-
15
+
16
16
  default_p "[#{file}:#{line}]", *args
17
17
  end
18
-
18
+
19
19
  alias_method :default_p, :p
20
20
  alias_method :p, :noisy_p
21
+ alias_method :warn, :noisy_p
21
22
  end
@@ -1,11 +1,8 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
3
  Gem::Specification.new do |s|
7
4
  s.name = %q{putsinator}
8
- s.version = "1.0.0"
5
+ s.version = "1.1.0"
9
6
 
10
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
8
  s.authors = ["Toby Tripp"]
@@ -7,18 +7,18 @@ class PutsinatorTest < Test::Unit::TestCase
7
7
  def setup
8
8
  @file = File.basename __FILE__
9
9
  end
10
-
10
+
11
11
  def test_that_puts_fingers_the_file_that_did_it
12
12
  stringy = "I'm putsing from a test whoooo"
13
-
13
+
14
14
  line = 0
15
15
  out = capture_stdout do
16
16
  line = __LINE__; puts stringy
17
17
  end
18
-
18
+
19
19
  assert_equal "[#{@file}:#{line}]\n#{stringy}\n", out.string
20
20
  end
21
-
21
+
22
22
  def test_that_p_fingers_the_culprit
23
23
  string = "Foo"
24
24
  line = 0
@@ -28,4 +28,14 @@ class PutsinatorTest < Test::Unit::TestCase
28
28
 
29
29
  assert_equal "\"[#{@file}:#{line}]\"\n#{string.inspect}\n", out.string
30
30
  end
31
+
32
+ def test_that_warn_fingers_the_culprit
33
+ string = "Foo"
34
+ line = 0
35
+ out = capture_stdout do
36
+ line = __LINE__; warn string
37
+ end
38
+
39
+ assert_equal "\"[#{@file}:#{line}]\"\n#{string.inspect}\n", out.string
40
+ end
31
41
  end
@@ -5,9 +5,11 @@ module Kernel
5
5
  def capture_stdout
6
6
  out = StringIO.new
7
7
  $stdout = out
8
+ $stderr = out
8
9
  yield
9
10
  return out
10
11
  ensure
11
12
  $stdout = STDOUT
13
+ $stderr = STDERR
12
14
  end
13
15
  end
metadata CHANGED
@@ -1,27 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: putsinator
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Toby Tripp
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2010-03-29 00:00:00 -05:00
13
- default_executable:
12
+ date: 2010-03-29 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
14
  description: Add File:Line to any 'puts' call made within a test.
17
15
  email: toby.tripp+github@gmail.com
18
16
  executables: []
19
-
20
17
  extensions: []
21
-
22
- extra_rdoc_files:
18
+ extra_rdoc_files:
23
19
  - README.rdoc
24
- files:
20
+ files:
25
21
  - .gitignore
26
22
  - MIT-LICENSE
27
23
  - README.rdoc
@@ -34,34 +30,31 @@ files:
34
30
  - test/putsinator_test.rb
35
31
  - test/test_helper.rb
36
32
  - uninstall.rb
37
- has_rdoc: true
38
33
  homepage: http://github.com/tobytripp/Putsinator
39
34
  licenses: []
40
-
41
35
  post_install_message:
42
- rdoc_options:
36
+ rdoc_options:
43
37
  - --charset=UTF-8
44
- require_paths:
38
+ require_paths:
45
39
  - 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:
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
58
52
  requirements: []
59
-
60
53
  rubyforge_project:
61
- rubygems_version: 1.3.5
54
+ rubygems_version: 1.8.23
62
55
  signing_key:
63
56
  specification_version: 3
64
57
  summary: Assassinate extraneous test output.
65
- test_files:
58
+ test_files:
66
59
  - test/putsinator_test.rb
67
60
  - test/test_helper.rb