rspec_vim_formatter 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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +62 -0
- data/Rakefile +1 -0
- data/image/rspec_vim_formatter.gif +0 -0
- data/lib/rspec_vim_formatter.rb +39 -0
- data/rspec_vim_formatter.gemspec +42 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da9c9b54d1684e3dad073e0d5b6c5a9b1dc329df
|
4
|
+
data.tar.gz: cecbf642adc5c91e71e5856b3f4585ff22d67657
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5fec5dc53265730cc310a8915368d45f3ce78a9cf84d7a4cbe93faf04116b2211d582922510f725166a69d234455ecea6e40b0a4e8bf24f8a21443140f1e857
|
7
|
+
data.tar.gz: 7e576b3a64dc2ad9ad930fa80b53d33be261a53a64612eb30baa2543b0bf1d68976730401c046a5315d0305a74bbe4f3b158529a7d25c3cd0b36ac6d06580f52
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Mark Lorenz
|
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,62 @@
|
|
1
|
+
# RspecVimFormatter
|
2
|
+
|
3
|
+
Allow rspec to output in a format that VIM's quickfix understands:
|
4
|
+
|
5
|
+
```
|
6
|
+
app/controllers/people_controller.rb:5: GET /peopleworks! (now write some real specs): Could not find table 'people'
|
7
|
+
```
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
I recommend that you install this as a global gem, since choice of editor is a personal preference.
|
12
|
+
|
13
|
+
```
|
14
|
+
$ gem install rspec_vim_formatter
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
**Simple Usage**
|
20
|
+
```sh
|
21
|
+
bundle exec rspec --format RspecVimFormatter --out quickfix.out --format progress
|
22
|
+
```
|
23
|
+
|
24
|
+
**Like a Baus**
|
25
|
+
```viml
|
26
|
+
" ~/.vimrc
|
27
|
+
|
28
|
+
" install thoughtbot's `vim-rspec`
|
29
|
+
Bundle 'thoughtbot/vim-rspec'
|
30
|
+
|
31
|
+
" vim-rspec mappings
|
32
|
+
nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
|
33
|
+
nnoremap <Leader>specn :call RunNearestSpec()<CR>
|
34
|
+
nnoremap <Leader>spec :call RunLastSpec()<CR>
|
35
|
+
nnoremap <Leader>a :call RunAllSpecs()<CR>
|
36
|
+
|
37
|
+
" <leader>k to open the spec output in quickfix
|
38
|
+
map <leader>k :cg quickfix.out \| cw<cr>
|
39
|
+
|
40
|
+
" dump the spec running command into a fifo
|
41
|
+
let rspec_command = "bundle exec rspec {spec}"
|
42
|
+
let rspec_options = " --format RspecVimFormatter --out quickfix.out --format progress"
|
43
|
+
let g:rspec_command = "echom system('echo \"" . rspec_command . rspec_options . "\" >> ~/.wrench')"
|
44
|
+
```
|
45
|
+
|
46
|
+
```sh
|
47
|
+
# run the commands from the fifo in a loop
|
48
|
+
mkfifo ~/.wrench
|
49
|
+
while true; do cmd=`cat ~/.wrench`; clear; date +%s; echo "$cmd"; sh -c "$cmd"; done
|
50
|
+
```
|
51
|
+
|
52
|
+
Now you can `<leader>t`, to run the current spec asynchronously, and `<leader>k` to quickly jump to the failure!
|
53
|
+
|
54
|
+

|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
1. Fork it
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
61
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
62
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
Binary file
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rspec/core/formatters/base_text_formatter'
|
2
|
+
|
3
|
+
class RspecVimFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
4
|
+
|
5
|
+
def example_failed example
|
6
|
+
exception = example.execution_result[:exception]
|
7
|
+
return unless path = extract_path(exception)
|
8
|
+
|
9
|
+
message = format_message exception.message
|
10
|
+
path = format_caller(path)
|
11
|
+
output.puts "#{path}: #{example.example_group.description.strip}" +
|
12
|
+
"#{example.description.strip}: #{message.strip}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def example_pending *args; end
|
16
|
+
def dump_failures *args; end
|
17
|
+
def dump_pending *args; end
|
18
|
+
def message msg; end
|
19
|
+
def dump_summary *args; end
|
20
|
+
def seed *args; end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def format_message msg
|
25
|
+
msg.gsub("\n", ' ')[0,80]
|
26
|
+
end
|
27
|
+
|
28
|
+
def extract_path exception
|
29
|
+
exception.backtrace.each do |frame|
|
30
|
+
case frame
|
31
|
+
when %r{\b(spec/.*_spec\.rb:\d+)(?::|\z)}
|
32
|
+
return $1
|
33
|
+
when %r{\b(app/.*\.rb:\d+)(?::|\z)}
|
34
|
+
return $1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rspec_vim_formatter"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Mark Lorenz"]
|
9
|
+
spec.email = ["markjlorenz@dapplebeforedawn.com"]
|
10
|
+
spec.description = %q{output from rspec in VIMs quickfix format}
|
11
|
+
spec.summary = <<-SUMMARY
|
12
|
+
```
|
13
|
+
# running this command
|
14
|
+
bundle exec rspec --format RspecVimFormatter --out quickfix.out --format progress
|
15
|
+
```
|
16
|
+
|
17
|
+
```
|
18
|
+
# produces this quickfix.out
|
19
|
+
app/controllers/people_controller.rb:5: GET /peopleworks! (now write some real specs): Could not find table 'people'
|
20
|
+
```
|
21
|
+
|
22
|
+
Now you can load it in vim:
|
23
|
+
```
|
24
|
+
:cg quickfix.out
|
25
|
+
:cw
|
26
|
+
```
|
27
|
+
|
28
|
+
see `:help cw` for more information about VIM's quickfix
|
29
|
+
SUMMARY
|
30
|
+
spec.homepage = ""
|
31
|
+
spec.license = "MIT"
|
32
|
+
|
33
|
+
spec.files = `git ls-files`.split($/)
|
34
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
35
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
39
|
+
spec.add_development_dependency "rake"
|
40
|
+
|
41
|
+
spec.add_dependency "rspec", ">= 2.0.0"
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec_vim_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Lorenz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
55
|
+
description: output from rspec in VIMs quickfix format
|
56
|
+
email:
|
57
|
+
- markjlorenz@dapplebeforedawn.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- image/rspec_vim_formatter.gif
|
68
|
+
- lib/rspec_vim_formatter.rb
|
69
|
+
- rspec_vim_formatter.gemspec
|
70
|
+
homepage: ''
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.2.2
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: '``` # running this command bundle exec rspec --format RspecVimFormatter
|
94
|
+
--out quickfix.out --format progress ``` ``` # produces this quickfix.out app/controllers/people_controller.rb:5:
|
95
|
+
GET /peopleworks! (now write some real specs): Could not find table ''people'' ``` Now
|
96
|
+
you can load it in vim: ``` :cg quickfix.out :cw ``` see `:help cw` for more information
|
97
|
+
about VIM''s quickfix'
|
98
|
+
test_files: []
|