rspectacles 0.0.7 → 0.0.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/rspectacles/app/public/js/chart.js +51 -22
- data/lib/rspectacles/redis_formatter.rb +2 -1
- data/lib/rspectacles/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb44a5d138ccbea60ba08f93cf8de9ad214fd328
|
4
|
+
data.tar.gz: 8ce8e87c8e6b3b97bd38b23c930bc1416a31f37e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7dfe8b33a4480590058e2628782771bc2fa9689690160aba0a74f499828ca1391a2dc303e8b2ba691c0d2677908957fde43bb556cf3d6ff1406444cf1166ad0
|
7
|
+
data.tar.gz: 056848ea860871e4bc9c4c5aaca0ab5523293d3dbda50516b13542b56b47f64ca13f84f9d88367812a928f1bd27f8274d6caab64c5273d1e82b8f083028e4eec
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,7 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
|
|
6
6
|
function chart(options) {
|
7
7
|
var svg, partition, arc, me
|
8
8
|
, tmpl = $('#template').html()
|
9
|
+
, render
|
9
10
|
;
|
10
11
|
|
11
12
|
options = $.extend({
|
@@ -52,21 +53,26 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
|
|
52
53
|
};
|
53
54
|
}
|
54
55
|
|
55
|
-
function showDetails(
|
56
|
-
var
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
function showDetails() {
|
57
|
+
var data = showDetails.current
|
58
|
+
, mappedData = $.extend({
|
59
|
+
name: ''
|
60
|
+
, line_number: ''
|
61
|
+
, status: ''
|
62
|
+
, duration: ''
|
63
|
+
, time_or_count: options.isCount ? 'Examples' : 'Seconds'
|
64
|
+
, value: null
|
65
|
+
}, data)
|
66
|
+
, map
|
64
67
|
;
|
65
68
|
|
66
|
-
|
69
|
+
if (mappedData.value) {
|
70
|
+
!options.isCount && (mappedData.value = mappedData.value.toFixed(3));
|
71
|
+
}
|
67
72
|
|
68
73
|
$('.example-wrapper').html(Mustache.render(tmpl, mappedData));
|
69
74
|
}
|
75
|
+
showDetails.current = {};
|
70
76
|
|
71
77
|
function getValue() {
|
72
78
|
return options.isCount ?
|
@@ -82,26 +88,34 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
|
|
82
88
|
}
|
83
89
|
}
|
84
90
|
|
85
|
-
function
|
86
|
-
var path = svg.datum(me.tree.nodes).selectAll("path")
|
87
|
-
.data(partition.value(getValue()).nodes);
|
88
|
-
|
91
|
+
function onUpdate(path) {
|
89
92
|
path
|
90
93
|
.attr("d", arc)
|
91
94
|
.each(stash)
|
92
|
-
.style("fill", getColor)
|
95
|
+
.style("fill", getColor)
|
96
|
+
.call(showDetails);
|
97
|
+
}
|
93
98
|
|
99
|
+
function onEnter(path) {
|
94
100
|
path.enter().append("path")
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
101
|
+
.attr("display", function (d) { return d.depth ? null : "none"; })
|
102
|
+
.attr("d", arc)
|
103
|
+
.style("stroke", function (d) { return 'rgba(255,255,255,0.3)'; })
|
104
|
+
.style("fill", getColor)
|
105
|
+
.style("fill-rule", "evenodd")
|
106
|
+
.each(stash)
|
107
|
+
.on('mouseover', function (d) {
|
108
|
+
showDetails.current = d;
|
109
|
+
showDetails();
|
110
|
+
})
|
111
|
+
.call(showDetails);
|
112
|
+
}
|
102
113
|
|
114
|
+
function onExit(path) {
|
103
115
|
path.exit().remove();
|
116
|
+
}
|
104
117
|
|
118
|
+
function onFormChange(path) {
|
105
119
|
d3.selectAll("input").on("change", function change() {
|
106
120
|
options.isCount = this.value === 'count';
|
107
121
|
|
@@ -113,6 +127,21 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
|
|
113
127
|
});
|
114
128
|
}
|
115
129
|
|
130
|
+
render = function () {
|
131
|
+
var path = svg.datum(me.tree.nodes).selectAll("path")
|
132
|
+
.data(partition.value(getValue()).nodes);
|
133
|
+
|
134
|
+
onUpdate(path);
|
135
|
+
onEnter(path);
|
136
|
+
onExit(path);
|
137
|
+
onFormChange(path);
|
138
|
+
|
139
|
+
render = function () {
|
140
|
+
path.datum(me.tree.nodes)
|
141
|
+
.data(partition.value(getValue()).nodes);
|
142
|
+
};
|
143
|
+
};
|
144
|
+
|
116
145
|
return me = {
|
117
146
|
tree: new PathTree()
|
118
147
|
|
@@ -2,6 +2,7 @@ require 'rspec/core/formatters/base_formatter'
|
|
2
2
|
require 'rspectacles/config'
|
3
3
|
require 'ostruct'
|
4
4
|
require 'redis'
|
5
|
+
require 'uri'
|
5
6
|
|
6
7
|
module RSpectacles
|
7
8
|
class RedisFormatter < RSpec::Core::Formatters::BaseFormatter
|
@@ -14,7 +15,7 @@ module RSpectacles
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def initialize(output)
|
17
|
-
uri = config.redis_uri
|
18
|
+
uri = URI.parse config.redis_uri
|
18
19
|
self.redis = Redis.new host: uri.host, port: uri.port, password: uri.password
|
19
20
|
end
|
20
21
|
|
data/lib/rspectacles/version.rb
CHANGED