cadre 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cadre +6 -0
- data/default_files/config.yaml +9 -0
- data/default_files/sounds/error +0 -0
- data/default_files/sounds/failure +0 -0
- data/default_files/sounds/success +0 -0
- data/default_files/templates/coverage-results.vim.erb +13 -0
- data/default_files/templates/plugin.vim +155 -0
- data/default_files/templates/rspec-config +7 -0
- data/default_files/templates/simplecov-config +9 -0
- data/lib/cadre/command-line.rb +39 -0
- data/lib/cadre/config.rb +50 -0
- data/lib/cadre/growl/notifier.rb +27 -0
- data/lib/cadre/libnotify/notifier.rb +36 -0
- data/lib/cadre/rspec/notify-on-complete-formatter.rb +43 -0
- data/lib/cadre/rspec/quickfix.rb +59 -0
- data/lib/cadre/rspec/true-feelings.rb +9 -0
- data/lib/cadre/rspec.rb +3 -0
- data/lib/cadre/simplecov/vim-formatter.rb +65 -0
- data/lib/cadre/simplecov.rb +1 -0
- data/lib/cadre/valise.rb +17 -0
- data/spec/simplecov/formatter.rb +43 -0
- data/spec_help/gem_test_suite.rb +17 -0
- metadata +150 -0
data/bin/cadre
ADDED
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"simplecov results template
|
2
|
+
let s:generatedTime = <%= Time.now.to_i %>
|
3
|
+
let s:coverageResults = {
|
4
|
+
<% results.each_pair do |file, coverage|
|
5
|
+
%>\'<%= file %>': {
|
6
|
+
\ 'hits': <%= coverage[:hits].inspect %>,
|
7
|
+
\ 'misses': <%= coverage[:misses].inspect%>,
|
8
|
+
\ 'ignored': <%= coverage[:ignored].inspect%>
|
9
|
+
\ },
|
10
|
+
<% end%>
|
11
|
+
\}
|
12
|
+
call AddSimplecovResults(expand("<sfile>:p"), s:coverageResults)
|
13
|
+
"end template
|
@@ -0,0 +1,155 @@
|
|
1
|
+
""" Test Ally Vim plugin
|
2
|
+
"hi HitLine ctermbg=Cyan guibg=Cyan
|
3
|
+
"hi MissLine ctermbg=Magenta guibg=Magenta
|
4
|
+
"hi IgnoreLine ctermbg=Black guibg=Black
|
5
|
+
|
6
|
+
hi HitSign ctermfg=6 cterm=bold gui=bold guifg=Green
|
7
|
+
hi MissSign ctermfg=Red cterm=bold gui=bold guifg=Red
|
8
|
+
hi IgnoreSign ctermfg=6 cterm=bold gui=bold guifg=Grey
|
9
|
+
"
|
10
|
+
sign define hit linehl=HitLine texthl=HitSign text=✔
|
11
|
+
sign define miss linehl=MissLine texthl=MissSign text=✘
|
12
|
+
sign define ignored linehl=IgnoredLine texthl=IgnoredSign text=◌
|
13
|
+
|
14
|
+
let s:coverageFileRelPath = ".cadre/coverage.vim"
|
15
|
+
|
16
|
+
let s:coverageFtimes = {}
|
17
|
+
let s:allCoverage = {}
|
18
|
+
|
19
|
+
function! AddSimplecovResults(file, results)
|
20
|
+
let s:allCoverage[fnamemodify(a:file, ":p")] = a:results
|
21
|
+
endfunction
|
22
|
+
|
23
|
+
function! s:LoadAllCoverage(file)
|
24
|
+
let l:ftime = getftime(a:file)
|
25
|
+
if(!has_key(s:coverageFtimes, a:file) || (s:coverageFtimes[a:file] < l:ftime))
|
26
|
+
if(has_key(s:allCoverage, a:file))
|
27
|
+
unlet s:allCoverage[a:file]
|
28
|
+
endif
|
29
|
+
exe "source ".a:file
|
30
|
+
let s:coverageFtimes[a:file] = l:ftime
|
31
|
+
endif
|
32
|
+
let b:coverageFtime = s:coverageFtimes[a:file]
|
33
|
+
endfunction
|
34
|
+
|
35
|
+
function! s:BestCoverage(coverageFile, coverageForName)
|
36
|
+
let matchBadness = strlen(a:coverageForName)
|
37
|
+
if(has_key(s:allCoverage, a:coverageFile))
|
38
|
+
for filename in keys(s:allCoverage[a:coverageFile])
|
39
|
+
let matchQuality = match(a:coverageForName, filename . "$")
|
40
|
+
if (matchQuality >= 0 && matchQuality < matchBadness)
|
41
|
+
let matchBadness = matchQuality
|
42
|
+
let found = filename
|
43
|
+
endif
|
44
|
+
endfor
|
45
|
+
endif
|
46
|
+
|
47
|
+
if exists("found")
|
48
|
+
let b:lineCoverage = s:allCoverage[a:coverageFile][l:found]
|
49
|
+
let b:coverageName = found
|
50
|
+
else
|
51
|
+
let b:coverageName = '(none)'
|
52
|
+
call s:emptyCoverage(a:coverageForName)
|
53
|
+
endif
|
54
|
+
endfunction
|
55
|
+
|
56
|
+
function! s:emptyCoverage(coverageForName)
|
57
|
+
echom "No coverage recorded for " . a:coverageForName
|
58
|
+
let b:lineCoverage = {'hits': [], 'misses': [], 'ignored': [] }
|
59
|
+
endfunction
|
60
|
+
|
61
|
+
function! s:FindCoverageFile(codeFile)
|
62
|
+
let found_coverage = findfile(s:coverageFileRelPath,fnamemodify(a:codeFile, ':p:h').";")
|
63
|
+
if(found_coverage == '')
|
64
|
+
return ''
|
65
|
+
else
|
66
|
+
return fnamemodify(found_coverage, ":p")
|
67
|
+
end
|
68
|
+
endfunction
|
69
|
+
|
70
|
+
function! s:LoadFileCoverage(codeFile, coverageFile)
|
71
|
+
call s:LoadAllCoverage(a:coverageFile)
|
72
|
+
call s:BestCoverage(a:coverageFile, a:codeFile)
|
73
|
+
endfunction
|
74
|
+
|
75
|
+
function s:SetSign(filename, line, type)
|
76
|
+
let id = b:coverageSignIndex
|
77
|
+
let b:coverageSignIndex += 1
|
78
|
+
let b:coverageSigns += [id]
|
79
|
+
exe ":sign place ".id." line=".a:line." name=".a:type." file=" . a:filename
|
80
|
+
endfunction
|
81
|
+
|
82
|
+
"XXX locating buffer + codeFile...
|
83
|
+
function! s:SetCoverageSigns(filename)
|
84
|
+
if (! exists("b:coverageSigns"))
|
85
|
+
let b:coverageSigns = []
|
86
|
+
endif
|
87
|
+
|
88
|
+
if (! exists("b:coverageSignIndex"))
|
89
|
+
let b:coverageSignIndex = 1
|
90
|
+
endif
|
91
|
+
|
92
|
+
for line in b:lineCoverage['hits']
|
93
|
+
call s:SetSign(a:filename, l:line, 'hit')
|
94
|
+
endfor
|
95
|
+
|
96
|
+
for line in b:lineCoverage['misses']
|
97
|
+
call s:SetSign(a:filename, l:line, 'miss')
|
98
|
+
endfor
|
99
|
+
|
100
|
+
for line in b:lineCoverage['ignored']
|
101
|
+
call s:SetSign(a:filename, l:line, 'ignored')
|
102
|
+
endfor
|
103
|
+
endfunction
|
104
|
+
|
105
|
+
function! s:ClearCoverageSigns()
|
106
|
+
if(exists("b:coverageSigns"))
|
107
|
+
for signId in b:coverageSigns
|
108
|
+
exe ":sign unplace ".signId
|
109
|
+
endfor
|
110
|
+
unlet! b:coverageSigns
|
111
|
+
endif
|
112
|
+
endfunction
|
113
|
+
|
114
|
+
function! s:MarkUpBuffer(filepath)
|
115
|
+
let coverageFile = s:FindCoverageFile(a:filepath)
|
116
|
+
|
117
|
+
if(coverageFile == '')
|
118
|
+
echom "No coverage file"
|
119
|
+
return
|
120
|
+
endif
|
121
|
+
|
122
|
+
if(exists("b:coverageFtime") && getftime(coverageFile) <= b:coverageFtime)
|
123
|
+
"Coverage already done"
|
124
|
+
return
|
125
|
+
endif
|
126
|
+
|
127
|
+
if(&modified)
|
128
|
+
echom "Buffer modified - coverage signs would likely be wrong"
|
129
|
+
return
|
130
|
+
endif
|
131
|
+
|
132
|
+
if(getftime(a:filepath) > getftime(coverageFile))
|
133
|
+
echom "Code file is newer that coverage file - signs would likely be wrong"
|
134
|
+
return
|
135
|
+
endif
|
136
|
+
|
137
|
+
call s:LoadFileCoverage(a:filepath, l:coverageFile)
|
138
|
+
call s:ClearCoverageSigns()
|
139
|
+
call s:SetCoverageSigns(a:filepath)
|
140
|
+
endfunction
|
141
|
+
|
142
|
+
let s:filename = expand("<sfile>")
|
143
|
+
function! s:AutocommandUncov(sourced)
|
144
|
+
if(a:sourced == s:filename)
|
145
|
+
call s:ClearCoverageSigns(expand("%:p"))
|
146
|
+
endif
|
147
|
+
endfunction
|
148
|
+
|
149
|
+
command! -nargs=0 Cov call s:CoverageSigns(expand("%:p"))
|
150
|
+
command! -nargs=0 Uncov call s:ClearCoverageSigns(expand("%:p"))
|
151
|
+
|
152
|
+
augroup SimpleCov
|
153
|
+
au!
|
154
|
+
au BufWinEnter *.rb call s:MarkUpBuffer(expand('<afile>:p'))
|
155
|
+
augroup end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'cadre/valise'
|
3
|
+
|
4
|
+
module Cadre
|
5
|
+
class CommandLine < Thor
|
6
|
+
desc "how_to", "Short guide on usage"
|
7
|
+
def how_to
|
8
|
+
command_name = File::basename($0)
|
9
|
+
puts <<-EOH
|
10
|
+
This is a set of tools for aiding development - to integrate testing and
|
11
|
+
metrics with editors and notifications.
|
12
|
+
|
13
|
+
Try:
|
14
|
+
#{command_name} vim_plugin > ~/.vim/plugin/cadre.vim
|
15
|
+
#{command_name} rspec_config >> spec/spec_helper.rb
|
16
|
+
#{command_name} simplecov_config >> .simplecov
|
17
|
+
|
18
|
+
Yeah, that's three commands, and you have to do the redirects yourself,
|
19
|
+
but you can review the output before making it live, and put them
|
20
|
+
somewhere else if that's what you want.
|
21
|
+
EOH
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "vim_plugin", "Outputs plugin for vim"
|
25
|
+
def vim_plugin
|
26
|
+
puts Valise.find("templates/plugin.vim").contents
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "rspec_config","Outputs RSpec config"
|
30
|
+
def rspec_config
|
31
|
+
puts Valise.find("templates/rspec-config").contents
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "simplecov_config", "Outputs Simplecov config"
|
35
|
+
def simplecov_config
|
36
|
+
puts Valise.find("templates/simplecov-config").contents
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/cadre/config.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
module Cadre
|
2
|
+
class Config
|
3
|
+
def initialize(valise, component)
|
4
|
+
@valise = valise
|
5
|
+
@component = component
|
6
|
+
end
|
7
|
+
attr_reader :valise, :component
|
8
|
+
|
9
|
+
def config_hash
|
10
|
+
valise.find("config.yaml").contents
|
11
|
+
end
|
12
|
+
|
13
|
+
def value_or_fail(value, common=true)
|
14
|
+
if common
|
15
|
+
config_hash.fetch(component, {}).fetch(value){config_hash.fetch(value)}
|
16
|
+
else
|
17
|
+
config_hash.fetch(component).fetch(value)
|
18
|
+
end
|
19
|
+
rescue KeyError
|
20
|
+
raise "Field not configurated: #{value}" #yep: configurated
|
21
|
+
end
|
22
|
+
|
23
|
+
def output_path
|
24
|
+
value_or_fail("output_path", false)
|
25
|
+
end
|
26
|
+
|
27
|
+
def verbose
|
28
|
+
!!value_or_fail("verbose")
|
29
|
+
end
|
30
|
+
alias verbose? verbose
|
31
|
+
|
32
|
+
def quiet
|
33
|
+
!verbose
|
34
|
+
end
|
35
|
+
alias quiet? quiet
|
36
|
+
|
37
|
+
def backtrace_pattern
|
38
|
+
Regexp.new(value_or_fail('backtrace_pattern'))
|
39
|
+
end
|
40
|
+
|
41
|
+
def backtrace_limit
|
42
|
+
value_or_fail('backtrace_limit')
|
43
|
+
end
|
44
|
+
|
45
|
+
def include_pending
|
46
|
+
!!value_or_fail('include_pending')
|
47
|
+
end
|
48
|
+
alias include_pending? include_pending
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Cadre
|
2
|
+
module Growl
|
3
|
+
#XXXX This isn't going to work at all as is. Lifted from other code, as #ok
|
4
|
+
#hints toward a working adapter
|
5
|
+
class Notifier
|
6
|
+
def close
|
7
|
+
super
|
8
|
+
summary = summary_line example_count, failure_count, pending_count
|
9
|
+
if failure_count > 0
|
10
|
+
growlnotify "--image ./autotest/fail.png -p Emergency -m '#{summary}' -t 'Spec failure detected'" #ok
|
11
|
+
elsif pending_count > 0
|
12
|
+
growlnotify "--image ./autotest/pending.png -p High -m '#{summary}' -t 'Pending spec(s) present'" #ok
|
13
|
+
else
|
14
|
+
growlnotify "--image ./autotest/pass.png -p 'Very Low' -m '#{summary}' -t 'All specs passed'" #ok
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def growlnotify str
|
19
|
+
system 'which growlnotify > /dev/null'
|
20
|
+
if $?.exitstatus == 0
|
21
|
+
system "growlnotify -n autotest #{str}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'cadre/valise'
|
2
|
+
|
3
|
+
module Cadre
|
4
|
+
module Libnotify
|
5
|
+
class Notifier
|
6
|
+
def initialize
|
7
|
+
yield self if block_given?
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :summary, :message, :sound, :expire_time, :app_name, :transient
|
11
|
+
|
12
|
+
def go
|
13
|
+
cmd = "notify-send #{options} \"#@summary\" \"#@message\""
|
14
|
+
%x[#{cmd}]
|
15
|
+
%x[paplay #{Valise.find(["sounds", sound]).full_path}]
|
16
|
+
end
|
17
|
+
|
18
|
+
def options
|
19
|
+
options = []
|
20
|
+
unless expire_time.nil?
|
21
|
+
options << "-t #@expire_time"
|
22
|
+
end
|
23
|
+
|
24
|
+
if transient
|
25
|
+
options << "-h \"byte:transient:1\""
|
26
|
+
end
|
27
|
+
|
28
|
+
unless app_name.nil?
|
29
|
+
options << "-a #@app_name"
|
30
|
+
end
|
31
|
+
|
32
|
+
options.join(" ")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'cadre/libnotify/notifier'
|
2
|
+
|
3
|
+
rspec_pid = Process.pid
|
4
|
+
at_exit do
|
5
|
+
if Process.pid == rspec_pid and not($!.nil? or $!.is_a?(SystemExit))
|
6
|
+
message = "Exception:\n#{$!.inspect}\n#{Dir.pwd}"
|
7
|
+
Cadre::Libnotify::Notifier.new do |notifier|
|
8
|
+
notifier.summary = "Spec run exited unexpectedly"
|
9
|
+
notifier.message = message
|
10
|
+
notifier.expire_time = 5000
|
11
|
+
notifier.sound = "error"
|
12
|
+
end.go
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module Cadre
|
17
|
+
module RSpec
|
18
|
+
class NotifyOnCompleteFormatter < ::RSpec::Core::Formatters::BaseFormatter
|
19
|
+
def notify_message(duration, example_count, failure_count, pending_count)
|
20
|
+
"Total duration: #{duration}\n Total: #{example_count}\n Failed: #{failure_count}\n Pending: #{pending_count}\n\nFinished at #{Time.now}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
24
|
+
notifier = Libnotify::Notifier.new
|
25
|
+
if duration < 20
|
26
|
+
notifier.transient = true
|
27
|
+
notifier.summary = "Finished spec run"
|
28
|
+
notifier.message = notify_message(duration, example_count, failure_count, pending_count)
|
29
|
+
notifier.sound = "failure" if failure_count > 0
|
30
|
+
else
|
31
|
+
notifier.summary = "Finished long spec run"
|
32
|
+
notifier.message = notify_message(duration, example_count, failure_count, pending_count)
|
33
|
+
if failure_count > 0
|
34
|
+
notifier.sound = "failure"
|
35
|
+
else
|
36
|
+
notifier.sound = "success"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
notifier.go
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# !!! Lifted wholesale from
|
2
|
+
# https://wincent.com/blog/running-rspec-specs-from-inside-vim
|
3
|
+
require 'rspec/core/formatters/base_text_formatter'
|
4
|
+
require 'cadre/config'
|
5
|
+
|
6
|
+
module Cadre
|
7
|
+
module RSpec
|
8
|
+
class QuickfixFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
|
9
|
+
|
10
|
+
# TODO: vim-side function for printing progress (if that's even possible)
|
11
|
+
#
|
12
|
+
def initialize(output)
|
13
|
+
super(output)
|
14
|
+
@config = Config.new(Valise, "quickfix")
|
15
|
+
@output = File::open(@config.output_path, "w")
|
16
|
+
end
|
17
|
+
attr_reader :config
|
18
|
+
|
19
|
+
def example_failed(example)
|
20
|
+
exception = example.execution_result[:exception]
|
21
|
+
paths = exception.backtrace.map do |frame|
|
22
|
+
format_caller frame
|
23
|
+
end.compact
|
24
|
+
paths = paths[0..config.backtrace_limit]
|
25
|
+
message = "#{example.full_description}: #{format_message exception.message}"
|
26
|
+
paths.each do |path|
|
27
|
+
output.puts "#{path}: [FAIL] #{message}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def example_pending(example)
|
32
|
+
return unless config.include_pending?
|
33
|
+
message = format_message example.execution_result[:pending_message]
|
34
|
+
path = format_caller example.location
|
35
|
+
output.puts "#{path}: [PEND] #{message}" if path
|
36
|
+
end
|
37
|
+
|
38
|
+
def dump_failures(*args); end
|
39
|
+
|
40
|
+
def dump_pending(*args); end
|
41
|
+
|
42
|
+
def message(msg); end
|
43
|
+
|
44
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
45
|
+
@duration = duration
|
46
|
+
@example_count = example_count
|
47
|
+
@failure_count = failure_count
|
48
|
+
@pending_count = pending_count
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def format_message(msg)
|
54
|
+
# NOTE: may consider compressing all whitespace here
|
55
|
+
msg.gsub("\n", ' ')[0,40]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/cadre/rspec.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Cadre
|
4
|
+
module SimpleCov
|
5
|
+
class VimFormatter
|
6
|
+
class << self
|
7
|
+
attr_accessor :options
|
8
|
+
end
|
9
|
+
|
10
|
+
def options
|
11
|
+
@options ||=
|
12
|
+
begin
|
13
|
+
require 'cadre/config'
|
14
|
+
require 'cadre/valise'
|
15
|
+
Config.new(Valise, "simplecov")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Scope = Struct.new(:results)
|
20
|
+
|
21
|
+
def format(result)
|
22
|
+
scope = Scope.new({})
|
23
|
+
dir_re = /^#{common_directory(result.filenames)}\//
|
24
|
+
result.filenames.zip(result.original_result.values_at(*result.filenames)).each do |name, lines|
|
25
|
+
|
26
|
+
scope.results[name.sub(dir_re, "")] = file_results = {:ignored => [], :hits => [], :misses => []}
|
27
|
+
lines.each_with_index do |hits, line|
|
28
|
+
case hits
|
29
|
+
when nil
|
30
|
+
file_results[:ignored] << line + 1
|
31
|
+
when 0
|
32
|
+
file_results[:misses] << line + 1
|
33
|
+
else
|
34
|
+
file_results[:hits] << line + 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
coverage_output = options.output_path
|
40
|
+
|
41
|
+
write_file("coverage-results.vim", coverage_output, scope)
|
42
|
+
puts "Wrote vim coverage script to #{coverage_output}" unless options.quiet?
|
43
|
+
end
|
44
|
+
|
45
|
+
def common_directory(files)
|
46
|
+
return "" if files.empty?
|
47
|
+
File::join(files.map{|file| file.split(File::Separator)}.inject do |dir, path|
|
48
|
+
dir.zip(path).take_while{|l,r| l == r}.map{|l,_| l}
|
49
|
+
end)
|
50
|
+
end
|
51
|
+
|
52
|
+
def templates
|
53
|
+
@templates ||= Valise.templates
|
54
|
+
end
|
55
|
+
|
56
|
+
def write_file(template_name, output_filename, bound)
|
57
|
+
FileUtils::mkdir_p(File::dirname(output_filename))
|
58
|
+
content = templates.find(template_name).contents.render(bound)
|
59
|
+
File.open( output_filename, "w" ) do |file_result|
|
60
|
+
file_result.write content
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cadre/simplecov/vim-formatter'
|
data/lib/cadre/valise.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'valise'
|
2
|
+
|
3
|
+
module Cadre
|
4
|
+
def self.build_valise
|
5
|
+
Valise.define do
|
6
|
+
rw ".cadre"
|
7
|
+
rw "~/.cadre"
|
8
|
+
rw "/usr/share/cadre"
|
9
|
+
rw "/etc/cadre"
|
10
|
+
ro up_to("lib") + "/../default_files"
|
11
|
+
|
12
|
+
handle "*.yaml", :yaml, :hash_merge
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Valise = build_valise
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'simplecov-vim/formatter'
|
3
|
+
|
4
|
+
describe SimpleCov::Formatter::VimFormatter do
|
5
|
+
include FileSandbox
|
6
|
+
|
7
|
+
let :files do
|
8
|
+
sandbox.new :directory => "lib/nested"
|
9
|
+
[sandbox.new(:file => "lib/pretend_file"), sandbox.new(:file => "lib/nested/pretend_file")]
|
10
|
+
end
|
11
|
+
|
12
|
+
let :original_result do
|
13
|
+
files.each_with_object({}) do |file, hash|
|
14
|
+
hash[file.path] = [1,1,1,1]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
let :result do
|
19
|
+
SimpleCov::Result.new(original_result)
|
20
|
+
end
|
21
|
+
|
22
|
+
let :formatter do
|
23
|
+
SimpleCov::Formatter::VimFormatter.new
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have an original result with absolute paths" do
|
27
|
+
original_result.keys.each do |path|
|
28
|
+
path.should =~ %r{\A/}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should produce a vimscript" do
|
33
|
+
formatter.format(result)
|
34
|
+
File::exists?("coverage.vim").should be_true
|
35
|
+
|
36
|
+
|
37
|
+
File::open("coverage.vim") do |scriptfile|
|
38
|
+
scriptfile.lines.grep(/(['"])pretend_file\1/).should_not == []
|
39
|
+
scriptfile.rewind
|
40
|
+
scriptfile.lines.grep(%r[(['"])nested/pretend_file\1]).should_not == []
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
puts Dir::pwd
|
2
|
+
require 'test/unit'
|
3
|
+
begin
|
4
|
+
require 'spec'
|
5
|
+
rescue LoadError
|
6
|
+
false
|
7
|
+
end
|
8
|
+
|
9
|
+
class RSpecTest < Test::Unit::TestCase
|
10
|
+
def test_that_rspec_is_available
|
11
|
+
assert_nothing_raised("\n\n * RSpec isn't available - please run: gem install rspec *\n\n"){ ::Spec }
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_that_specs_pass
|
15
|
+
assert(system(*%w{spec -f e -p **/*.rb spec}),"\n\n * Specs failed *\n\n")
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cadre
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Judson Lester
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
prerelease: false
|
16
|
+
type: :runtime
|
17
|
+
name: thor
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
segments:
|
23
|
+
- 0
|
24
|
+
- 18
|
25
|
+
- 1
|
26
|
+
version: 0.18.1
|
27
|
+
none: false
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 18
|
35
|
+
- 1
|
36
|
+
version: 0.18.1
|
37
|
+
none: false
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
|
+
name: tilt
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 4
|
49
|
+
- 1
|
50
|
+
version: 1.4.1
|
51
|
+
none: false
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 4
|
59
|
+
- 1
|
60
|
+
version: 1.4.1
|
61
|
+
none: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
prerelease: false
|
64
|
+
type: :runtime
|
65
|
+
name: valise
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
- 9
|
73
|
+
version: '0.9'
|
74
|
+
none: false
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
- 9
|
82
|
+
version: '0.9'
|
83
|
+
none: false
|
84
|
+
description: ! " Three things:\n\n An rspec formatter that triggers libnotify on
|
85
|
+
completion.\n An rspec formatter that outputs to vim quickfix\n A simplecov formatter
|
86
|
+
that produces vim markers (+ a vim plugin to load them)\n"
|
87
|
+
email:
|
88
|
+
- nyarly@gmail.com
|
89
|
+
executables:
|
90
|
+
- cadre
|
91
|
+
extensions: []
|
92
|
+
extra_rdoc_files: []
|
93
|
+
files:
|
94
|
+
- default_files/config.yaml
|
95
|
+
- default_files/sounds/error
|
96
|
+
- default_files/sounds/failure
|
97
|
+
- default_files/sounds/success
|
98
|
+
- default_files/templates/plugin.vim
|
99
|
+
- default_files/templates/coverage-results.vim.erb
|
100
|
+
- default_files/templates/simplecov-config
|
101
|
+
- default_files/templates/rspec-config
|
102
|
+
- lib/cadre/libnotify/notifier.rb
|
103
|
+
- lib/cadre/growl/notifier.rb
|
104
|
+
- lib/cadre/rspec.rb
|
105
|
+
- lib/cadre/rspec/quickfix.rb
|
106
|
+
- lib/cadre/rspec/notify-on-complete-formatter.rb
|
107
|
+
- lib/cadre/rspec/true-feelings.rb
|
108
|
+
- lib/cadre/config.rb
|
109
|
+
- lib/cadre/command-line.rb
|
110
|
+
- lib/cadre/valise.rb
|
111
|
+
- lib/cadre/simplecov/vim-formatter.rb
|
112
|
+
- lib/cadre/simplecov.rb
|
113
|
+
- bin/cadre
|
114
|
+
- spec/simplecov/formatter.rb
|
115
|
+
- spec_help/gem_test_suite.rb
|
116
|
+
homepage: http://nyarly.github.com/cadre
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options:
|
121
|
+
- --inline-source
|
122
|
+
- --main
|
123
|
+
- doc/README
|
124
|
+
- --title
|
125
|
+
- cadre-0.0.1 Documentation
|
126
|
+
require_paths:
|
127
|
+
- lib/
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
hash: 743147407
|
135
|
+
version: '0'
|
136
|
+
none: false
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
none: false
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project: cadre
|
145
|
+
rubygems_version: 1.8.24
|
146
|
+
signing_key:
|
147
|
+
specification_version: 3
|
148
|
+
summary: Tools to smooth development
|
149
|
+
test_files:
|
150
|
+
- spec_help/gem_test_suite.rb
|