cucumber-peel 0.0.1
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/.gitignore +18 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +1 -0
- data/bin/cucumber-peel +6 -0
- data/cucumber-peel.gemspec +25 -0
- data/lib/cucumber_peel.rb +4 -0
- data/lib/cucumber_peel/cli.rb +21 -0
- data/lib/cucumber_peel/cucumber_actions.rb +25 -0
- data/lib/cucumber_peel/version.rb +3 -0
- data/spec/dummy/features/hello.feature +4 -0
- data/spec/dummy/features/step_definitions/hello_steps.rb +8 -0
- metadata +111 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Justin Searls
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# cucumber-peel
|
2
|
+
|
3
|
+
The indirection between gherkin in feature files and the location of step implementations (located in any arbitrarily named file and obfuscated by regex patterns) can be a moderate productivity drain when searching for the implementation of a given step.
|
4
|
+
|
5
|
+
This isn't much of a problem when your cucumber feature has a fast runtime, because Cucumber's default reporter prints the step implementation location in the margin, but running the entire feature to find out where a step lives can be quite cumbersome features
|
6
|
+
|
7
|
+
Here's how you use cucumber-peel
|
8
|
+
|
9
|
+
```
|
10
|
+
$ gem install cucumber-peel
|
11
|
+
$ cd my_project_root
|
12
|
+
$ bundle exec cucumber-peel
|
13
|
+
```
|
14
|
+
|
15
|
+
This will start a very simple REPL-like interface into which you can paste gherkin steps as you find them in your feature files.
|
16
|
+
|
17
|
+
```
|
18
|
+
Using the default profile...
|
19
|
+
|
20
|
+
Cucumber runtime loaded. Enter steps to search for.
|
21
|
+
> I am on the history reports page
|
22
|
+
/Users/justin/code/my_app/features/step_definitions/web_steps.rb:24
|
23
|
+
>
|
24
|
+
```
|
25
|
+
|
26
|
+
And then you can just hit Ctrl-C or type "exit" to quit.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/cucumber-peel
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cucumber_peel/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cucumber-peel"
|
8
|
+
spec.version = CucumberPeel::VERSION
|
9
|
+
spec.authors = ["Justin Searls"]
|
10
|
+
spec.email = ["searls@gmail.com"]
|
11
|
+
spec.description = %q{Helps you locate the implementation for a given step}
|
12
|
+
spec.summary = %q{Provides a CLI to search a project's step implementations for a given step example}
|
13
|
+
spec.homepage = "https://github.com/testdouble/cucumber-peel"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "cucumber", "~> 1.2"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'cucumber_peel/cucumber_actions'
|
2
|
+
|
3
|
+
module CucumberPeel
|
4
|
+
class Cli
|
5
|
+
include CucumberActions
|
6
|
+
|
7
|
+
def run
|
8
|
+
config = create_cucumber_configuration
|
9
|
+
runtime = start_cucumber(config)
|
10
|
+
puts "Cucumber runtime loaded. Enter steps to search for."
|
11
|
+
|
12
|
+
while true
|
13
|
+
print "> "
|
14
|
+
step_name = gets.chomp
|
15
|
+
break if step_name == "exit"
|
16
|
+
puts find_cucumber_step(runtime, step_name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
|
3
|
+
module CucumberPeel
|
4
|
+
module CucumberActions
|
5
|
+
def create_cucumber_configuration
|
6
|
+
require 'cucumber/cli/configuration'
|
7
|
+
Cucumber::Cli::Configuration.new.tap do |c|
|
8
|
+
c.parse!([])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_cucumber(configuration)
|
13
|
+
require 'cucumber/runtime'
|
14
|
+
Cucumber::Runtime.new(configuration).tap do |r|
|
15
|
+
r.send(:load_step_definitions)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def find_cucumber_step(runtime, name)
|
20
|
+
runtime.step_match(name).file_colon_line
|
21
|
+
rescue
|
22
|
+
"No step found: #{name}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-peel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Justin Searls
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cucumber
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Helps you locate the implementation for a given step
|
63
|
+
email:
|
64
|
+
- searls@gmail.com
|
65
|
+
executables:
|
66
|
+
- cucumber-peel
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/cucumber-peel
|
76
|
+
- cucumber-peel.gemspec
|
77
|
+
- lib/cucumber_peel.rb
|
78
|
+
- lib/cucumber_peel/cli.rb
|
79
|
+
- lib/cucumber_peel/cucumber_actions.rb
|
80
|
+
- lib/cucumber_peel/version.rb
|
81
|
+
- spec/dummy/features/hello.feature
|
82
|
+
- spec/dummy/features/step_definitions/hello_steps.rb
|
83
|
+
homepage: https://github.com/testdouble/cucumber-peel
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.8.23
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Provides a CLI to search a project's step implementations for a given step
|
108
|
+
example
|
109
|
+
test_files:
|
110
|
+
- spec/dummy/features/hello.feature
|
111
|
+
- spec/dummy/features/step_definitions/hello_steps.rb
|