duvet 0.1.0 → 0.2.0
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/VERSION +1 -1
- data/duvet.gemspec +10 -10
- data/lib/duvet.rb +4 -1
- data/lib/duvet/cov.rb +14 -12
- data/lib/duvet/covs.rb +17 -17
- data/{lib/duvet/resources → templates/css}/dark.sass +0 -0
- data/{lib/duvet/resources → templates/css}/light.sass +0 -0
- data/{lib/duvet/resources → templates/css}/rcov.sass +0 -0
- data/templates/html/file.haml +69 -0
- data/templates/html/index.haml +52 -0
- data/{lib/duvet/resources → templates/js}/jquery.js +0 -0
- data/{lib/duvet/resources → templates/js}/main.js +0 -0
- data/{lib/duvet/resources → templates/js}/plugins.js +0 -0
- metadata +11 -16
- data/lib/duvet/templates/file.erb +0 -64
- data/lib/duvet/templates/index.erb +0 -61
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/duvet.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{duvet}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Hawxwell"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-12}
|
13
13
|
s.default_executable = %q{duvet}
|
14
14
|
s.description = %q{Duvet a simple code coverage tool for ruby 1.9}
|
15
15
|
s.email = %q{m@hawx.me}
|
@@ -31,14 +31,14 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/duvet/cov.rb",
|
32
32
|
"lib/duvet/covs.rb",
|
33
33
|
"lib/duvet/ext.rb",
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
34
|
+
"templates/css/dark.sass",
|
35
|
+
"templates/css/light.sass",
|
36
|
+
"templates/css/rcov.sass",
|
37
|
+
"templates/html/file.haml",
|
38
|
+
"templates/html/index.haml",
|
39
|
+
"templates/js/jquery.js",
|
40
|
+
"templates/js/main.js",
|
41
|
+
"templates/js/plugins.js",
|
42
42
|
"test/helper.rb",
|
43
43
|
"test/test_duvet.rb",
|
44
44
|
"test_duvet/lib/klass.rb",
|
data/lib/duvet.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
$: << File.join(File.dirname(__FILE__), '..')
|
2
2
|
|
3
3
|
# Add this to test/helper.rb at the before __anything__ else
|
4
4
|
#
|
@@ -9,6 +9,7 @@ require 'coverage'
|
|
9
9
|
require 'ostruct'
|
10
10
|
require 'erubis'
|
11
11
|
require 'pathname'
|
12
|
+
require 'haml'
|
12
13
|
require 'sass'
|
13
14
|
|
14
15
|
require 'duvet/ext'
|
@@ -21,6 +22,8 @@ module Duvet
|
|
21
22
|
attr_accessor :opts
|
22
23
|
|
23
24
|
DEFAULTS = {:dir => 'cov', :style => 'rcov'}
|
25
|
+
|
26
|
+
TEMPLATE_PATH = File.join File.dirname(__FILE__), '..', 'templates'
|
24
27
|
|
25
28
|
# Start tracking
|
26
29
|
def self.start(opts={})
|
data/lib/duvet/cov.rb
CHANGED
@@ -3,14 +3,14 @@ module Duvet
|
|
3
3
|
attr_accessor :path
|
4
4
|
|
5
5
|
def initialize(path, cov)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@path = path
|
6
|
+
@path = Pathname.new(path)
|
7
|
+
if @path.to_s.include?(Dir.pwd)
|
8
|
+
a = Dir.pwd.size+1
|
9
|
+
@path = Pathname.new(path[a..-1])
|
10
|
+
#@path = @path.relative_path_from(Pathname.getwd)
|
10
11
|
end
|
11
|
-
|
12
|
+
|
12
13
|
@cov = cov
|
13
|
-
write
|
14
14
|
end
|
15
15
|
|
16
16
|
# @return [Array] lines in file
|
@@ -83,7 +83,7 @@ module Duvet
|
|
83
83
|
def data
|
84
84
|
{
|
85
85
|
"file" => {
|
86
|
-
"path" => @path,
|
86
|
+
"path" => @path.to_s,
|
87
87
|
"url" => @path.file_name + '.html',
|
88
88
|
"source" => @path.readlines,
|
89
89
|
"lines" => lines.size,
|
@@ -103,14 +103,16 @@ module Duvet
|
|
103
103
|
#
|
104
104
|
# @return [String]
|
105
105
|
def format
|
106
|
-
template = File.read
|
107
|
-
|
108
|
-
|
106
|
+
template = File.read File.join(TEMPLATE_PATH, 'html', 'file.haml')
|
107
|
+
haml_engine = Haml::Engine.new(template)
|
108
|
+
output = haml_engine.render(nil, Duvet.template_hash.merge(self.data))
|
109
|
+
output
|
109
110
|
end
|
110
111
|
|
111
112
|
def write(dir='cov')
|
112
|
-
|
113
|
-
|
113
|
+
pa = (dir.to_p + @path.file_name).to_s + '.html'
|
114
|
+
File.new(pa, 'w')
|
115
|
+
File.open(pa, 'w') {|f| f.puts(self.format) }
|
114
116
|
end
|
115
117
|
|
116
118
|
end
|
data/lib/duvet/covs.rb
CHANGED
@@ -2,9 +2,9 @@ module Duvet
|
|
2
2
|
class Covs < Array
|
3
3
|
|
4
4
|
def initialize(cov)
|
5
|
-
replace []
|
6
|
-
cov.each do |
|
7
|
-
self << Cov.new(
|
5
|
+
self.replace []
|
6
|
+
cov.each do |path, c|
|
7
|
+
self << Cov.new(path, c)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -69,9 +69,10 @@ module Duvet
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def format(dir='cov')
|
72
|
-
template = File.read
|
73
|
-
|
74
|
-
|
72
|
+
template = File.read File.join(TEMPLATE_PATH, 'html', 'index.haml')
|
73
|
+
haml_engine = Haml::Engine.new(template)
|
74
|
+
output = haml_engine.render(nil, Duvet.template_hash.merge(self.data))
|
75
|
+
output
|
75
76
|
end
|
76
77
|
|
77
78
|
def write(dir='cov', style='rcov')
|
@@ -92,23 +93,22 @@ module Duvet
|
|
92
93
|
|
93
94
|
# @todo Allow you to change style used
|
94
95
|
def write_resources(dir, style)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
js.each do |i|
|
100
|
-
write_path = dir.to_p + i.to_p.basename
|
101
|
-
f = File.new(write_path, "w")
|
102
|
-
f.write(File.read(i))
|
103
|
-
end
|
104
|
-
|
105
|
-
sass.each do |i|
|
96
|
+
js_dir = File.join(TEMPLATE_PATH, 'js')
|
97
|
+
css_dir = File.join(TEMPLATE_PATH, 'css')
|
98
|
+
|
99
|
+
Dir.glob("#{css_dir}/*").each do |i|
|
106
100
|
if i.include?(style)
|
107
101
|
write_path = dir.to_p + 'styles.css'
|
108
102
|
f = File.new(write_path, "w")
|
109
103
|
f.write Sass::Engine.new( File.read(i) ).render
|
110
104
|
end
|
111
105
|
end
|
106
|
+
|
107
|
+
Dir.glob("#{js_dir}/*").each do |i|
|
108
|
+
write_path = dir.to_p + i.to_p.basename
|
109
|
+
f = File.new(write_path, "w")
|
110
|
+
f.write(File.read(i))
|
111
|
+
end
|
112
112
|
|
113
113
|
end
|
114
114
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
!!!
|
2
|
+
%html{:lang => "en"}
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
%title= file['path']
|
6
|
+
%link{:rel => "stylesheet", :href => "styles.css"}
|
7
|
+
%script{:type => "text/javascript", :src => "jquery.js"}
|
8
|
+
%script{:type => "text/javascript", :src => "plugins.js"}
|
9
|
+
%script{:type => "text/javascript", :src => "main.js"}
|
10
|
+
|
11
|
+
%body
|
12
|
+
%header
|
13
|
+
%h1
|
14
|
+
%a{:href => "index.html"} Coverage
|
15
|
+
%h2= file['path']
|
16
|
+
|
17
|
+
.table-wrapper
|
18
|
+
%table{:class => "summary", :border => "none"}
|
19
|
+
%thead
|
20
|
+
%tr
|
21
|
+
%th Name
|
22
|
+
%th Total Lines
|
23
|
+
%th Lines of Code
|
24
|
+
%th Total Coverage
|
25
|
+
%th Code Coverage
|
26
|
+
|
27
|
+
%tbody
|
28
|
+
%tr
|
29
|
+
%td{:class => "name"}= file['path']
|
30
|
+
%td= file['lines']
|
31
|
+
%td= file['lines_code']
|
32
|
+
%td= coverage['total']
|
33
|
+
%td= coverage['code']
|
34
|
+
|
35
|
+
.table-wrapper
|
36
|
+
%table{:class => "source", :border => "none"}
|
37
|
+
- file['source'].zip(coverage['lines']).each_with_index do |(line, count), i|
|
38
|
+
- if count.nil?
|
39
|
+
%tr{:class => "excluded"}
|
40
|
+
%td{:class => "no"}= i
|
41
|
+
%td
|
42
|
+
%pre
|
43
|
+
%code= line.gsub("\n", "")
|
44
|
+
|
45
|
+
- elsif count.zero?
|
46
|
+
%tr{:class => "unran"}
|
47
|
+
%td{:class => "no"}= i
|
48
|
+
%td
|
49
|
+
%pre
|
50
|
+
%code= line.gsub("\n", "")
|
51
|
+
%td
|
52
|
+
%span{:class => "count"}= count
|
53
|
+
|
54
|
+
- else
|
55
|
+
%tr{:class => "ran"}
|
56
|
+
%td{:class => "no"}= i
|
57
|
+
%td
|
58
|
+
%pre
|
59
|
+
%code= line.gsub("\n", "")
|
60
|
+
%td
|
61
|
+
%span{:class => "count"}= count
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
%footer
|
66
|
+
%span
|
67
|
+
Generated on #{time} with
|
68
|
+
%a{:href => "http://github.com/hawx/duvet"}= "#{name} #{version}"
|
69
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
!!!
|
2
|
+
%html{:lang => "en"}
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
%title Coverage
|
6
|
+
%link{:rel => "stylesheet", :href => "styles.css"}
|
7
|
+
%script{:type => "text/javascript", :src => "jquery.js"}
|
8
|
+
%script{:type => "text/javascript", :src => "plugins.js"}
|
9
|
+
%script{:type => "text/javascript", :src => "main.js"}
|
10
|
+
|
11
|
+
%body
|
12
|
+
%header
|
13
|
+
%h1 Coverage
|
14
|
+
|
15
|
+
%input{:id => "filter", :name => "filter", :type => "text", :placeholder => "Filter"}
|
16
|
+
|
17
|
+
.table-wrapper
|
18
|
+
%table{:class => "summary sort", :border => "none"}
|
19
|
+
%thead
|
20
|
+
%tr
|
21
|
+
%th{:class => "name"} Name
|
22
|
+
%th{:class => "lines"} Total Lines
|
23
|
+
%th{:class => "loc"} Lines of Code
|
24
|
+
%th{:class => "cov"} Total Coverage
|
25
|
+
%th{:class => "code"} Code Coverage
|
26
|
+
|
27
|
+
%tfoot
|
28
|
+
%tr{:class => "totals"}
|
29
|
+
%td Total
|
30
|
+
%td{:class => "lines"}= total['lines']
|
31
|
+
%td{:class => "loc"}= total['lines_code']
|
32
|
+
%td{:class => "ran"}= total['lines_ran']
|
33
|
+
%td{:class => "cov"}= total['total_cov']
|
34
|
+
%td{:class => "code"}= total['code_cov']
|
35
|
+
|
36
|
+
%tbody
|
37
|
+
- files.each do |f|
|
38
|
+
%tr
|
39
|
+
%td{:class => "name"}
|
40
|
+
%a{:href => "#{f['file']['url']}"}= f['file']['path']
|
41
|
+
|
42
|
+
%td{:class => "lines"}= f['file']['lines']
|
43
|
+
%td{:class => "loc"}= f['file']['lines_code']
|
44
|
+
%td{:class => "ran"}= f['file']['lines_ran']
|
45
|
+
%td{:class => "cov"}= f['coverage']['total']
|
46
|
+
%td{:class => "code"}= f['coverage']['code']
|
47
|
+
|
48
|
+
%footer
|
49
|
+
%span
|
50
|
+
Generated on #{time} with
|
51
|
+
%a{:href => "http://github.com/hawx/duvet"}= "#{name} #{version}"
|
52
|
+
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duvet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
7
|
+
- 2
|
9
8
|
- 0
|
10
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Joshua Hawxwell
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-11-12 00:00:00 +00:00
|
19
18
|
default_executable: duvet
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
@@ -40,7 +38,6 @@ dependencies:
|
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
42
40
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
41
|
segments:
|
45
42
|
- 0
|
46
43
|
version: "0"
|
@@ -68,14 +65,14 @@ files:
|
|
68
65
|
- lib/duvet/cov.rb
|
69
66
|
- lib/duvet/covs.rb
|
70
67
|
- lib/duvet/ext.rb
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
68
|
+
- templates/css/dark.sass
|
69
|
+
- templates/css/light.sass
|
70
|
+
- templates/css/rcov.sass
|
71
|
+
- templates/html/file.haml
|
72
|
+
- templates/html/index.haml
|
73
|
+
- templates/js/jquery.js
|
74
|
+
- templates/js/main.js
|
75
|
+
- templates/js/plugins.js
|
79
76
|
- test/helper.rb
|
80
77
|
- test/test_duvet.rb
|
81
78
|
- test_duvet/lib/klass.rb
|
@@ -95,7 +92,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
92
|
requirements:
|
96
93
|
- - ">="
|
97
94
|
- !ruby/object:Gem::Version
|
98
|
-
hash: 3
|
99
95
|
segments:
|
100
96
|
- 0
|
101
97
|
version: "0"
|
@@ -104,7 +100,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
100
|
requirements:
|
105
101
|
- - ">="
|
106
102
|
- !ruby/object:Gem::Version
|
107
|
-
hash: 3
|
108
103
|
segments:
|
109
104
|
- 0
|
110
105
|
version: "0"
|
@@ -1,64 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8" />
|
5
|
-
<title><%= file['path'] %></title>
|
6
|
-
<link rel="stylesheet" href="styles.css" type="text/css" />
|
7
|
-
<script type="text/javascript" src="jquery.js"></script>
|
8
|
-
<script type="text/javascript" src="plugins.js"></script>
|
9
|
-
<script type="text/javascript" src="main.js"></script>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
|
13
|
-
<header>
|
14
|
-
<h1><a href="index.html">Coverage</a></h1>
|
15
|
-
<h2><%= file['path'] %></h2>
|
16
|
-
</header>
|
17
|
-
|
18
|
-
<div class="table-wrapper">
|
19
|
-
<table class="summary" border="none">
|
20
|
-
<thead>
|
21
|
-
<tr>
|
22
|
-
<th>Name</th>
|
23
|
-
<th>Total Lines</th>
|
24
|
-
<th>Lines of Code</th>
|
25
|
-
<th>Total Coverage</th>
|
26
|
-
<th>Code Coverage</th>
|
27
|
-
</tr>
|
28
|
-
</thead>
|
29
|
-
<tbody>
|
30
|
-
<tr>
|
31
|
-
<td class="name"><%= file['path'] %></td>
|
32
|
-
<td><%= file['lines'] %></td>
|
33
|
-
<td><%= file['lines_code'] %></td>
|
34
|
-
<td><%= coverage['total'] %></td>
|
35
|
-
<td><%= coverage['code'] %></td>
|
36
|
-
</tr>
|
37
|
-
</tbody>
|
38
|
-
</table>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div class="table-wrapper">
|
42
|
-
<table class="source" border="none">
|
43
|
-
<% file["source"].zip(coverage["lines"]).each_with_index do |(line, count), i| %>
|
44
|
-
<% if count.nil? %>
|
45
|
-
<tr class="excluded">
|
46
|
-
<% elsif count.zero? %>
|
47
|
-
<tr class="unran">
|
48
|
-
<% else %>
|
49
|
-
<tr class="ran">
|
50
|
-
<% end %>
|
51
|
-
<td class="no"><%= i %></td>
|
52
|
-
<td><pre><code><%= line.gsub("\n", "") %></code></pre></td>
|
53
|
-
<td><% if count %><span class="count"><%= count %></span><% end %></td>
|
54
|
-
</tr>
|
55
|
-
<% end %>
|
56
|
-
</table>
|
57
|
-
</div>
|
58
|
-
|
59
|
-
<footer>
|
60
|
-
<span>Generated on <%= time %> with </span><a href="http://github.com/hawx/duvet"><%= name %> <%= version %></a>
|
61
|
-
</footer>
|
62
|
-
|
63
|
-
</body>
|
64
|
-
</html>
|
@@ -1,61 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8" />
|
5
|
-
<title>Coverage</title>
|
6
|
-
<link rel="stylesheet" href="styles.css" type="text/css" />
|
7
|
-
<script type="text/javascript" src="jquery.js"></script>
|
8
|
-
<script type="text/javascript" src="plugins.js"></script>
|
9
|
-
<script type="text/javascript" src="main.js"></script>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
|
13
|
-
<header>
|
14
|
-
<h1>Coverage</h1>
|
15
|
-
</header>
|
16
|
-
|
17
|
-
<input id="filter" name="filter" type="text" placeholder="Filter">
|
18
|
-
|
19
|
-
<div class="table-wrapper">
|
20
|
-
<table class="summary sort" border="none">
|
21
|
-
<thead>
|
22
|
-
<tr>
|
23
|
-
<th class="name">Name</th>
|
24
|
-
<th class="lines">Total Lines</th>
|
25
|
-
<th class="loc">Lines of Code</th>
|
26
|
-
<th class="ran">Lines Ran</td>
|
27
|
-
<th class="cov">Total Coverage</th>
|
28
|
-
<th class="code">Code Coverage</th>
|
29
|
-
</tr>
|
30
|
-
</thead>
|
31
|
-
<tfoot>
|
32
|
-
<tr class="totals">
|
33
|
-
<td>Total</td>
|
34
|
-
<td class="lines"><%= total['lines'] %></td>
|
35
|
-
<td class="loc"><%= total['lines_code'] %></td>
|
36
|
-
<td class="ran"><%= total['lines_ran'] %></td>
|
37
|
-
<td class="cov"><%= total['total_cov'] %></td>
|
38
|
-
<td class="code"><%= total['code_cov'] %></td>
|
39
|
-
</tr>
|
40
|
-
</tfoot>
|
41
|
-
<tbody>
|
42
|
-
<% files.each do |f| %>
|
43
|
-
<tr>
|
44
|
-
<td class="name"><a href="<%= f['file']['url'] %>"><%= f['file']['path'] %></a></td>
|
45
|
-
<td class="lines"><%= f['file']['lines'] %></td>
|
46
|
-
<td class="loc"><%= f['file']['lines_code'] %></td>
|
47
|
-
<td class="ran"><%= f['file']['lines_ran'] %></td>
|
48
|
-
<td class="cov"><%= f['coverage']['total'] %></td>
|
49
|
-
<td class="code"><%= f['coverage']['code'] %></td>
|
50
|
-
</tr>
|
51
|
-
<% end %>
|
52
|
-
</tbody>
|
53
|
-
</table>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
<footer>
|
57
|
-
<span>Generated on <%= time %> with </span><a href="http://github.com/hawx/duvet"><%= name %> <%= version %></a>
|
58
|
-
</footer>
|
59
|
-
|
60
|
-
</body>
|
61
|
-
</html>
|