dj_dashboard 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +25 -1
- data/app/models/dj_dashboard/job.rb +1 -1
- data/dj_dashboard.gemspec +5 -0
- data/lib/dj_dashboard/version.rb +1 -1
- data/spec/controllers/dj_dashboard/jobs_controller_spec.rb +14 -0
- data/spec/models/dj_dashboard/job_spec.rb +67 -0
- data/spec/spec_helper.rb +33 -0
- data/test/dummy/spec/spec_helper.rb +33 -0
- metadata +76 -13
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -11,3 +11,11 @@ gem 'haml'
|
|
11
11
|
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
12
12
|
# gem 'ruby-debug'
|
13
13
|
# gem 'ruby-debug19'
|
14
|
+
|
15
|
+
group :test, :development do
|
16
|
+
gem 'rspec-rails'
|
17
|
+
gem 'rr'
|
18
|
+
gem 'faker'
|
19
|
+
gem 'machinist', '~> 1.0'
|
20
|
+
gem 'shoulda'
|
21
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dj_dashboard (0.0.
|
4
|
+
dj_dashboard (0.0.5)
|
5
5
|
delayed_job
|
6
6
|
haml
|
7
7
|
rails (~> 3.0)
|
@@ -52,12 +52,16 @@ GEM
|
|
52
52
|
delayed_job (2.1.4)
|
53
53
|
activesupport (~> 3.0)
|
54
54
|
daemons
|
55
|
+
diff-lcs (1.1.3)
|
55
56
|
erubis (2.6.6)
|
56
57
|
abstract (>= 1.0.0)
|
58
|
+
faker (1.0.1)
|
59
|
+
i18n (~> 0.4)
|
57
60
|
ffi (1.0.11)
|
58
61
|
haml (3.1.4)
|
59
62
|
i18n (0.5.0)
|
60
63
|
json (1.6.3)
|
64
|
+
machinist (1.0.6)
|
61
65
|
mail (2.2.19)
|
62
66
|
activesupport (>= 2.3.6)
|
63
67
|
i18n (>= 0.4.0)
|
@@ -89,6 +93,20 @@ GEM
|
|
89
93
|
rake (0.9.2.2)
|
90
94
|
rdoc (3.11)
|
91
95
|
json (~> 1.4)
|
96
|
+
rr (1.0.4)
|
97
|
+
rspec (2.7.0)
|
98
|
+
rspec-core (~> 2.7.0)
|
99
|
+
rspec-expectations (~> 2.7.0)
|
100
|
+
rspec-mocks (~> 2.7.0)
|
101
|
+
rspec-core (2.7.1)
|
102
|
+
rspec-expectations (2.7.0)
|
103
|
+
diff-lcs (~> 1.1.2)
|
104
|
+
rspec-mocks (2.7.0)
|
105
|
+
rspec-rails (2.7.0)
|
106
|
+
actionpack (~> 3.0)
|
107
|
+
activesupport (~> 3.0)
|
108
|
+
railties (~> 3.0)
|
109
|
+
rspec (~> 2.7.0)
|
92
110
|
rubyzip (0.9.5)
|
93
111
|
sass (3.1.11)
|
94
112
|
selenium-webdriver (2.15.0)
|
@@ -96,6 +114,7 @@ GEM
|
|
96
114
|
ffi (~> 1.0.9)
|
97
115
|
multi_json (~> 1.0.4)
|
98
116
|
rubyzip
|
117
|
+
shoulda (2.11.3)
|
99
118
|
sqlite3 (1.3.5)
|
100
119
|
thor (0.14.6)
|
101
120
|
treetop (1.4.10)
|
@@ -112,6 +131,11 @@ DEPENDENCIES
|
|
112
131
|
capybara (>= 0.4.0)
|
113
132
|
delayed_job
|
114
133
|
dj_dashboard!
|
134
|
+
faker
|
115
135
|
haml
|
136
|
+
machinist (~> 1.0)
|
116
137
|
rails (= 3.0.11)
|
138
|
+
rr
|
139
|
+
rspec-rails
|
140
|
+
shoulda
|
117
141
|
sqlite3
|
@@ -12,7 +12,7 @@ module DjDashboard
|
|
12
12
|
{
|
13
13
|
name: job,
|
14
14
|
running: Delayed::Job.where("handler like '%#{job}%'").where("locked_at is not null").count,
|
15
|
-
failed: Delayed::Job.where("handler like '%#{job}%'").where("failed_at is not null and attempts
|
15
|
+
failed: Delayed::Job.where("handler like '%#{job}%'").where("failed_at is not null and attempts >= 3").count,
|
16
16
|
pending: Delayed::Job.where("handler like '%#{job}%'").where(locked_at: nil, failed_at: nil).count,
|
17
17
|
retrying: Delayed::Job.where("handler like '%#{job}%'").where(locked_at: nil).where("failed_at is not null").count
|
18
18
|
}
|
data/dj_dashboard.gemspec
CHANGED
@@ -23,4 +23,9 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency "rails", '~> 3.0'
|
24
24
|
|
25
25
|
s.add_development_dependency "sqlite3"
|
26
|
+
s.add_development_dependency "rspec-rails"
|
27
|
+
s.add_development_dependency "shoulda"
|
28
|
+
s.add_development_dependency "rr"
|
29
|
+
s.add_development_dependency "machinist", "~> 1.0"
|
30
|
+
s.add_development_dependency "faker"
|
26
31
|
end
|
data/lib/dj_dashboard/version.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DjDashboard::Job do
|
4
|
+
|
5
|
+
describe ".fetch" do
|
6
|
+
class MyJob
|
7
|
+
def perform; end
|
8
|
+
end
|
9
|
+
|
10
|
+
class MyOtherJob
|
11
|
+
def perform; end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return a hash for each job" do
|
15
|
+
Delayed::Job.enqueue MyJob.new
|
16
|
+
Delayed::Job.enqueue MyOtherJob.new
|
17
|
+
results = DjDashboard::Job.fetch
|
18
|
+
|
19
|
+
found_myjob = results.any? { |job| job[:name] == 'MyJob' }
|
20
|
+
found_myjob.should be_true
|
21
|
+
found_myotherjob = results.any? { |job| job[:name] == 'MyOtherJob' }
|
22
|
+
found_myotherjob.should be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return each job hash with attributes: name, running, failed, pending, retrying" do
|
26
|
+
Delayed::Job.enqueue MyJob.new
|
27
|
+
Delayed::Job.enqueue MyOtherJob.new
|
28
|
+
results = DjDashboard::Job.fetch
|
29
|
+
results.each { |res| res.keys.should include(:name, :running, :failed, :pending, :retrying) }
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return running jobs" do
|
33
|
+
2.times { Delayed::Job.enqueue MyJob.new }
|
34
|
+
|
35
|
+
Delayed::Job.update_all(locked_at: Time.now)
|
36
|
+
|
37
|
+
results = DjDashboard::Job.fetch
|
38
|
+
results.first[:running].should eql(2)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should return failed jobs" do
|
42
|
+
2.times { Delayed::Job.enqueue MyJob.new }
|
43
|
+
|
44
|
+
Delayed::Job.update_all(failed_at: Time.now, attempts: 3)
|
45
|
+
|
46
|
+
results = DjDashboard::Job.fetch
|
47
|
+
results.first[:failed].should eql(2)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return pending jobs" do
|
51
|
+
2.times { Delayed::Job.enqueue MyJob.new }
|
52
|
+
|
53
|
+
results = DjDashboard::Job.fetch
|
54
|
+
results.first[:pending].should eql(2)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return retrying jobs" do
|
58
|
+
2.times { Delayed::Job.enqueue MyJob.new }
|
59
|
+
|
60
|
+
Delayed::Job.update_all(failed_at: Time.now)
|
61
|
+
|
62
|
+
results = DjDashboard::Job.fetch
|
63
|
+
results.first[:retrying].should eql(2)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../test/dummy/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# == Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
config.mock_with :rr
|
19
|
+
# config.mock_with :rspec
|
20
|
+
|
21
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
22
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
23
|
+
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, remove the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
|
29
|
+
# If true, the base class of anonymous controllers will be inferred
|
30
|
+
# automatically. This will be the default behavior in future versions of
|
31
|
+
# rspec-rails.
|
32
|
+
config.infer_base_class_for_anonymous_controllers = false
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# == Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
config.mock_with :rspec
|
20
|
+
|
21
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
22
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
23
|
+
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, remove the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
|
29
|
+
# If true, the base class of anonymous controllers will be inferred
|
30
|
+
# automatically. This will be the default behavior in future versions of
|
31
|
+
# rspec-rails.
|
32
|
+
config.infer_base_class_for_anonymous_controllers = false
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dj_dashboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-12 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
16
|
-
requirement: &
|
16
|
+
requirement: &70128177353460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70128177353460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sass
|
27
|
-
requirement: &
|
27
|
+
requirement: &70128177352460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70128177352460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: delayed_job
|
38
|
-
requirement: &
|
38
|
+
requirement: &70128177351280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70128177351280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rails
|
49
|
-
requirement: &
|
49
|
+
requirement: &70128177350480 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70128177350480
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sqlite3
|
60
|
-
requirement: &
|
60
|
+
requirement: &70128177349880 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,62 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70128177349880
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: &70128177349200 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70128177349200
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: shoulda
|
82
|
+
requirement: &70128177348580 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70128177348580
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rr
|
93
|
+
requirement: &70128177347740 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70128177347740
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: machinist
|
104
|
+
requirement: &70128177346940 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70128177346940
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: faker
|
115
|
+
requirement: &70128177346200 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70128177346200
|
69
124
|
description: Delayed Job Dashboard
|
70
125
|
email:
|
71
126
|
- ben.kempner@gmail.com
|
@@ -93,6 +148,9 @@ files:
|
|
93
148
|
- lib/tasks/install.rake
|
94
149
|
- public/javascripts/dj_dashboard/jobs.js
|
95
150
|
- public/stylesheets/dj_dashboard/jobs.css
|
151
|
+
- spec/controllers/dj_dashboard/jobs_controller_spec.rb
|
152
|
+
- spec/models/dj_dashboard/job_spec.rb
|
153
|
+
- spec/spec_helper.rb
|
96
154
|
- test/dj_dashboard_test.rb
|
97
155
|
- test/dummy/Rakefile
|
98
156
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -129,6 +187,7 @@ files:
|
|
129
187
|
- test/dummy/public/stylesheets/.gitkeep
|
130
188
|
- test/dummy/script/delayed_job
|
131
189
|
- test/dummy/script/rails
|
190
|
+
- test/dummy/spec/spec_helper.rb
|
132
191
|
- test/integration/navigation_test.rb
|
133
192
|
- test/support/integration_case.rb
|
134
193
|
- test/test_helper.rb
|
@@ -146,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
205
|
version: '0'
|
147
206
|
segments:
|
148
207
|
- 0
|
149
|
-
hash:
|
208
|
+
hash: 1105974597055427148
|
150
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
210
|
none: false
|
152
211
|
requirements:
|
@@ -155,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
214
|
version: '0'
|
156
215
|
segments:
|
157
216
|
- 0
|
158
|
-
hash:
|
217
|
+
hash: 1105974597055427148
|
159
218
|
requirements: []
|
160
219
|
rubyforge_project:
|
161
220
|
rubygems_version: 1.8.6
|
@@ -163,6 +222,9 @@ signing_key:
|
|
163
222
|
specification_version: 3
|
164
223
|
summary: Delayed Job Dashboard
|
165
224
|
test_files:
|
225
|
+
- spec/controllers/dj_dashboard/jobs_controller_spec.rb
|
226
|
+
- spec/models/dj_dashboard/job_spec.rb
|
227
|
+
- spec/spec_helper.rb
|
166
228
|
- test/dj_dashboard_test.rb
|
167
229
|
- test/dummy/Rakefile
|
168
230
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -199,6 +261,7 @@ test_files:
|
|
199
261
|
- test/dummy/public/stylesheets/.gitkeep
|
200
262
|
- test/dummy/script/delayed_job
|
201
263
|
- test/dummy/script/rails
|
264
|
+
- test/dummy/spec/spec_helper.rb
|
202
265
|
- test/integration/navigation_test.rb
|
203
266
|
- test/support/integration_case.rb
|
204
267
|
- test/test_helper.rb
|