beanstalkd_view 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +2 -1
- data/Rakefile +46 -0
- data/lib/beanstalkd_view/extensions/beanstalk-pool.rb +39 -0
- data/lib/beanstalkd_view/resources/{bootstrap/css/overrides.css → css/app.css} +11 -0
- data/lib/beanstalkd_view/resources/css/vendor/bootstrap.min.css +9 -0
- data/lib/beanstalkd_view/resources/js/app.js +4 -0
- data/lib/beanstalkd_view/resources/js/peek_jobs.js +2 -2
- data/lib/beanstalkd_view/resources/js/peek_range.js +21 -0
- data/lib/beanstalkd_view/resources/js/{bluff → vendor/bluff-0.3.6.2}/bluff-min.js +0 -0
- data/lib/beanstalkd_view/resources/js/{bluff → vendor/bluff-0.3.6.2}/js-class.js +0 -0
- data/lib/beanstalkd_view/resources/js/vendor/bootstrap.min.js +6 -0
- data/lib/beanstalkd_view/resources/js/{jquery-1.7.1.min.js → vendor/jquery-1.7.1.min.js} +0 -0
- data/lib/beanstalkd_view/resources/js/{json2.js → vendor/json2.js} +0 -0
- data/lib/beanstalkd_view/server.rb +85 -34
- data/lib/beanstalkd_view/version.rb +1 -1
- data/lib/beanstalkd_view/views/index.erb +9 -0
- data/lib/beanstalkd_view/views/layout.erb +7 -15
- data/lib/beanstalkd_view/views/peek_range.erb +51 -0
- data/lib/beanstalkd_view/views/tube_stats.erb +9 -1
- data/lib/beanstalkd_view.rb +2 -0
- data/spec/integration/rails_integration_spec.rb +13 -0
- data/spec/integration/sinatra_integration_spec.rb +13 -0
- data/spec/lib/beanstalkd_view/beanstalkd_util_spec.rb +1 -1
- data/spec/rails_app/config/routes.rb +3 -0
- data/spec/rails_app/log/test.log +11325 -0
- data/spec/rails_helper.rb +21 -0
- data/spec/spec_helper.rb +4 -1
- data/spec/{lib/beanstalkd_view/server_spec.rb → support/integration_test_shared_examples.rb} +38 -38
- metadata +60 -16
- data/lib/beanstalkd_view/resources/bootstrap/css/bootstrap.min.css +0 -706
- data/lib/beanstalkd_view/resources/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/lib/beanstalkd_view/resources/bootstrap/img/glyphicons-halflings.png +0 -0
- data/lib/beanstalkd_view/resources/bootstrap/js/bootstrap.min.js +0 -7
- data/lib/beanstalkd_view/resources/js/bluff/excanvas.js +0 -35
@@ -3,22 +3,14 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<title>Beanstalkd View - <%= BeanstalkdView::VERSION %></title>
|
6
|
-
<link rel="stylesheet" type="text/css" href="<%= u('/bootstrap/css/bootstrap.min.css') %>"/>
|
7
|
-
<link rel="stylesheet" type="text/css" href="<%= u('/bootstrap/css/overrides.css') %>"/>
|
8
6
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<script type="text/javascript">
|
17
|
-
<!-- Enable Tooltips -->
|
18
|
-
$(document).ready(function() {
|
19
|
-
$("[rel=tooltip]").tooltip();
|
20
|
-
});
|
21
|
-
</script>
|
7
|
+
<% css_imports = css :application, :media => 'screen' %>
|
8
|
+
<% js_imports = js :application %>
|
9
|
+
<%# Must modify sinatra-assetpack output to use the Mount prefix when embedding through Rails %>
|
10
|
+
<% if path_prefix %>
|
11
|
+
<%= css_imports.gsub(/href='/, "href='#{path_prefix}") %>
|
12
|
+
<%= js_imports.gsub(/src='/, "src='#{path_prefix}") %>
|
13
|
+
<% end %>
|
22
14
|
</head>
|
23
15
|
<body>
|
24
16
|
<!-- Header -->
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="span12">
|
3
|
+
<h3>Peek Range</h3>
|
4
|
+
<div class="alert alert-success">
|
5
|
+
<strong>NOTE:</strong> Setting min and max to 0 will attempt to guess an appropriate range value based on the current ready queue.
|
6
|
+
</div>
|
7
|
+
<form class="well form-inline" name="peek_range_form" action="<%= u("/peek-range") %>" method="GET">
|
8
|
+
<input type="text" class="span2" name="min" value="<%= @min %>">
|
9
|
+
<input type="text" class="span2" name="max" value="<%= @max %>">
|
10
|
+
<select id="peek_range_tube_select" class="span2" name="tube">
|
11
|
+
<option></option>
|
12
|
+
<% @tube_set.each do |tube| %>
|
13
|
+
<option <% if @tube == tube%>selected="true"<% end %>><%=tube%></option>
|
14
|
+
<% end %>
|
15
|
+
</select>
|
16
|
+
<button type="submit" class="btn">Refresh</button>
|
17
|
+
</form>
|
18
|
+
<table id="peek_range_table" class="table table-bordered">
|
19
|
+
<tr>
|
20
|
+
<th>ID</th>
|
21
|
+
<th>Priority</th>
|
22
|
+
<th>Age</th>
|
23
|
+
<th>Delay</th>
|
24
|
+
<th>TTR</th>
|
25
|
+
<th>Time Left</th>
|
26
|
+
<th>Reserves</th>
|
27
|
+
<th>Timeouts</th>
|
28
|
+
<th>Releases</th>
|
29
|
+
<th>Buries</th>
|
30
|
+
<th>Kicks</th>
|
31
|
+
<th>Body</th>
|
32
|
+
</tr>
|
33
|
+
<% @jobs.each do |job| %>
|
34
|
+
<tr data-tube="<%=job['tube']%>" <% if job['pri'] < 1024 %>class="urgent"<%end%>>
|
35
|
+
<td><%=job['id']%></td>
|
36
|
+
<td><%=job['pri']%></td>
|
37
|
+
<td><%=job['age']%></td>
|
38
|
+
<td><%=job['delay']%></td>
|
39
|
+
<td><%=job['ttr']%></td>
|
40
|
+
<td><%=job['time-left']%></td>
|
41
|
+
<td><%=job['reserves']%></td>
|
42
|
+
<td><%=job['timeouts']%></td>
|
43
|
+
<td><%=job['releases']%></td>
|
44
|
+
<td><%=job['buries']%></td>
|
45
|
+
<td><%=job['kicks']%></td>
|
46
|
+
<td><p class="peek_range_job_body"><%=job['body'].inspect%><p></td>
|
47
|
+
</tr>
|
48
|
+
<% end %>
|
49
|
+
</table>
|
50
|
+
</div>
|
51
|
+
</div>
|
@@ -95,7 +95,7 @@
|
|
95
95
|
</form>
|
96
96
|
|
97
97
|
<h3>Kick Tube</h3>
|
98
|
-
<form class="well form-inline" name="kick_form" action="<%= u("/kick") %>" method="POST">
|
98
|
+
<form id="kick_form" class="well form-inline" name="kick_form" action="<%= u("/kick") %>" method="POST">
|
99
99
|
<input type="hidden" name="tube" value="<%= @tube %>">
|
100
100
|
<input type="text" class="span3" placeholder="Number of jobs" name="bound">
|
101
101
|
<button type="submit" class="btn">Kick</button>
|
@@ -107,6 +107,14 @@
|
|
107
107
|
<a id="peek_delayed_btn" href="#" class="btn">Peek Delayed</a>
|
108
108
|
<a id="peek_buried_btn" href="#" class="btn">Peek Buried</a>
|
109
109
|
</form>
|
110
|
+
|
111
|
+
<h3>Peek Range</h3>
|
112
|
+
<form id="peek_range_form" class="well form-inline" name="peek_range_form" action="<%= u("/peek-range") %>" method="GET">
|
113
|
+
<input type="hidden" name="tube" value="<%= @tube %>">
|
114
|
+
<input type="text" class="span2" placeholder="0" name="min">
|
115
|
+
<input type="text" class="span2" placeholder="0" name="max">
|
116
|
+
<button type="submit" class="btn">Peek</button>
|
117
|
+
</form>
|
110
118
|
|
111
119
|
</div>
|
112
120
|
|
data/lib/beanstalkd_view.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'sinatra/base'
|
3
3
|
require 'sinatra/cookies'
|
4
|
+
require 'sinatra/assetpack'
|
4
5
|
require 'erb'
|
5
6
|
require "beanstalk-client"
|
6
7
|
require "json"
|
7
8
|
require "beanstalkd_view/version"
|
9
|
+
require "beanstalkd_view/extensions/beanstalk-pool"
|
8
10
|
require "beanstalkd_view/beanstalkd_utils"
|
9
11
|
require 'beanstalkd_view/server'
|
10
12
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "RailsIntegration", :type => :request do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
# Configure Capybara for Rails
|
7
|
+
require "capybara/rails"
|
8
|
+
end
|
9
|
+
|
10
|
+
it_behaves_like "integration_test" do
|
11
|
+
let(:site_root) { '/beanstalkd/' }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "SinatraIntegration", :type => :request do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
ENV['BEANSTALK_URL'] = 'beanstalk://localhost/'
|
7
|
+
Capybara.app = BeanstalkdView::Server.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it_behaves_like "integration_test" do
|
11
|
+
let(:site_root) { '/' }
|
12
|
+
end
|
13
|
+
end
|
@@ -26,7 +26,7 @@ describe BeanstalkdView::BeanstalkdUtils do
|
|
26
26
|
utils = Object.new.extend BeanstalkdView::BeanstalkdUtils
|
27
27
|
@stats = utils.beanstalk.stats
|
28
28
|
@stats.keys.should include('current-jobs-ready')
|
29
|
-
@stats['current-jobs-ready'].should
|
29
|
+
@stats['current-jobs-ready'].should > 0
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|