ptus 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/LICENSE +28 -0
  2. data/README.rdoc +31 -0
  3. data/lib/ptus.rb +6 -0
  4. metadata +57 -0
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2011, Nathaniel Ritmeyer
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name Nathaniel Ritmeyer nor the names of contributors to
15
+ this software may be used to endorse or promote products derived from this
16
+ software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
19
+ IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
22
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,31 @@
1
+ ==ptus
2
+ Author: Nat Ritmeyer (http://www.natontesting.com)
3
+ ===Intro
4
+ I remember one colleague in particular who used to often type 'ptus' into his ruby code instead of 'puts'. Every time he made the mistake, he would explode in a rage with himself when the code ran and failed: "Just because of a stupid [expletive] typo!!!". He could never break the habit, so we wrote a monkey patch that would allow his code to run, but the line of code containing the offending typo would be flagged. "Everyone's a winner": his code would run, his typo would be flagged, and since the monkey patch lived on his machine and never got checked in (svn ignore!), 'ptus' didn't creep into the codebase.
5
+
6
+ A few years on, I now find myself typing 'ptus' enough for it to begin to irritate me. Age related, maybe. So I've rewritten the code and bundled it up properly into this gem.
7
+
8
+ ===Installation
9
+ Not difficult:
10
+
11
+ gem install ptus
12
+
13
+ ===Usage
14
+
15
+ Simply require the gem, and make as many 'ptus' typos as you want!
16
+
17
+ require 'rubygems'
18
+ require 'ptus'
19
+
20
+ puts "This is right"
21
+ ptus "This is wrong" #=> Used to cause your app to die...
22
+ puts "This is also right"
23
+
24
+ Writing code like the above will no longer kill your app at runtime; instead it will run just fine, but you'll get the following warning:
25
+
26
+ This is right
27
+ Change 'ptus' to 'puts' here: my_file.rb:4:in `<main>'
28
+ This is wrong
29
+ This is also right
30
+
31
+ Though this gem is partly in in jest, it would sadly be useful to a lot of people ;)
@@ -0,0 +1,6 @@
1
+ module Kernel
2
+ def ptus(input)
3
+ puts "Change 'ptus' to 'puts' here: #{caller.first}"
4
+ puts input
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ptus
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "1.0"
6
+ platform: ruby
7
+ authors:
8
+ - Nat Ritmeyer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-09-16 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: Your 'ptus' typo sins will be forgiven, but not forgotten
17
+ email:
18
+ - nat@natontesting.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - lib/ptus.rb
27
+ - LICENSE
28
+ - README.rdoc
29
+ homepage: http://github.com/natritmeyer/ptus
30
+ licenses: []
31
+
32
+ post_install_message:
33
+ rdoc_options: []
34
+
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ requirements: []
50
+
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.10
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: If you write 'ptus', it will work like 'puts'; but the offending line will be flagged
56
+ test_files: []
57
+