delayed_job_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +118 -0
- data/README +47 -0
- data/Rakefile +32 -0
- data/app/controllers/delayed_job_admin_controller.rb +10 -0
- data/app/views/delayed_job_admin/index.html.erb +57 -0
- data/app/views/layouts/delayed_job_admin.html.erb +24 -0
- data/config/routes.rb +3 -0
- data/delayed_job_admin.gemspec +30 -0
- data/lib/delayed_job_admin.rb +1 -0
- data/lib/delayed_job_admin/engine.rb +4 -0
- data/lib/delayed_job_admin/version.rb +3 -0
- data/test/delayed_job_admin_test.rb +9 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +8 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/fail_job.rb +5 -0
- data/test/dummy/app/models/puts_job.rb +5 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +17 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/migrator.rb +1 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/migrate/001_create_delayed_jobs.rb +21 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/navigation_test.rb +44 -0
- data/test/support/integration_case.rb +5 -0
- data/test/test_helper.rb +22 -0
- metadata +232 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
delayed_job_admin (0.0.1)
|
5
|
+
delayed_job
|
6
|
+
rails
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
abstract (1.0.0)
|
12
|
+
actionmailer (3.0.3)
|
13
|
+
actionpack (= 3.0.3)
|
14
|
+
mail (~> 2.2.9)
|
15
|
+
actionpack (3.0.3)
|
16
|
+
activemodel (= 3.0.3)
|
17
|
+
activesupport (= 3.0.3)
|
18
|
+
builder (~> 2.1.2)
|
19
|
+
erubis (~> 2.6.6)
|
20
|
+
i18n (~> 0.4)
|
21
|
+
rack (~> 1.2.1)
|
22
|
+
rack-mount (~> 0.6.13)
|
23
|
+
rack-test (~> 0.5.6)
|
24
|
+
tzinfo (~> 0.3.23)
|
25
|
+
activemodel (3.0.3)
|
26
|
+
activesupport (= 3.0.3)
|
27
|
+
builder (~> 2.1.2)
|
28
|
+
i18n (~> 0.4)
|
29
|
+
activerecord (3.0.3)
|
30
|
+
activemodel (= 3.0.3)
|
31
|
+
activesupport (= 3.0.3)
|
32
|
+
arel (~> 2.0.2)
|
33
|
+
tzinfo (~> 0.3.23)
|
34
|
+
activeresource (3.0.3)
|
35
|
+
activemodel (= 3.0.3)
|
36
|
+
activesupport (= 3.0.3)
|
37
|
+
activesupport (3.0.3)
|
38
|
+
arel (2.0.7)
|
39
|
+
builder (2.1.2)
|
40
|
+
capybara (0.4.0)
|
41
|
+
celerity (>= 0.7.9)
|
42
|
+
culerity (>= 0.2.4)
|
43
|
+
mime-types (>= 1.16)
|
44
|
+
nokogiri (>= 1.3.3)
|
45
|
+
rack (>= 1.0.0)
|
46
|
+
rack-test (>= 0.5.4)
|
47
|
+
selenium-webdriver (>= 0.0.27)
|
48
|
+
xpath (~> 0.1.2)
|
49
|
+
celerity (0.8.7)
|
50
|
+
childprocess (0.1.6)
|
51
|
+
ffi (~> 0.6.3)
|
52
|
+
configuration (1.1.0)
|
53
|
+
culerity (0.2.14)
|
54
|
+
daemons (1.1.0)
|
55
|
+
delayed_job (2.0.3)
|
56
|
+
daemons
|
57
|
+
erubis (2.6.6)
|
58
|
+
abstract (>= 1.0.0)
|
59
|
+
ffi (0.6.3)
|
60
|
+
rake (>= 0.8.7)
|
61
|
+
i18n (0.5.0)
|
62
|
+
json_pure (1.4.6)
|
63
|
+
launchy (0.3.7)
|
64
|
+
configuration (>= 0.0.5)
|
65
|
+
rake (>= 0.8.1)
|
66
|
+
mail (2.2.14)
|
67
|
+
activesupport (>= 2.3.6)
|
68
|
+
i18n (>= 0.4.0)
|
69
|
+
mime-types (~> 1.16)
|
70
|
+
treetop (~> 1.4.8)
|
71
|
+
mime-types (1.16)
|
72
|
+
nokogiri (1.4.4)
|
73
|
+
polyglot (0.3.1)
|
74
|
+
rack (1.2.1)
|
75
|
+
rack-mount (0.6.13)
|
76
|
+
rack (>= 1.0.0)
|
77
|
+
rack-test (0.5.7)
|
78
|
+
rack (>= 1.0)
|
79
|
+
rails (3.0.3)
|
80
|
+
actionmailer (= 3.0.3)
|
81
|
+
actionpack (= 3.0.3)
|
82
|
+
activerecord (= 3.0.3)
|
83
|
+
activeresource (= 3.0.3)
|
84
|
+
activesupport (= 3.0.3)
|
85
|
+
bundler (~> 1.0)
|
86
|
+
railties (= 3.0.3)
|
87
|
+
railties (3.0.3)
|
88
|
+
actionpack (= 3.0.3)
|
89
|
+
activesupport (= 3.0.3)
|
90
|
+
rake (>= 0.8.7)
|
91
|
+
thor (~> 0.14.4)
|
92
|
+
rake (0.8.7)
|
93
|
+
rubyzip (0.9.4)
|
94
|
+
selenium-webdriver (0.1.2)
|
95
|
+
childprocess (~> 0.1.5)
|
96
|
+
ffi (~> 0.6.3)
|
97
|
+
json_pure
|
98
|
+
rubyzip
|
99
|
+
sqlite3 (1.3.3)
|
100
|
+
sqlite3-ruby (1.3.3)
|
101
|
+
sqlite3 (>= 1.3.3)
|
102
|
+
thor (0.14.6)
|
103
|
+
treetop (1.4.9)
|
104
|
+
polyglot (>= 0.3.1)
|
105
|
+
tzinfo (0.3.24)
|
106
|
+
xpath (0.1.3)
|
107
|
+
nokogiri (~> 1.3)
|
108
|
+
|
109
|
+
PLATFORMS
|
110
|
+
ruby
|
111
|
+
|
112
|
+
DEPENDENCIES
|
113
|
+
capybara
|
114
|
+
delayed_job
|
115
|
+
delayed_job_admin!
|
116
|
+
launchy
|
117
|
+
rails
|
118
|
+
sqlite3-ruby
|
data/README
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
= Delayed Job Admin
|
2
|
+
|
3
|
+
Simple admin interface for the Delayed::Job gem
|
4
|
+
|
5
|
+
= Usage
|
6
|
+
|
7
|
+
- Install the gem:
|
8
|
+
|
9
|
+
# Gemfile
|
10
|
+
gem "delayed_job_admin"
|
11
|
+
|
12
|
+
bundle install
|
13
|
+
|
14
|
+
- Setup authentication:
|
15
|
+
|
16
|
+
- Define a delayed_job_admin_authentication method in ApplicationController:
|
17
|
+
|
18
|
+
# app/controllers/application_controller.rb
|
19
|
+
|
20
|
+
def delayed_job_admin_authentication
|
21
|
+
# authentication_logic_goes_here
|
22
|
+
end
|
23
|
+
|
24
|
+
- For example, if you are using the Devise gem and have an Admin model:
|
25
|
+
|
26
|
+
# app/controllers/application_controller.rb
|
27
|
+
|
28
|
+
def delayed_job_admin_authentication
|
29
|
+
authenticate_admin!
|
30
|
+
end
|
31
|
+
|
32
|
+
- View the admin interface:
|
33
|
+
|
34
|
+
open http://localhost:3000/delayed_job_admin
|
35
|
+
|
36
|
+
= License
|
37
|
+
|
38
|
+
MIT License - Copyright (c) 2011 Trevor Turk and CaptainU
|
39
|
+
|
40
|
+
= Todo
|
41
|
+
|
42
|
+
x index
|
43
|
+
x require admin login, docs
|
44
|
+
x show
|
45
|
+
- destroy
|
46
|
+
- restart
|
47
|
+
- restart all
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rubygems'
|
3
|
+
begin
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'bundler'
|
10
|
+
Bundler::GemHelper.install_tasks
|
11
|
+
|
12
|
+
require 'rake'
|
13
|
+
require 'rake/rdoctask'
|
14
|
+
|
15
|
+
require 'rake/testtask'
|
16
|
+
|
17
|
+
Rake::TestTask.new(:test) do |t|
|
18
|
+
t.libs << 'lib'
|
19
|
+
t.libs << 'test'
|
20
|
+
t.pattern = 'test/**/*_test.rb'
|
21
|
+
t.verbose = false
|
22
|
+
end
|
23
|
+
|
24
|
+
task :default => :test
|
25
|
+
|
26
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
27
|
+
rdoc.rdoc_dir = 'rdoc'
|
28
|
+
rdoc.title = 'DelayedJobAdmin'
|
29
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
30
|
+
rdoc.rdoc_files.include('README.rdoc')
|
31
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
32
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<p>Delayed::Job.count: <%= Delayed::Job.count %></p>
|
2
|
+
|
3
|
+
<table id="jobs">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>priority</th>
|
7
|
+
<th>attempts</th>
|
8
|
+
<th>handler</th>
|
9
|
+
<th>last_error</th>
|
10
|
+
<th>run_at</th>
|
11
|
+
<th>locked_at</th>
|
12
|
+
<th>failed_at</th>
|
13
|
+
<th>locked_by</th>
|
14
|
+
<th>created_at</th>
|
15
|
+
<th>updated_at</th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% Delayed::Job.all.reverse.each do |job| %>
|
20
|
+
<tr class="job" id="job-<%= job.id %>">
|
21
|
+
<td><%= job.priority %></td>
|
22
|
+
<td><%= job.attempts %></td>
|
23
|
+
<td><%= truncate(job.handler || 'nil', :length => 50).gsub('---', '') %></td>
|
24
|
+
<td><%= truncate(job.last_error || 'nil', :length => 50) %></td>
|
25
|
+
<td><%= job.run_at.present? ? job.run_at.to_s(:short) : '-' %></td>
|
26
|
+
<td><%= job.locked_at.present? ? job.locked_at.to_s(:short) : '-' %></td>
|
27
|
+
<td><%= job.failed_at.present? ? job.failed_at.to_s(:short) : '-' %></td>
|
28
|
+
<td><%= job.locked_by || '-' %></td>
|
29
|
+
<td><%= job.created_at.to_s(:short) %></td>
|
30
|
+
<td><%= job.updated_at.to_s(:short) %></td>
|
31
|
+
</tr>
|
32
|
+
<tr class="job-details" id="job-details-<%= job.id %>">
|
33
|
+
<td colspan="10"><p><pre><%= job.to_yaml %></pre></p></td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<script>
|
40
|
+
$(document).ready(function(){
|
41
|
+
|
42
|
+
$(".job").hover(
|
43
|
+
function () {
|
44
|
+
$(this).css("cursor", "pointer");
|
45
|
+
$(this).addClass("hover");
|
46
|
+
},
|
47
|
+
function () {
|
48
|
+
$(this).removeClass("hover");
|
49
|
+
}
|
50
|
+
);
|
51
|
+
|
52
|
+
$(".job").click(function(event){
|
53
|
+
$(this).next("tr").toggle();
|
54
|
+
});
|
55
|
+
|
56
|
+
});
|
57
|
+
</script>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>delayed_job_admin</title>
|
6
|
+
<style>
|
7
|
+
/* http://meyerweb.com/eric/tools/css/reset */
|
8
|
+
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
|
9
|
+
body { margin:20px; }
|
10
|
+
h1 { margin:20px 0; }
|
11
|
+
p { margin:1em 0; }
|
12
|
+
table { width: 100%; }
|
13
|
+
th, td { padding:2px; border:1px solid #ccc; }
|
14
|
+
.job-details { display:none; }
|
15
|
+
.job-details td { padding: 0 1em; }
|
16
|
+
.hover { background: #ddd; }
|
17
|
+
</style>
|
18
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<h1>delayed_job_admin</h1>
|
22
|
+
<%= yield %>
|
23
|
+
</body>
|
24
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "delayed_job_admin/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "delayed_job_admin"
|
7
|
+
s.version = DelayedJobAdmin::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Trevor Turk"]
|
10
|
+
s.email = ["trevorturk@gmail.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/delayed_job_admin"
|
12
|
+
s.summary = %q{Simple admin interface for the Delayed::Job gem}
|
13
|
+
s.description = %q{Simple admin interface for the Delayed::Job gem}
|
14
|
+
|
15
|
+
s.rubyforge_project = "delayed_job_admin"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency("rails")
|
23
|
+
s.add_dependency("delayed_job")
|
24
|
+
|
25
|
+
s.add_development_dependency "rails"
|
26
|
+
s.add_development_dependency "capybara"
|
27
|
+
s.add_development_dependency "sqlite3-ruby"
|
28
|
+
s.add_development_dependency "delayed_job"
|
29
|
+
s.add_development_dependency "launchy"
|
30
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'delayed_job_admin/engine'
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
|
9
|
+
Bundler.require
|
10
|
+
require "delayed_job_admin"
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
17
|
+
|
18
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
19
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
20
|
+
|
21
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
22
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
23
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
24
|
+
|
25
|
+
# Activate observers that should always be running.
|
26
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
27
|
+
|
28
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
29
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
30
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
31
|
+
|
32
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
33
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
|
+
# config.i18n.default_locale = :de
|
35
|
+
|
36
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
37
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
38
|
+
|
39
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
40
|
+
config.encoding = "utf-8"
|
41
|
+
|
42
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
43
|
+
config.filter_parameters += [:password]
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ActiveRecord::Migrator.migrate(File.expand_path("../../db/migrate/", __FILE__))
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = 'cb170d7fd62a914c114f17e020135484baf333dec4fd72bf60ed2fb50949b971672a5295d2b9de3df17b3b563dfc235a7d7676f8392349bbdd3e7c957ec765ae'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,58 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDelayedJobs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :delayed_jobs, :force => true do |table|
|
4
|
+
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
|
5
|
+
table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
|
6
|
+
table.text :handler # YAML-encoded string of the object that will do work
|
7
|
+
table.text :last_error # reason for last failure (See Note below)
|
8
|
+
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
|
9
|
+
table.datetime :locked_at # Set when a client is working on this object
|
10
|
+
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
11
|
+
table.string :locked_by # Who is working on this object (if locked)
|
12
|
+
table.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :delayed_jobs
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NavigationTest < ActiveSupport::IntegrationCase
|
4
|
+
|
5
|
+
setup do
|
6
|
+
Delayed::Job.delete_all
|
7
|
+
end
|
8
|
+
|
9
|
+
test "dummy rails app" do
|
10
|
+
assert_kind_of Dummy::Application, Rails.application
|
11
|
+
end
|
12
|
+
|
13
|
+
test "index if not authorized" do
|
14
|
+
visit delayed_job_admin_path(:unauthorized => true)
|
15
|
+
assert_match 'unauthorized', page.body
|
16
|
+
end
|
17
|
+
|
18
|
+
test "index with no jobs" do
|
19
|
+
visit delayed_job_admin_path
|
20
|
+
|
21
|
+
assert_match 'delayed_job_admin', page.body
|
22
|
+
assert_match 'Delayed::Job.count: 0', page.body
|
23
|
+
end
|
24
|
+
|
25
|
+
test "index with jobs" do
|
26
|
+
Delayed::Job.enqueue PutsJob.new('test')
|
27
|
+
|
28
|
+
visit delayed_job_admin_path
|
29
|
+
|
30
|
+
assert_match 'Delayed::Job.count: 1', page.body
|
31
|
+
assert_match 'PutsJob', page.body
|
32
|
+
end
|
33
|
+
|
34
|
+
test "index with failed jobs" do
|
35
|
+
Delayed::Job.enqueue FailJob.new('test')
|
36
|
+
Delayed::Worker.new.work_off
|
37
|
+
|
38
|
+
visit delayed_job_admin_path
|
39
|
+
|
40
|
+
assert_match 'Delayed::Job.count: 1', page.body
|
41
|
+
assert_match 'FailJob', page.body
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
ActionMailer::Base.delivery_method = :test
|
8
|
+
ActionMailer::Base.perform_deliveries = true
|
9
|
+
ActionMailer::Base.default_url_options[:host] = "www.example.com"
|
10
|
+
|
11
|
+
Rails.backtrace_cleaner.remove_silencers!
|
12
|
+
|
13
|
+
# Configure capybara for integration testing
|
14
|
+
require "capybara/rails"
|
15
|
+
Capybara.default_driver = :rack_test
|
16
|
+
Capybara.default_selector = :css
|
17
|
+
|
18
|
+
# Run any available migration
|
19
|
+
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
20
|
+
|
21
|
+
# Load support files
|
22
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
metadata
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: delayed_job_admin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Trevor Turk
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-20 00:00:00 +00:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
name: rails
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
type: :runtime
|
46
|
+
name: delayed_job
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
type: :development
|
60
|
+
name: rails
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
type: :development
|
74
|
+
name: capybara
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
type: :development
|
88
|
+
name: sqlite3-ruby
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
type: :development
|
102
|
+
name: delayed_job
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
version: "0"
|
115
|
+
type: :development
|
116
|
+
name: launchy
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: *id007
|
119
|
+
description: Simple admin interface for the Delayed::Job gem
|
120
|
+
email:
|
121
|
+
- trevorturk@gmail.com
|
122
|
+
executables: []
|
123
|
+
|
124
|
+
extensions: []
|
125
|
+
|
126
|
+
extra_rdoc_files: []
|
127
|
+
|
128
|
+
files:
|
129
|
+
- .gitignore
|
130
|
+
- Gemfile
|
131
|
+
- Gemfile.lock
|
132
|
+
- README
|
133
|
+
- Rakefile
|
134
|
+
- app/controllers/delayed_job_admin_controller.rb
|
135
|
+
- app/views/delayed_job_admin/index.html.erb
|
136
|
+
- app/views/layouts/delayed_job_admin.html.erb
|
137
|
+
- config/routes.rb
|
138
|
+
- delayed_job_admin.gemspec
|
139
|
+
- lib/delayed_job_admin.rb
|
140
|
+
- lib/delayed_job_admin/engine.rb
|
141
|
+
- lib/delayed_job_admin/version.rb
|
142
|
+
- test/delayed_job_admin_test.rb
|
143
|
+
- test/dummy/Rakefile
|
144
|
+
- test/dummy/app/controllers/application_controller.rb
|
145
|
+
- test/dummy/app/helpers/application_helper.rb
|
146
|
+
- test/dummy/app/models/fail_job.rb
|
147
|
+
- test/dummy/app/models/puts_job.rb
|
148
|
+
- test/dummy/app/views/layouts/application.html.erb
|
149
|
+
- test/dummy/config.ru
|
150
|
+
- test/dummy/config/application.rb
|
151
|
+
- test/dummy/config/boot.rb
|
152
|
+
- test/dummy/config/database.yml
|
153
|
+
- test/dummy/config/environment.rb
|
154
|
+
- test/dummy/config/environments/development.rb
|
155
|
+
- test/dummy/config/environments/test.rb
|
156
|
+
- test/dummy/config/initializers/migrator.rb
|
157
|
+
- test/dummy/config/initializers/secret_token.rb
|
158
|
+
- test/dummy/config/initializers/session_store.rb
|
159
|
+
- test/dummy/config/locales/en.yml
|
160
|
+
- test/dummy/config/routes.rb
|
161
|
+
- test/dummy/db/migrate/001_create_delayed_jobs.rb
|
162
|
+
- test/dummy/public/404.html
|
163
|
+
- test/dummy/public/422.html
|
164
|
+
- test/dummy/public/500.html
|
165
|
+
- test/dummy/public/favicon.ico
|
166
|
+
- test/dummy/script/rails
|
167
|
+
- test/integration/navigation_test.rb
|
168
|
+
- test/support/integration_case.rb
|
169
|
+
- test/test_helper.rb
|
170
|
+
has_rdoc: true
|
171
|
+
homepage: http://rubygems.org/gems/delayed_job_admin
|
172
|
+
licenses: []
|
173
|
+
|
174
|
+
post_install_message:
|
175
|
+
rdoc_options: []
|
176
|
+
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
hash: 3
|
185
|
+
segments:
|
186
|
+
- 0
|
187
|
+
version: "0"
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
none: false
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
hash: 3
|
194
|
+
segments:
|
195
|
+
- 0
|
196
|
+
version: "0"
|
197
|
+
requirements: []
|
198
|
+
|
199
|
+
rubyforge_project: delayed_job_admin
|
200
|
+
rubygems_version: 1.3.7
|
201
|
+
signing_key:
|
202
|
+
specification_version: 3
|
203
|
+
summary: Simple admin interface for the Delayed::Job gem
|
204
|
+
test_files:
|
205
|
+
- test/delayed_job_admin_test.rb
|
206
|
+
- test/dummy/Rakefile
|
207
|
+
- test/dummy/app/controllers/application_controller.rb
|
208
|
+
- test/dummy/app/helpers/application_helper.rb
|
209
|
+
- test/dummy/app/models/fail_job.rb
|
210
|
+
- test/dummy/app/models/puts_job.rb
|
211
|
+
- test/dummy/app/views/layouts/application.html.erb
|
212
|
+
- test/dummy/config.ru
|
213
|
+
- test/dummy/config/application.rb
|
214
|
+
- test/dummy/config/boot.rb
|
215
|
+
- test/dummy/config/database.yml
|
216
|
+
- test/dummy/config/environment.rb
|
217
|
+
- test/dummy/config/environments/development.rb
|
218
|
+
- test/dummy/config/environments/test.rb
|
219
|
+
- test/dummy/config/initializers/migrator.rb
|
220
|
+
- test/dummy/config/initializers/secret_token.rb
|
221
|
+
- test/dummy/config/initializers/session_store.rb
|
222
|
+
- test/dummy/config/locales/en.yml
|
223
|
+
- test/dummy/config/routes.rb
|
224
|
+
- test/dummy/db/migrate/001_create_delayed_jobs.rb
|
225
|
+
- test/dummy/public/404.html
|
226
|
+
- test/dummy/public/422.html
|
227
|
+
- test/dummy/public/500.html
|
228
|
+
- test/dummy/public/favicon.ico
|
229
|
+
- test/dummy/script/rails
|
230
|
+
- test/integration/navigation_test.rb
|
231
|
+
- test/support/integration_case.rb
|
232
|
+
- test/test_helper.rb
|