tapp 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +17 -0
- data/README.rdoc +2 -2
- data/lib/tapp/command.rb +3 -1
- data/lib/tapp/version.rb +1 -1
- data/lib/tapp.rb +23 -5
- data/spec/acceptance/tapp.feature +17 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/steps/tapp_steps.rb +18 -0
- data/tapp.gemspec +1 -0
- metadata +26 -7
- data/CHANGELOG.rdoc +0 -11
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-r turnip
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= tapp
|
1
|
+
= tapp {<img src="https://secure.travis-ci.org/esminc/tapp.png?branch=master" alt="Build Status" />}[http://travis-ci.org/esminc/tapp]
|
2
2
|
|
3
3
|
== Usage
|
4
4
|
|
@@ -42,7 +42,7 @@ examples of use:
|
|
42
42
|
* Send me a pull request. Bonus points for topic branches.
|
43
43
|
|
44
44
|
== Contributors
|
45
|
-
see https://github.com/esminc/tapp/
|
45
|
+
see https://github.com/esminc/tapp/contributors
|
46
46
|
|
47
47
|
== Copyright
|
48
48
|
|
data/lib/tapp/command.rb
CHANGED
@@ -4,7 +4,9 @@ module Tapp
|
|
4
4
|
class Command < Thor
|
5
5
|
desc 'grep [<git-grep-options>]', 'Print lines using tapp'
|
6
6
|
def grep(*)
|
7
|
-
|
7
|
+
opts = ['--word-regexp', '-e', 'tapp', '-e', 'taputs', '-e', 'taap', *ARGV.drop(1)]
|
8
|
+
git_grep = ['git', 'grep', opts].flatten.join(' ')
|
9
|
+
puts `#{git_grep}`.gsub(/^Gemfile(\.lock)?:.+?\n/, '')
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
data/lib/tapp/version.rb
CHANGED
data/lib/tapp.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'tapp/version'
|
2
|
-
require 'pp'
|
3
2
|
|
4
3
|
module Tapp
|
5
4
|
class << self
|
@@ -15,8 +14,18 @@ end
|
|
15
14
|
|
16
15
|
class Object
|
17
16
|
def tapp
|
18
|
-
|
19
|
-
|
17
|
+
require 'pp'
|
18
|
+
|
19
|
+
Object.module_eval do
|
20
|
+
remove_method :tapp
|
21
|
+
|
22
|
+
def tapp
|
23
|
+
Tapp.report_called
|
24
|
+
tap { pp block_given? ? yield(self) : self }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
tapp
|
20
29
|
end
|
21
30
|
|
22
31
|
def taputs
|
@@ -25,9 +34,18 @@ class Object
|
|
25
34
|
end
|
26
35
|
|
27
36
|
def taap
|
28
|
-
Tapp.report_called
|
29
37
|
require 'ap'
|
30
|
-
|
38
|
+
|
39
|
+
Object.module_eval do
|
40
|
+
remove_method :taap
|
41
|
+
|
42
|
+
def taap
|
43
|
+
Tapp.report_called
|
44
|
+
tap { ap block_given? ? yield(self) : self }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
taap
|
31
49
|
rescue LoadError
|
32
50
|
warn "Sorry, you need to install awesome_print: `gem install awesome_print`"
|
33
51
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Object#tapp
|
2
|
+
|
3
|
+
Scenario: Call tapp within methods chain
|
4
|
+
Given I have the following code:
|
5
|
+
"""
|
6
|
+
require 'tapp'
|
7
|
+
|
8
|
+
(1..5).tapp.select(&:odd?).tapp.inject(&:+)
|
9
|
+
"""
|
10
|
+
|
11
|
+
When Ruby it
|
12
|
+
|
13
|
+
Then I should see:
|
14
|
+
"""
|
15
|
+
1..5
|
16
|
+
[1, 3, 5]
|
17
|
+
"""
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
step "I have the following code:" do |code|
|
2
|
+
@code = code
|
3
|
+
end
|
4
|
+
|
5
|
+
step "Ruby it" do
|
6
|
+
stdout = StringIO.new
|
7
|
+
$stdout = stdout
|
8
|
+
begin
|
9
|
+
eval @code
|
10
|
+
ensure
|
11
|
+
$stdout = STDOUT
|
12
|
+
end
|
13
|
+
@output = stdout.string.chop
|
14
|
+
end
|
15
|
+
|
16
|
+
step "I should see:" do |output|
|
17
|
+
@output.should == output
|
18
|
+
end
|
data/tapp.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &12842600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12842600
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: turnip
|
27
|
+
requirement: &12842140 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *12842140
|
25
36
|
description: tap { pp self }
|
26
37
|
email:
|
27
38
|
- ursm@ursm.jp
|
@@ -31,7 +42,9 @@ extensions: []
|
|
31
42
|
extra_rdoc_files: []
|
32
43
|
files:
|
33
44
|
- .gitignore
|
34
|
-
-
|
45
|
+
- .rspec
|
46
|
+
- .travis.yml
|
47
|
+
- CHANGELOG.md
|
35
48
|
- Gemfile
|
36
49
|
- LICENSE
|
37
50
|
- README.rdoc
|
@@ -40,6 +53,9 @@ files:
|
|
40
53
|
- lib/tapp.rb
|
41
54
|
- lib/tapp/command.rb
|
42
55
|
- lib/tapp/version.rb
|
56
|
+
- spec/acceptance/tapp.feature
|
57
|
+
- spec/spec_helper.rb
|
58
|
+
- spec/steps/tapp_steps.rb
|
43
59
|
- tapp.gemspec
|
44
60
|
homepage: http://github.com/esminc/tapp
|
45
61
|
licenses: []
|
@@ -61,8 +77,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
77
|
version: '0'
|
62
78
|
requirements: []
|
63
79
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.15
|
65
81
|
signing_key:
|
66
82
|
specification_version: 3
|
67
83
|
summary: tap { pp self }
|
68
|
-
test_files:
|
84
|
+
test_files:
|
85
|
+
- spec/acceptance/tapp.feature
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- spec/steps/tapp_steps.rb
|