rspectacles 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b75957f7c35b3b3ce7cf3689fccf1b2283905eb
4
- data.tar.gz: b073ea404ac798f4c113c111a45dd6c2faef3da8
3
+ metadata.gz: 92fd52dccf56cd933bfa9361092dd7590e767cd8
4
+ data.tar.gz: d58bfa299fdfb27798a1de5d8e4e578318dea9d7
5
5
  SHA512:
6
- metadata.gz: a352c263f686deef03c0521799ccdf969db839fd98b7c208f14fccf981f99f35d9c57396ce8d77938591ea7db50b3403a2e585874dd2a6cd3a1d2281ef372f42
7
- data.tar.gz: 8b6972c2c68a783be7e7246cecc04397d4afc88f423a051321c769f3c29f2cf82a34928d4729e5d661c77505f5be2f81f17f8c74e8159a2a3c1207c69b1d1da5
6
+ metadata.gz: aa73df7297d3b0daaf259c41ae0068c52ef1a84f3ba6909f33356d459ccf8c8803a5dbefce4b74a09c8ad8c8189df12889990615d946fa429ed42937a0efb354
7
+ data.tar.gz: 5c05f8a496b3f28f99f06a1a9e07add764f64cfebd0bd4a5789bec0e3c7612c183247587f4430fe503bc4ad07096931e532f2c05bdc21120c86de6e300dcf1aa
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  pkg/*
2
2
  .ruby-gemset
3
3
  .ruby-version
4
+ tmp/*
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspectacles (0.0.4)
4
+ rspectacles (0.0.6)
5
5
  em-hiredis (~> 0.2.1)
6
6
  rake
7
7
  redis
@@ -9,7 +9,7 @@ PATH
9
9
  thin (>= 1.5.0)
10
10
 
11
11
  GEM
12
- remote: http://rubygems.org/
12
+ remote: https://rubygems.org/
13
13
  specs:
14
14
  daemons (1.1.9)
15
15
  diff-lcs (1.1.3)
data/bin/rspectacles CHANGED
@@ -1,16 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
2
 
4
- require 'eventmachine'
5
- EM.run do
6
- begin
7
- require 'rspectacles/app.rb'
8
- rescue LoadError => e
9
- require 'rubygems'
10
- path = File.expand_path '../../lib', __FILE__
11
- $:.unshift(path) if File.directory?(path) && !$:.include?(path)
12
- require 'rspectacles/app.rb'
13
- end
14
-
15
- Thin::Server.start RSpectacles::App, '0.0.0.0', 4567
3
+ begin
4
+ require 'rspectacles/app.rb'
5
+ rescue LoadError => e
6
+ require 'rubygems'
7
+ path = File.expand_path '../../lib', __FILE__
8
+ $:.unshift(path) if File.directory?(path) && !$:.include?(path)
9
+ require 'rspectacles/app.rb'
16
10
  end
11
+
12
+ Thin::Server.start RSpectacles::App, '0.0.0.0', 4567
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/lib')
2
+ require 'rspectacles/app'
3
+
4
+ run RSpectacles::App.new
@@ -0,0 +1,15 @@
1
+ RSpectacles::App.helpers do
2
+ def versioned_stylesheet(stylesheet)
3
+ checksum = File.mtime(File.join(public_dir, 'css', "#{stylesheet}.css")).to_i
4
+ url "/css/#{stylesheet}.css?#{checksum}"
5
+ end
6
+
7
+ def versioned_javascript(js)
8
+ checksum = File.mtime(File.join(public_dir, 'js', "#{js}.js")).to_i
9
+ url "/js/#{js}.js?#{checksum}"
10
+ end
11
+
12
+ def public_dir
13
+ File.expand_path('../../app/public', __FILE__)
14
+ end
15
+ end
@@ -1,3 +1,19 @@
1
+ ul {
2
+ border: 1px solid #eee;
3
+ list-style-type: none;
4
+ margin: 0;
5
+ padding: 15px;
6
+ font-size: 12px;
7
+ }
8
+
9
+ li {
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ .failed { color: red; }
15
+ .passed { color: green; }
16
+
1
17
  body {
2
18
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
3
19
  margin: auto;
@@ -21,19 +37,3 @@ form {
21
37
  overflow: auto;
22
38
  max-width: 350px;
23
39
  }
24
-
25
- ul {
26
- border: 1px solid #eee;
27
- list-style-type: none;
28
- margin: 0;
29
- padding: 15px;
30
- font-size: 12px;
31
- }
32
-
33
- li {
34
- margin: 0;
35
- padding: 0;
36
- }
37
-
38
- .failed { color: red; }
39
- .passed { color: green; }
@@ -74,25 +74,28 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
74
74
  function (d) { return d.size; };
75
75
  }
76
76
 
77
+ function getColor(d) {
78
+ if (d.status && d.status === 'failed') {
79
+ return '#f00';
80
+ } else {
81
+ return options.color(((d.children ? d : d.parent) || {}).name);
82
+ }
83
+ }
84
+
77
85
  function render() {
78
86
  var path = svg.datum(me.tree.nodes).selectAll("path")
79
87
  .data(partition.value(getValue()).nodes);
80
88
 
81
89
  path
82
90
  .attr("d", arc)
83
- .each(stash);
91
+ .each(stash)
92
+ .style("fill", getColor);
84
93
 
85
94
  path.enter().append("path")
86
95
  .attr("display", function (d) { return d.depth ? null : "none"; })
87
96
  .attr("d", arc)
88
- .style("stroke", function (d) { return '#fff'; })
89
- .style("fill", function (d) {
90
- if (d.status && d.status === 'failed') {
91
- return '#f00';
92
- } else {
93
- return options.color(((d.children ? d : d.parent) || {}).name);
94
- }
95
- })
97
+ .style("stroke", function (d) { return 'rgba(255,255,255,0.3)'; })
98
+ .style("fill", getColor)
96
99
  .style("fill-rule", "evenodd")
97
100
  .each(stash)
98
101
  .on('mouseover', showDetails);
@@ -2,7 +2,7 @@
2
2
  define(['riffle'], function (riffle) {
3
3
  'use strict';
4
4
 
5
- return function streams(uri) {
5
+ return function streams(serverUri, ajaxUri) {
6
6
  var stream = riffle.stream
7
7
  , me
8
8
  , serverEvents
@@ -17,7 +17,7 @@ define(['riffle'], function (riffle) {
17
17
  ;
18
18
 
19
19
  serverEvents = stream(function (o, i) {
20
- new EventSource(uri).addEventListener('message', o);
20
+ new EventSource(serverUri).addEventListener('message', o);
21
21
  }).invoke();
22
22
 
23
23
  function ajaxStream(url, args) {
@@ -69,7 +69,7 @@ define(['riffle'], function (riffle) {
69
69
  }
70
70
 
71
71
  stringEvents = eventToString.input(serverEvents);
72
- ajaxEvents = each.input(ajaxStream('/last').invoke());
72
+ ajaxEvents = each.input(ajaxStream(ajaxUri).invoke());
73
73
  allEvents = stream().input(stringEvents, ajaxEvents);
74
74
 
75
75
  return me = {
@@ -43,7 +43,7 @@ define(['jquery'], function ($) {
43
43
  data.forEach(function (node) {
44
44
  var path = node.file_path.split('/');
45
45
 
46
- ['.', 'spec'].forEach(function (v) {
46
+ ['.'].forEach(function (v) {
47
47
  if (path[0] === v) { path.shift(); }
48
48
  });
49
49
 
@@ -5,7 +5,8 @@ require(['chart', 'exampleStream'], function (chart, examples) {
5
5
  var
6
6
  bodyEl = document.querySelector('body')
7
7
  , uri = bodyEl.dataset.streamUrl
8
- , streams = examples(uri)
8
+ , ajaxUri = bodyEl.dataset.lastUrl
9
+ , streams = examples(uri, ajaxUri)
9
10
  , c = chart()
10
11
  ;
11
12
 
@@ -3,9 +3,9 @@
3
3
  <html>
4
4
  <head>
5
5
  <title>RSpectacles</title>
6
- <link rel='stylesheet' href='<%= url 'css/style.css' %>' />
6
+ <link rel='stylesheet' href='<%= versioned_stylesheet 'style' %>' />
7
7
  </head>
8
- <body data-stream-url=<%= url '/stream' %>>
8
+ <body data-stream-url=<%= url '/stream' %> data-last-url=<%= url '/last' %>>
9
9
  <form>
10
10
  <label><input type="radio" name="mode" value="size" checked> Time</label>
11
11
  <label><input type="radio" name="mode" value="count"> Count</label>
@@ -27,9 +27,9 @@
27
27
  </ul>
28
28
  </script>
29
29
 
30
- <script type='text/javascript' src='<%= url '/js/d3.js' %>'></script>
31
- <script type='text/javascript' src='<%= url '/js/plates.js' %>'></script>
32
- <script type='text/javascript' data-main='<%= url 'js/script' %>' src='<%= url '/js/require.js' %>'></script>
30
+ <script type='text/javascript' src='<%= versioned_javascript 'd3' %>'></script>
31
+ <script type='text/javascript' src='<%= versioned_javascript 'plates' %>'></script>
32
+ <script type='text/javascript' data-main='<%= versioned_javascript 'script' %>' src='<%= versioned_javascript 'require' %>'></script>
33
33
  <script>
34
34
  require.config({ urlArgs: (new Date().getTime())});
35
35
  </script>
@@ -8,6 +8,7 @@ require 'thin'
8
8
 
9
9
  module RSpectacles
10
10
  class App < Sinatra::Base
11
+ require 'rspectacles/app/helpers'
11
12
  connections = []
12
13
  dir = File.dirname(File.expand_path(__FILE__))
13
14
  set :app_file, __FILE__
@@ -22,8 +23,7 @@ module RSpectacles
22
23
  end
23
24
 
24
25
  uri = URI.parse 'redis://127.0.0.1:6379/'
25
- $emredis = nil
26
- $redis = Redis.new host: uri.host, port: uri.port
26
+ redis = Redis.new host: uri.host, port: uri.port
27
27
 
28
28
  # Routes
29
29
  get '/' do
@@ -38,22 +38,16 @@ module RSpectacles
38
38
  end
39
39
 
40
40
  get '/last' do
41
- $redis.lrange('redis-rspec-last-run', 0, -1).to_json
42
- end
43
-
44
- def dump_last_run(out)
45
- $emredis.lrange('redis-rspec-last-run', 0, -1) do |list|
46
- list.each { |msg| out << "data: #{msg}\n\n" }
47
- end
41
+ redis.lrange('redis-rspec-last-run', 0, -1).to_json
48
42
  end
49
43
 
44
+ # pubsub and streaming - EventMachine support only
50
45
  EM.next_tick do
51
- $emredis = EM::Hiredis.connect(uri)
46
+ emredis = EM::Hiredis.connect(uri)
52
47
 
53
- $emredis.pubsub.subscribe 'redis-rspec-examples' do |message|
48
+ emredis.pubsub.subscribe 'redis-rspec-examples' do |message|
54
49
  connections.each { |out| out << "data: #{message}\n\n" }
55
50
  end
56
51
  end
57
52
  end
58
53
  end
59
-
@@ -1,3 +1,3 @@
1
1
  module RSpectacles
2
- VERSION='0.0.4'
2
+ VERSION='0.0.6'
3
3
  end
data/rspectacles.gemspec CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = 'https://github.com/G2Labs-net/rspectacles'
11
11
  s.summary = %q{Visualize rspec test running in the browser}
12
12
  s.description = %q{Visualize rspec test running in the browser}
13
+ s.license = 'MIT'
13
14
 
14
15
  s.rubyforge_project = 'rspectacles'
15
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wheeler
@@ -108,8 +108,10 @@ files:
108
108
  - LICENSE
109
109
  - Rakefile
110
110
  - bin/rspectacles
111
+ - config.ru
111
112
  - lib/rspectacles.rb
112
113
  - lib/rspectacles/app.rb
114
+ - lib/rspectacles/app/helpers.rb
113
115
  - lib/rspectacles/app/public/css/style.css
114
116
  - lib/rspectacles/app/public/js/chart.js
115
117
  - lib/rspectacles/app/public/js/d3.js
@@ -130,7 +132,8 @@ files:
130
132
  - spec/javascripts/test.html
131
133
  - spec/javascripts/tests/pathtree_spec.js
132
134
  homepage: https://github.com/G2Labs-net/rspectacles
133
- licenses: []
135
+ licenses:
136
+ - MIT
134
137
  metadata: {}
135
138
  post_install_message:
136
139
  rdoc_options: []