widescreen 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.html +178 -0
- data/README.md +21 -1
- data/lib/widescreen/dashboard/public/favicon.ico +0 -0
- data/lib/widescreen/dashboard/public/reset.css +48 -0
- data/lib/widescreen/dashboard/public/style.css +85 -0
- data/lib/widescreen/dashboard/views/layout.erb +29 -0
- data/lib/widescreen/dashboard/views/metric.erb +13 -0
- data/lib/widescreen/dashboard/views/metrics.erb +10 -0
- data/lib/widescreen/dashboard.rb +33 -0
- data/lib/widescreen/version.rb +1 -1
- data/lib/widescreen.rb +11 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/widescreen/dashboard_spec.rb +25 -0
- data/widescreen.gemspec +3 -2
- metadata +47 -15
data/README.html
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
<head>
|
2
|
+
<style>
|
3
|
+
body {
|
4
|
+
font-family: georgia, arial, helvetica;
|
5
|
+
padding: 1em;
|
6
|
+
}
|
7
|
+
p {
|
8
|
+
max-width: 40em;
|
9
|
+
}
|
10
|
+
h1 {
|
11
|
+
background-color: #f1f1fd;
|
12
|
+
border-bottom: 1px solid blue;
|
13
|
+
padding: .25em 1em;
|
14
|
+
margin: 1em -1em .25em;
|
15
|
+
}
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<h1>Widescreen<a href="http://travis-ci.org/martinciu/widescreen"><img src="https://secure.travis-ci.org/martinciu/widescreen.png?branch=master" alt="travis-ci" /></a></h1>
|
20
|
+
|
21
|
+
<p>Rack based event statistic framework for any Rack app</p>
|
22
|
+
|
23
|
+
<h2>Requirements</h2>
|
24
|
+
|
25
|
+
<p>Widescreen uses redis as a datastore.</p>
|
26
|
+
|
27
|
+
<p>Widescreen only supports redis 2.0 or greater.</p>
|
28
|
+
|
29
|
+
<p>If you're on OS X, Homebrew is the simplest way to install Redis:</p>
|
30
|
+
|
31
|
+
<pre><code>$ brew install redis
|
32
|
+
$ redis-server /usr/local/etc/redis.conf
|
33
|
+
</code></pre>
|
34
|
+
|
35
|
+
<p>You now have a Redis daemon running on 6379.</p>
|
36
|
+
|
37
|
+
<h2>Setup</h2>
|
38
|
+
|
39
|
+
<p>If you are using bundler add widescreen to your Gemfile:</p>
|
40
|
+
|
41
|
+
<pre><code>gem 'widescreen'
|
42
|
+
</code></pre>
|
43
|
+
|
44
|
+
<p>Then run:</p>
|
45
|
+
|
46
|
+
<pre><code>bundle install
|
47
|
+
</code></pre>
|
48
|
+
|
49
|
+
<p>Otherwise install the gem:</p>
|
50
|
+
|
51
|
+
<pre><code>gem install widescreen
|
52
|
+
</code></pre>
|
53
|
+
|
54
|
+
<p>and require it in your project:</p>
|
55
|
+
|
56
|
+
<pre><code>require 'widescreen'
|
57
|
+
</code></pre>
|
58
|
+
|
59
|
+
<h2>Usage</h2>
|
60
|
+
|
61
|
+
<p>Anywhere in you code call</p>
|
62
|
+
|
63
|
+
<pre><code>Widescreen::Stat.add(:metric_name, 10)
|
64
|
+
</code></pre>
|
65
|
+
|
66
|
+
<p>to increase counter by 10 for <code>metric_name</code> metric or</p>
|
67
|
+
|
68
|
+
<pre><code>Widescreen::Stat.add(:metric_name)
|
69
|
+
</code></pre>
|
70
|
+
|
71
|
+
<p>to increase it by 1</p>
|
72
|
+
|
73
|
+
<h2>Web Interface</h2>
|
74
|
+
|
75
|
+
<p>Widescreen comes with a Sinatra-based front end to get an overview of how your experiments are doing.</p>
|
76
|
+
|
77
|
+
<p>If you are running Rails 2: You can mount this inside your app using Rack::URLMap in your <code>config.ru </code></p>
|
78
|
+
|
79
|
+
<pre><code>require 'widescreen/dashboard'
|
80
|
+
|
81
|
+
run Rack::URLMap.new \
|
82
|
+
"/" => Your::App.new,
|
83
|
+
"/widescreen" => Widescreen::Dashboard.new
|
84
|
+
</code></pre>
|
85
|
+
|
86
|
+
<p>However, if you are using Rails 3: You can mount this inside your app routes by first adding this to config/routes.rb</p>
|
87
|
+
|
88
|
+
<pre><code>mount Widescreen::Dashboard, :at => 'widescreen'
|
89
|
+
</code></pre>
|
90
|
+
|
91
|
+
<p>You may want to password protect that page, you can do so with <code>Rack::Auth::Basic</code></p>
|
92
|
+
|
93
|
+
<pre><code>Widescreen::Dashboard.use Rack::Auth::Basic do |username, password|
|
94
|
+
username == 'admin' && password == 'p4s5w0rd'
|
95
|
+
end
|
96
|
+
</code></pre>
|
97
|
+
|
98
|
+
<p>Dashboard is heavely inspirated by <a href="https://github.com/defunkt/resque">Resque</a> and <a href="https://github.com/andrew/split">Split</a></p>
|
99
|
+
|
100
|
+
<h2>Configuration</h2>
|
101
|
+
|
102
|
+
<h3>Redis</h3>
|
103
|
+
|
104
|
+
<p>You may want to change the Redis host and port Wide connects to, or
|
105
|
+
set various other options at startup.</p>
|
106
|
+
|
107
|
+
<p>Widescreen has a <code>redis</code> setter which can be given a string or a Redis
|
108
|
+
object. This means if you're already using Redis in your app, Widescreen
|
109
|
+
can re-use the existing connection.</p>
|
110
|
+
|
111
|
+
<p>String: <code>Widescreen.redis = 'localhost:6379'</code></p>
|
112
|
+
|
113
|
+
<p>Redis: <code>Widescreen.redis = $redis</code></p>
|
114
|
+
|
115
|
+
<p>For our rails app we have a <code>config/initializers/widescreen.rb</code> file where
|
116
|
+
we load <code>config/widescreen.yml</code> by hand and set the Redis information
|
117
|
+
appropriately.</p>
|
118
|
+
|
119
|
+
<p>Here's our <code>config/widescreen.yml</code>:</p>
|
120
|
+
|
121
|
+
<pre><code>development: localhost:6379
|
122
|
+
test: localhost:6379
|
123
|
+
staging: redis1.example.com:6379
|
124
|
+
fi: localhost:6379
|
125
|
+
production: redis1.example.com:6379
|
126
|
+
</code></pre>
|
127
|
+
|
128
|
+
<p>And our initializer:</p>
|
129
|
+
|
130
|
+
<pre><code>rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
|
131
|
+
rails_env = ENV['RAILS_ENV'] || 'development'
|
132
|
+
|
133
|
+
widescreen_config = YAML.load_file(rails_root + '/config/widescreen.yml')
|
134
|
+
Widescreen.redis = widescreen_config[rails_env]
|
135
|
+
</code></pre>
|
136
|
+
|
137
|
+
<h2>Namespaces</h2>
|
138
|
+
|
139
|
+
<p>If you're running multiple, separate instances of widescreen you may want
|
140
|
+
to namespace the keyspaces so they do not overlap. This is not unlike
|
141
|
+
the approach taken by many memcached clients.</p>
|
142
|
+
|
143
|
+
<p>This feature is provided by the [redis-namespace][rs] library, which
|
144
|
+
widescreen uses by default to separate the keys it manages from other keys
|
145
|
+
in your Redis server.</p>
|
146
|
+
|
147
|
+
<p>Simply use the <code>Widescreen.redis.namespace</code> accessor:</p>
|
148
|
+
|
149
|
+
<pre><code>Widescreen.redis.namespace = "widescreen:blog"
|
150
|
+
</code></pre>
|
151
|
+
|
152
|
+
<p>We recommend sticking this in your initializer somewhere after Redis
|
153
|
+
is configured.</p>
|
154
|
+
|
155
|
+
<h2>Development</h2>
|
156
|
+
|
157
|
+
<p>Source hosted at <a href="http://github.com/martinciu/widescreen">GitHub</a>.
|
158
|
+
Report Issues/Feature requests on <a href="http://github.com/martinciu/widescreen/issues">GitHub Issues</a>.</p>
|
159
|
+
|
160
|
+
<p>Tests can be ran with <code>rake test</code></p>
|
161
|
+
|
162
|
+
<h3>Note on Patches/Pull Requests</h3>
|
163
|
+
|
164
|
+
<ul>
|
165
|
+
<li>Fork the project.</li>
|
166
|
+
<li>Make your feature addition or bug fix.</li>
|
167
|
+
<li>Add tests for it. This is important so I don't break it in a
|
168
|
+
future version unintentionally.</li>
|
169
|
+
<li>Commit, do not mess with rakefile, version, or history.
|
170
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)</li>
|
171
|
+
<li>Send me a pull request. Bonus points for topic branches.</li>
|
172
|
+
</ul>
|
173
|
+
|
174
|
+
|
175
|
+
<h2>Copyright</h2>
|
176
|
+
|
177
|
+
<p>Copyright (c) 2011 Marcin Ciunelis. See <a href="https://github.com/martinciu/widescreen/blob/master/LICENSE">LICENSE</a> for details.</p>
|
178
|
+
|
data/README.md
CHANGED
@@ -46,7 +46,27 @@ to increase it by 1
|
|
46
46
|
|
47
47
|
## Web Interface
|
48
48
|
|
49
|
-
|
49
|
+
Widescreen comes with a Sinatra-based front end to get an overview of how your experiments are doing.
|
50
|
+
|
51
|
+
If you are running Rails 2: You can mount this inside your app using Rack::URLMap in your `config.ru `
|
52
|
+
|
53
|
+
require 'widescreen/dashboard'
|
54
|
+
|
55
|
+
run Rack::URLMap.new \
|
56
|
+
"/" => Your::App.new,
|
57
|
+
"/widescreen" => Widescreen::Dashboard.new
|
58
|
+
|
59
|
+
However, if you are using Rails 3: You can mount this inside your app routes by first adding this to config/routes.rb
|
60
|
+
|
61
|
+
mount Widescreen::Dashboard, :at => 'widescreen'
|
62
|
+
|
63
|
+
You may want to password protect that page, you can do so with `Rack::Auth::Basic`
|
64
|
+
|
65
|
+
Widescreen::Dashboard.use Rack::Auth::Basic do |username, password|
|
66
|
+
username == 'admin' && password == 'p4s5w0rd'
|
67
|
+
end
|
68
|
+
|
69
|
+
Dashboard is inspirated by [Resque](https://github.com/defunkt/resque) and [Split](https://github.com/andrew/split)
|
50
70
|
|
51
71
|
## Configuration
|
52
72
|
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
a, abbr, acronym, address, big, cite, code,
|
4
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
5
|
+
small, strike, strong, sub, sup, tt, var,
|
6
|
+
dl, dt, dd, ul, li,
|
7
|
+
form, label, legend,
|
8
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
border: 0;
|
12
|
+
outline: 0;
|
13
|
+
font-weight: inherit;
|
14
|
+
font-style: normal;
|
15
|
+
font-size: 100%;
|
16
|
+
font-family: inherit;
|
17
|
+
}
|
18
|
+
|
19
|
+
:focus {
|
20
|
+
outline: 0;
|
21
|
+
}
|
22
|
+
|
23
|
+
body {
|
24
|
+
line-height: 1;
|
25
|
+
}
|
26
|
+
|
27
|
+
ul {
|
28
|
+
list-style: none;
|
29
|
+
}
|
30
|
+
|
31
|
+
table {
|
32
|
+
border-collapse: collapse;
|
33
|
+
border-spacing: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
caption, th, td {
|
37
|
+
text-align: left;
|
38
|
+
font-weight: normal;
|
39
|
+
}
|
40
|
+
|
41
|
+
blockquote:before, blockquote:after,
|
42
|
+
q:before, q:after {
|
43
|
+
content: "";
|
44
|
+
}
|
45
|
+
|
46
|
+
blockquote, q {
|
47
|
+
quotes: "" "";
|
48
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
html { background:#efefef; font-family:Arial, Verdana, sans-serif; font-size:13px; }
|
2
|
+
body { padding:0; margin:0; }
|
3
|
+
|
4
|
+
.header { background:#000; padding:8px 5% 0 5%; border-bottom:1px solid #444;border-bottom:5px solid #049405;}
|
5
|
+
.header h1 { color:#333; font-size:90%; font-weight:bold; margin-bottom:6px;}
|
6
|
+
.header ul li { display:inline;}
|
7
|
+
.header ul li a { color:#fff; text-decoration:none; margin-right:10px; display:inline-block; padding:8px; -webkit-border-top-right-radius:6px; -webkit-border-top-left-radius:6px; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; }
|
8
|
+
.header ul li a:hover { background:#333;}
|
9
|
+
.header ul li.current a { background:#049405; font-weight:bold; color:#fff;}
|
10
|
+
|
11
|
+
.header .namespace { position: absolute; right: 75px; top: 10px; color: #7A7A7A; }
|
12
|
+
|
13
|
+
.subnav { padding:2px 5% 7px 5%; background:#049405; font-size:90%;}
|
14
|
+
.subnav li { display:inline;}
|
15
|
+
.subnav li a { color:#fff; text-decoration:none; margin-right:10px; display:inline-block; background:#dd5b5b; padding:5px; -webkit-border-radius:3px; -moz-border-radius:3px;}
|
16
|
+
.subnav li.current a { background:#fff; font-weight:bold; color:#049405;}
|
17
|
+
.subnav li a:active { background:#b00909;}
|
18
|
+
|
19
|
+
#main { padding:10px 5%; background:#fff; overflow:hidden; }
|
20
|
+
#main .logo { float:right; margin:10px;}
|
21
|
+
#main span.hl { background:#efefef; padding:2px;}
|
22
|
+
#main h1 { margin:10px 0; font-size:190%; font-weight:bold; color:#049405;}
|
23
|
+
#main h2 { margin:10px 0; font-size:130%;}
|
24
|
+
#main table { width:100%; margin:10px 0;}
|
25
|
+
#main table tr td, #main table tr th { border:1px solid #ccc; padding:6px;}
|
26
|
+
#main table tr th { background:#efefef; color:#888; font-size:80%; font-weight:bold;}
|
27
|
+
#main table tr td.no-data { text-align:center; padding:40px 0; color:#999; font-style:italic; font-size:130%;}
|
28
|
+
#main a { color:#111;}
|
29
|
+
#main p { margin:5px 0;}
|
30
|
+
#main p.intro { margin-bottom:15px; font-size:85%; color:#999; margin-top:0; line-height:1.3;}
|
31
|
+
#main h1.wi { margin-bottom:5px;}
|
32
|
+
#main p.sub { font-size:95%; color:#999;}
|
33
|
+
|
34
|
+
#main table.queues { width:40%;}
|
35
|
+
#main table.queues td.queue { font-weight:bold; width:50%;}
|
36
|
+
#main table.queues tr.failed td { border-top:2px solid; font-size:90%; }
|
37
|
+
#main table.queues tr.failure td { background:#ffecec; border-top:2px solid #d37474; font-size:90%; color:#d37474;}
|
38
|
+
#main table.queues tr.failure td a{ color:#d37474;}
|
39
|
+
|
40
|
+
#main table.jobs td.class { font-family:Monaco, "Courier New", monospace; font-size:90%; width:50%;}
|
41
|
+
#main table.jobs td.args{ width:50%;}
|
42
|
+
|
43
|
+
#main table.workers td.icon {width:1%; background:#efefef;text-align:center;}
|
44
|
+
#main table.workers td.where { width:25%;}
|
45
|
+
#main table.workers td.queues { width:35%;}
|
46
|
+
#main .queue-tag { background:#b1d2e9; padding:2px; margin:0 3px; font-size:80%; text-decoration:none; text-transform:uppercase; font-weight:bold; color:#3274a2; -webkit-border-radius:4px; -moz-border-radius:4px;}
|
47
|
+
#main table.workers td.queues.queue { width:10%;}
|
48
|
+
#main table.workers td.process { width:35%;}
|
49
|
+
#main table.workers td.process span.waiting { color:#999; font-size:90%;}
|
50
|
+
#main table.workers td.process small { font-size:80%; margin-left:5px;}
|
51
|
+
#main table.workers td.process code { font-family:Monaco, "Courier New", monospace; font-size:90%;}
|
52
|
+
#main table.workers td.process small a { color:#999;}
|
53
|
+
#main.polling table.workers tr.working td { background:#f4ffe4; color:#7ac312;}
|
54
|
+
#main.polling table.workers tr.working td.where a { color:#7ac312;}
|
55
|
+
#main.polling table.workers tr.working td.process code { font-weight:bold;}
|
56
|
+
|
57
|
+
|
58
|
+
#main table.stats th { font-size:100%; width:40%; color:#000;}
|
59
|
+
#main hr { border:0; border-top:5px solid #efefef; margin:15px 0;}
|
60
|
+
|
61
|
+
#footer { padding:10px 5%; background:#efefef; color:#999; font-size:85%; line-height:1.5; border-top:5px solid #ccc; padding-top:10px;}
|
62
|
+
#footer p a { color:#999;}
|
63
|
+
|
64
|
+
#main p.poll { background:url(poll.png) no-repeat 0 2px; padding:3px 0; padding-left:23px; float:right; font-size:85%; }
|
65
|
+
|
66
|
+
#main ul.failed {}
|
67
|
+
#main ul.failed li {background:-webkit-gradient(linear, left top, left bottom, from(#efefef), to(#fff)) #efefef; margin-top:10px; padding:10px; overflow:hidden; -webkit-border-radius:5px; border:1px solid #ccc; }
|
68
|
+
#main ul.failed li dl dt {font-size:80%; color:#999; width:60px; float:left; padding-top:1px; text-align:right;}
|
69
|
+
#main ul.failed li dl dd {margin-bottom:10px; margin-left:70px;}
|
70
|
+
#main ul.failed li dl dd .retried { float:right; text-align: right; }
|
71
|
+
#main ul.failed li dl dd .retried .remove { display:none; margin-top: 8px; }
|
72
|
+
#main ul.failed li.hover dl dd .retried .remove { display:block; }
|
73
|
+
#main ul.failed li dl dd .controls { display:none; float:right; }
|
74
|
+
#main ul.failed li.hover dl dd .controls { display:block; }
|
75
|
+
#main ul.failed li dl dd code, #main ul.failed li dl dd pre { font-family:Monaco, "Courier New", monospace; font-size:90%; white-space: pre-wrap;}
|
76
|
+
#main ul.failed li dl dd.error a {font-family:Monaco, "Courier New", monospace; font-size:90%; }
|
77
|
+
#main ul.failed li dl dd.error pre { margin-top:3px; line-height:1.3;}
|
78
|
+
|
79
|
+
#main p.pagination { background:#efefef; padding:10px; overflow:hidden;}
|
80
|
+
#main p.pagination a.less { float:left;}
|
81
|
+
#main p.pagination a.more { float:right;}
|
82
|
+
|
83
|
+
#main form {float:right; margin-top:-10px;}
|
84
|
+
|
85
|
+
#main .time a.toggle_format {text-decoration:none;}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Widecreen</title>
|
6
|
+
<link href="<%=url 'reset.css' %>" media="screen" rel="stylesheet" type="text/css">
|
7
|
+
<link href="<%=url 'style.css' %>" media="screen" rel="stylesheet" type="text/css">
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div class="header">
|
11
|
+
<ul class='nav'>
|
12
|
+
<li class="current"><a href="<%= url '/' %>">Metrics</a></li>
|
13
|
+
</ul>
|
14
|
+
<abbr class="namespace" title="Widescreen's Redis Namespace">
|
15
|
+
<%= Widescreen.redis.namespace %>
|
16
|
+
</abbr>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div id="main">
|
20
|
+
<%= yield %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div id="footer">
|
24
|
+
<p>Powered by <a href="http://github.com/martinciu/widescreen">Widescreen</a> v<%=Widescreen::VERSION%></p>
|
25
|
+
<p>Connected to Redis namespace <%= Widescreen.redis.namespace %> on <%=Widescreen.redis_id%></p>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
module Widescreen
|
4
|
+
class Dashboard < Sinatra::Base
|
5
|
+
dir = File.dirname(File.expand_path(__FILE__))
|
6
|
+
|
7
|
+
set :views, "#{dir}/dashboard/views"
|
8
|
+
set :public_folder, "#{dir}/dashboard/public"
|
9
|
+
set :static, true
|
10
|
+
set :method_override, true
|
11
|
+
|
12
|
+
helpers do
|
13
|
+
def url(*path_parts)
|
14
|
+
[ path_prefix, path_parts ].join("/").squeeze('/')
|
15
|
+
end
|
16
|
+
|
17
|
+
def path_prefix
|
18
|
+
request.env['SCRIPT_NAME']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
get '/' do
|
23
|
+
@metrics = Widescreen::Metric.all
|
24
|
+
erb :metrics
|
25
|
+
end
|
26
|
+
|
27
|
+
get '/metrics/:name' do
|
28
|
+
@metric = Widescreen::Metric.find(params[:name])
|
29
|
+
erb :metric
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/widescreen/version.rb
CHANGED
data/lib/widescreen.rb
CHANGED
@@ -4,6 +4,7 @@ require 'time'
|
|
4
4
|
require 'widescreen/version'
|
5
5
|
require 'widescreen/metric'
|
6
6
|
require 'widescreen/stat'
|
7
|
+
require 'widescreen/dashboard'
|
7
8
|
|
8
9
|
module Widescreen
|
9
10
|
SEPARATOR = "|"
|
@@ -45,4 +46,14 @@ module Widescreen
|
|
45
46
|
self.redis = Redis.respond_to?(:connect) ? Redis.connect : "localhost:6379"
|
46
47
|
self.redis
|
47
48
|
end
|
49
|
+
|
50
|
+
def redis_id
|
51
|
+
# support 1.x versions of redis-rb
|
52
|
+
if redis.respond_to?(:server)
|
53
|
+
redis.server
|
54
|
+
else
|
55
|
+
redis.client.id
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
48
59
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Widescreen::Dashboard do
|
4
|
+
include Rack::Test::Methods
|
5
|
+
|
6
|
+
def app
|
7
|
+
@app ||= Widescreen::Dashboard
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
Widescreen.redis.flushall
|
12
|
+
Widescreen::Stat.add('foo', 10)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should respond to /" do
|
16
|
+
get '/'
|
17
|
+
last_response.ok?.must_equal true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should respond to /metrics/foo" do
|
21
|
+
get '/metrics/foo'
|
22
|
+
last_response.ok?.must_equal true
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/widescreen.gemspec
CHANGED
@@ -19,8 +19,9 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_dependency 'redis', '~> 2.2.2'
|
21
21
|
s.add_dependency 'redis-namespace', '~> 1.0.3'
|
22
|
-
s.
|
22
|
+
s.add_dependency 'sinatra', '>= 1.2.6'
|
23
|
+
s.add_development_dependency 'rake', '~> 0.9.2'
|
23
24
|
s.add_development_dependency 'minitest', '~> 2.6.1'
|
24
25
|
s.add_development_dependency 'timecop', '~> 0.3.5'
|
25
|
-
|
26
|
+
s.add_development_dependency 'rack-test', '~> 0.6'
|
26
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: widescreen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-21 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153430700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.2.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153430700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis-namespace
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153430100 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,21 +32,32 @@ dependencies:
|
|
32
32
|
version: 1.0.3
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153430100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: sinatra
|
38
|
+
requirement: &2153429480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 1.2.6
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2153429480
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &2153428860 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.2
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153428860
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: minitest
|
49
|
-
requirement: &
|
60
|
+
requirement: &2153407880 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ~>
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: 2.6.1
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153407880
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: timecop
|
60
|
-
requirement: &
|
71
|
+
requirement: &2153406800 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ~>
|
@@ -65,7 +76,18 @@ dependencies:
|
|
65
76
|
version: 0.3.5
|
66
77
|
type: :development
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *2153406800
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rack-test
|
82
|
+
requirement: &2153405700 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0.6'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2153405700
|
69
91
|
description:
|
70
92
|
email: marcin.ciunelis@gmail.com
|
71
93
|
executables: []
|
@@ -76,14 +98,23 @@ files:
|
|
76
98
|
- .travis.yml
|
77
99
|
- Gemfile
|
78
100
|
- LICENSE
|
101
|
+
- README.html
|
79
102
|
- README.md
|
80
103
|
- Rakefile
|
81
104
|
- lib/widescreen.rb
|
105
|
+
- lib/widescreen/dashboard.rb
|
106
|
+
- lib/widescreen/dashboard/public/favicon.ico
|
107
|
+
- lib/widescreen/dashboard/public/reset.css
|
108
|
+
- lib/widescreen/dashboard/public/style.css
|
109
|
+
- lib/widescreen/dashboard/views/layout.erb
|
110
|
+
- lib/widescreen/dashboard/views/metric.erb
|
111
|
+
- lib/widescreen/dashboard/views/metrics.erb
|
82
112
|
- lib/widescreen/metric.rb
|
83
113
|
- lib/widescreen/stat.rb
|
84
114
|
- lib/widescreen/version.rb
|
85
115
|
- spec/redis-test.conf
|
86
116
|
- spec/spec_helper.rb
|
117
|
+
- spec/widescreen/dashboard_spec.rb
|
87
118
|
- spec/widescreen/metric_spec.rb
|
88
119
|
- spec/widescreen/stat_spec.rb
|
89
120
|
- widescreen.gemspec
|
@@ -101,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
132
|
version: '0'
|
102
133
|
segments:
|
103
134
|
- 0
|
104
|
-
hash:
|
135
|
+
hash: -2060582431598513102
|
105
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
137
|
none: false
|
107
138
|
requirements:
|
@@ -110,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
141
|
version: '0'
|
111
142
|
segments:
|
112
143
|
- 0
|
113
|
-
hash:
|
144
|
+
hash: -2060582431598513102
|
114
145
|
requirements: []
|
115
146
|
rubyforge_project:
|
116
147
|
rubygems_version: 1.8.10
|
@@ -120,5 +151,6 @@ summary: Rack based event statistic framework for any Rack app
|
|
120
151
|
test_files:
|
121
152
|
- spec/redis-test.conf
|
122
153
|
- spec/spec_helper.rb
|
154
|
+
- spec/widescreen/dashboard_spec.rb
|
123
155
|
- spec/widescreen/metric_spec.rb
|
124
156
|
- spec/widescreen/stat_spec.rb
|