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
@@ -0,0 +1,21 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
|
3
|
+
%w(
|
4
|
+
action_controller
|
5
|
+
sprockets/rails
|
6
|
+
).each do |framework|
|
7
|
+
begin
|
8
|
+
require "#{framework}/railtie"
|
9
|
+
rescue LoadError
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module BeanstalkdView
|
14
|
+
class RailsApp < ::Rails::Application
|
15
|
+
config.root = File.dirname(__FILE__) + "/rails_app"
|
16
|
+
config.active_support.deprecation = :log
|
17
|
+
config.secret_token = 'Under a shiny rock in the backyard the color of slate'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
BeanstalkdView::RailsApp.initialize!
|
data/spec/spec_helper.rb
CHANGED
@@ -5,9 +5,11 @@ require 'capybara/rspec'
|
|
5
5
|
|
6
6
|
require 'beanstalkd_view'
|
7
7
|
|
8
|
+
require "rails_helper"
|
9
|
+
|
8
10
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
9
11
|
# in spec/support/ and its subdirectories.
|
10
|
-
Dir[File.dirname(__FILE__)+"/support/**/*.rb"].each do |f|
|
12
|
+
Dir[File.dirname(__FILE__)+"/support/**/*.rb"].each do |f|
|
11
13
|
require f
|
12
14
|
end
|
13
15
|
|
@@ -17,3 +19,4 @@ RSpec.configure do |config|
|
|
17
19
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
18
20
|
config.filter_run_excluding :requires_beanstalkd, :requires_two_beanstalkd
|
19
21
|
end
|
22
|
+
|
data/spec/{lib/beanstalkd_view/server_spec.rb → support/integration_test_shared_examples.rb}
RENAMED
@@ -1,12 +1,21 @@
|
|
1
|
-
|
1
|
+
shared_examples 'integration_test' do
|
2
|
+
|
3
|
+
describe "without beanstalkd daemon running" do
|
4
|
+
before :all do
|
5
|
+
# Make sure beanstalkd is NOT running
|
6
|
+
if `pgrep beanstalkd` != ""
|
7
|
+
raise "PRECONDITION NOT MET: beanstalkd running"
|
8
|
+
end
|
9
|
+
end
|
2
10
|
|
3
|
-
|
11
|
+
it "should show error at site root" do
|
12
|
+
visit site_root
|
13
|
+
page.should have_content "Beanstalk::NotConnected"
|
14
|
+
end
|
15
|
+
end
|
4
16
|
|
5
17
|
describe "with beanstalkd daemon running", :requires_beanstalkd => true do
|
6
18
|
before :all do
|
7
|
-
ENV['BEANSTALK_URL'] = 'beanstalk://localhost/'
|
8
|
-
Capybara.app = BeanstalkdView::Server.new
|
9
|
-
|
10
19
|
# Make sure beanstalkd is running
|
11
20
|
if `pgrep beanstalkd` == ""
|
12
21
|
raise "PRECONDITION NOT MET: beanstalkd not running"
|
@@ -14,20 +23,20 @@ describe BeanstalkdView::Server, :type => :request do
|
|
14
23
|
end
|
15
24
|
|
16
25
|
it "should show the overview at: /" do
|
17
|
-
visit
|
26
|
+
visit site_root
|
18
27
|
body.should have_content "Beanstalkd View"
|
19
28
|
body.should have_content "Statistics"
|
20
29
|
body.should have_content "Tubes"
|
21
30
|
end
|
22
31
|
|
23
32
|
it "should show the default tube stats at: tube/default" do
|
24
|
-
visit
|
33
|
+
visit "#{site_root}tube/default"
|
25
34
|
body.should have_content "Beanstalkd View"
|
26
35
|
body.should have_content "Statistics"
|
27
36
|
end
|
28
37
|
|
29
38
|
it "show be able to add a job on the overview page", :js => true do
|
30
|
-
visit
|
39
|
+
visit site_root
|
31
40
|
form = find('#add_job_form')
|
32
41
|
form.fill_in 'form_tube_name', :with => 'test.tube'
|
33
42
|
form.fill_in 'form_job_body', :with => '{"id": 1, "name": "Bob"}'
|
@@ -38,30 +47,41 @@ describe BeanstalkdView::Server, :type => :request do
|
|
38
47
|
end
|
39
48
|
|
40
49
|
it "show be able to click on the test.tube link (created by the last test)", :js => true do
|
41
|
-
visit
|
50
|
+
visit site_root
|
42
51
|
click_link('test.tube')
|
43
52
|
body.should have_content "test.tube"
|
44
53
|
end
|
45
54
|
|
55
|
+
it "show be able to peek_range and see job (created by the last test)", :js => true do
|
56
|
+
visit site_root
|
57
|
+
form = find('#peek_range_form')
|
58
|
+
form.fill_in 'min', :with => '0'
|
59
|
+
form.fill_in 'max', :with => '0'
|
60
|
+
click_button 'Peek'
|
61
|
+
body.should have_content "Peek Range"
|
62
|
+
end
|
63
|
+
|
46
64
|
=begin
|
47
65
|
# Current beanstalk-client lib doesn't support pause_tube action
|
48
66
|
it "show be able to pause a tube", :js => true do
|
49
|
-
visit
|
50
|
-
|
67
|
+
visit "#{site_root}/tube/test.tube"
|
68
|
+
form = find('#pause_form')
|
69
|
+
form.fill_in 'delay', :with => 1
|
51
70
|
click_button "Pause"
|
52
71
|
body.should have_content "Paused test.tube"
|
53
72
|
end
|
54
73
|
=end
|
55
74
|
|
56
75
|
it "show be able to kick a tube", :js => true do
|
57
|
-
visit
|
58
|
-
|
76
|
+
visit "#{site_root}tube/test.tube"
|
77
|
+
form = find('#kick_form')
|
78
|
+
form.fill_in 'bound', :with => 1
|
59
79
|
click_button "Kick"
|
60
80
|
body.should have_content "Kicked test.tube"
|
61
81
|
end
|
62
82
|
|
63
83
|
it "show be able to peek_ready a tube", :js => true do
|
64
|
-
visit
|
84
|
+
visit "#{site_root}tube/test.tube"
|
65
85
|
click_link('peek_ready_btn')
|
66
86
|
body.should have_content "Job id:"
|
67
87
|
end
|
@@ -69,9 +89,6 @@ describe BeanstalkdView::Server, :type => :request do
|
|
69
89
|
|
70
90
|
describe "with two beanstalkd daemons running", :requires_two_beanstalkd => true do
|
71
91
|
before :all do
|
72
|
-
ENV['BEANSTALK_URL'] = 'beanstalk://localhost:12300/,beanstalk://localhost:12400/'
|
73
|
-
Capybara.app = BeanstalkdView::Server.new
|
74
|
-
|
75
92
|
# Make sure beanstalkd is running
|
76
93
|
if `pgrep beanstalkd` == ""
|
77
94
|
raise "PRECONDITION NOT MET: beanstalkd not running"
|
@@ -79,14 +96,14 @@ describe BeanstalkdView::Server, :type => :request do
|
|
79
96
|
end
|
80
97
|
|
81
98
|
it "should show the overview at: /" do
|
82
|
-
visit
|
99
|
+
visit site_root
|
83
100
|
body.should have_content "Beanstalkd View"
|
84
101
|
body.should have_content "Statistics"
|
85
102
|
body.should have_content "Tubes"
|
86
103
|
end
|
87
104
|
|
88
105
|
it "show be able to add a job on the overview page, and view its stats", :js => true do
|
89
|
-
visit
|
106
|
+
visit site_root
|
90
107
|
form = find('#add_job_form')
|
91
108
|
form.fill_in 'form_tube_name', :with => 'test.tube'
|
92
109
|
form.fill_in 'form_job_body', :with => '{"id": 1, "name": "Bob"}'
|
@@ -95,27 +112,10 @@ describe BeanstalkdView::Server, :type => :request do
|
|
95
112
|
click_link "confirm_add_job_btn"
|
96
113
|
body.should have_content "Added job "
|
97
114
|
|
98
|
-
visit
|
115
|
+
visit site_root
|
99
116
|
click_link('test.tube')
|
100
117
|
body.should have_content "test.tube"
|
101
118
|
end
|
102
119
|
end
|
103
|
-
|
104
|
-
describe "with out beanstalkd daemon running" do
|
105
|
-
before :all do
|
106
|
-
ENV['BEANSTALK_URL'] = 'beanstalk://localhost/'
|
107
|
-
Capybara.app = BeanstalkdView::Server.new
|
108
|
-
|
109
|
-
# Make sure beanstalkd is NOT running
|
110
|
-
if `pgrep beanstalkd` != ""
|
111
|
-
raise "PRECONDITION NOT MET: beanstalkd running"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should show error at: /" do
|
116
|
-
visit '/'
|
117
|
-
page.should have_content "Beanstalk::NotConnected"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
120
|
+
|
121
121
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beanstalkd_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 1.3.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sinatra-assetpack
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.0.11
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.11
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: beanstalk-client
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,6 +171,22 @@ dependencies:
|
|
155
171
|
- - ! '>='
|
156
172
|
- !ruby/object:Gem::Version
|
157
173
|
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: rails
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
158
190
|
description: A Sinatra app to view/manage beanstalkd queues that can be embedded in
|
159
191
|
a Rails app similar to what's available in Resque
|
160
192
|
email: dennis.kuczynski@gmail.com
|
@@ -164,35 +196,42 @@ extensions: []
|
|
164
196
|
extra_rdoc_files: []
|
165
197
|
files:
|
166
198
|
- README.md
|
199
|
+
- CHANGELOG.md
|
167
200
|
- Gemfile
|
168
201
|
- Rakefile
|
169
202
|
- MIT-LICENSE.txt
|
170
203
|
- lib/beanstalkd_view/beanstalkd_utils.rb
|
204
|
+
- lib/beanstalkd_view/extensions/beanstalk-pool.rb
|
171
205
|
- lib/beanstalkd_view/Gemfile
|
172
206
|
- lib/beanstalkd_view/Rakefile
|
173
|
-
- lib/beanstalkd_view/resources/
|
174
|
-
- lib/beanstalkd_view/resources/
|
175
|
-
- lib/beanstalkd_view/resources/
|
176
|
-
- lib/beanstalkd_view/resources/bootstrap/img/glyphicons-halflings.png
|
177
|
-
- lib/beanstalkd_view/resources/bootstrap/js/bootstrap.min.js
|
178
|
-
- lib/beanstalkd_view/resources/js/bluff/bluff-min.js
|
179
|
-
- lib/beanstalkd_view/resources/js/bluff/excanvas.js
|
180
|
-
- lib/beanstalkd_view/resources/js/bluff/js-class.js
|
181
|
-
- lib/beanstalkd_view/resources/js/jquery-1.7.1.min.js
|
182
|
-
- lib/beanstalkd_view/resources/js/json2.js
|
207
|
+
- lib/beanstalkd_view/resources/css/app.css
|
208
|
+
- lib/beanstalkd_view/resources/css/vendor/bootstrap.min.css
|
209
|
+
- lib/beanstalkd_view/resources/js/app.js
|
183
210
|
- lib/beanstalkd_view/resources/js/peek_jobs.js
|
211
|
+
- lib/beanstalkd_view/resources/js/peek_range.js
|
212
|
+
- lib/beanstalkd_view/resources/js/vendor/bluff-0.3.6.2/bluff-min.js
|
213
|
+
- lib/beanstalkd_view/resources/js/vendor/bluff-0.3.6.2/js-class.js
|
214
|
+
- lib/beanstalkd_view/resources/js/vendor/bootstrap.min.js
|
215
|
+
- lib/beanstalkd_view/resources/js/vendor/jquery-1.7.1.min.js
|
216
|
+
- lib/beanstalkd_view/resources/js/vendor/json2.js
|
184
217
|
- lib/beanstalkd_view/server.rb
|
185
218
|
- lib/beanstalkd_view/version.rb
|
186
219
|
- lib/beanstalkd_view/views/error.erb
|
187
220
|
- lib/beanstalkd_view/views/index.erb
|
188
221
|
- lib/beanstalkd_view/views/job_info_popup.erb
|
189
222
|
- lib/beanstalkd_view/views/layout.erb
|
223
|
+
- lib/beanstalkd_view/views/peek_range.erb
|
190
224
|
- lib/beanstalkd_view/views/tube_stats.erb
|
191
225
|
- lib/beanstalkd_view.rb
|
192
226
|
- bin/beanstalkd_view
|
227
|
+
- spec/integration/rails_integration_spec.rb
|
228
|
+
- spec/integration/sinatra_integration_spec.rb
|
193
229
|
- spec/lib/beanstalkd_view/beanstalkd_util_spec.rb
|
194
|
-
- spec/
|
230
|
+
- spec/rails_app/config/routes.rb
|
231
|
+
- spec/rails_app/log/test.log
|
232
|
+
- spec/rails_helper.rb
|
195
233
|
- spec/spec_helper.rb
|
234
|
+
- spec/support/integration_test_shared_examples.rb
|
196
235
|
homepage: https://github.com/denniskuczynski/beanstalkd_view
|
197
236
|
licenses: []
|
198
237
|
post_install_message:
|
@@ -207,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
246
|
version: '0'
|
208
247
|
segments:
|
209
248
|
- 0
|
210
|
-
hash:
|
249
|
+
hash: 508936170925941146
|
211
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
251
|
none: false
|
213
252
|
requirements:
|
@@ -216,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
255
|
version: '0'
|
217
256
|
segments:
|
218
257
|
- 0
|
219
|
-
hash:
|
258
|
+
hash: 508936170925941146
|
220
259
|
requirements: []
|
221
260
|
rubyforge_project:
|
222
261
|
rubygems_version: 1.8.24
|
@@ -225,6 +264,11 @@ specification_version: 3
|
|
225
264
|
summary: A Sinatra app to view/manage beanstalkd queues that can be embedded in a
|
226
265
|
Rails app similar to what's available in Resque
|
227
266
|
test_files:
|
267
|
+
- spec/integration/rails_integration_spec.rb
|
268
|
+
- spec/integration/sinatra_integration_spec.rb
|
228
269
|
- spec/lib/beanstalkd_view/beanstalkd_util_spec.rb
|
229
|
-
- spec/
|
270
|
+
- spec/rails_app/config/routes.rb
|
271
|
+
- spec/rails_app/log/test.log
|
272
|
+
- spec/rails_helper.rb
|
230
273
|
- spec/spec_helper.rb
|
274
|
+
- spec/support/integration_test_shared_examples.rb
|