jobbr 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +164 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +28 -0
- data/app/assets/images/jobbr/.gitkeep +0 -0
- data/app/assets/javascripts/jobbr/application.js.coffee +34 -0
- data/app/assets/stylesheets/jobbr/application.css.scss +79 -0
- data/app/controllers/jobbr/application_controller.rb +19 -0
- data/app/controllers/jobbr/delayed_jobs_controller.rb +17 -0
- data/app/controllers/jobbr/jobs_controller.rb +17 -0
- data/app/controllers/jobbr/runs_controller.rb +12 -0
- data/app/helpers/jobbr/application_helper.rb +36 -0
- data/app/models/jobbr/delayed_job.rb +38 -0
- data/app/models/jobbr/job.rb +110 -0
- data/app/models/jobbr/log_message.rb +15 -0
- data/app/models/jobbr/run.rb +61 -0
- data/app/models/jobbr/scheduled_job.rb +29 -0
- data/app/models/jobbr/standalone_tasks.rb +56 -0
- data/app/views/jobbr/jobs/_job_list.html.haml +23 -0
- data/app/views/jobbr/jobs/index.html.haml +6 -0
- data/app/views/jobbr/jobs/show.html.haml +30 -0
- data/app/views/jobbr/runs/_logs.html.haml +7 -0
- data/app/views/jobbr/runs/show.html.haml +31 -0
- data/app/views/layouts/jobbr/application.html.haml +20 -0
- data/config/locales/jobbr.en.yml +39 -0
- data/config/routes.rb +11 -0
- data/jobbr.gemspec +25 -0
- data/lib/jobbr.rb +4 -0
- data/lib/jobbr/engine.rb +7 -0
- data/lib/jobbr/logger.rb +55 -0
- data/lib/jobbr/mongoid.rb +54 -0
- data/lib/jobbr/version.rb +3 -0
- data/lib/jobbr/whenever.rb +24 -0
- data/lib/tasks/jobbr_tasks.rake +14 -0
- data/script/rails +8 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/scheduled_jobs/dummy_scheduled_job.rb +15 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/mongoid.yml +80 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/schedule.rb +10 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/delayed_job_spec.rb +37 -0
- data/spec/models/scheduled_job_spec.rb +106 -0
- data/spec/spec_helper.rb +32 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +284 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/javascripts/bootstrap.js +7 -0
- data/vendor/assets/javascripts/jquery-pjax.js +677 -0
- data/vendor/assets/stylesheets/bootstrap.css.scss +705 -0
- data/vendor/assets/stylesheets/font-awesome.css.scss +534 -0
- metadata +275 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'jquery-rails'
|
6
|
+
gem 'whenever'
|
7
|
+
gem 'mongoid', '~> 3.0'
|
8
|
+
gem 'haml'
|
9
|
+
gem 'chronic_duration'
|
10
|
+
|
11
|
+
gem 'sass-rails'
|
12
|
+
gem 'coffee-rails'
|
13
|
+
|
14
|
+
group :development do
|
15
|
+
gem 'unicorn'
|
16
|
+
end
|
17
|
+
|
18
|
+
group :test do
|
19
|
+
gem 'rspec-rails'
|
20
|
+
gem 'mocha'
|
21
|
+
gem 'database_cleaner'
|
22
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jobbr (1.0.1)
|
5
|
+
chronic_duration
|
6
|
+
mongoid (~> 3.0)
|
7
|
+
rails (~> 3.2)
|
8
|
+
whenever
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: http://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actionmailer (3.2.11)
|
14
|
+
actionpack (= 3.2.11)
|
15
|
+
mail (~> 2.4.4)
|
16
|
+
actionpack (3.2.11)
|
17
|
+
activemodel (= 3.2.11)
|
18
|
+
activesupport (= 3.2.11)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
journey (~> 1.0.4)
|
22
|
+
rack (~> 1.4.0)
|
23
|
+
rack-cache (~> 1.2)
|
24
|
+
rack-test (~> 0.6.1)
|
25
|
+
sprockets (~> 2.2.1)
|
26
|
+
activemodel (3.2.11)
|
27
|
+
activesupport (= 3.2.11)
|
28
|
+
builder (~> 3.0.0)
|
29
|
+
activerecord (3.2.11)
|
30
|
+
activemodel (= 3.2.11)
|
31
|
+
activesupport (= 3.2.11)
|
32
|
+
arel (~> 3.0.2)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.2.11)
|
35
|
+
activemodel (= 3.2.11)
|
36
|
+
activesupport (= 3.2.11)
|
37
|
+
activesupport (3.2.11)
|
38
|
+
i18n (~> 0.6)
|
39
|
+
multi_json (~> 1.0)
|
40
|
+
arel (3.0.2)
|
41
|
+
builder (3.0.4)
|
42
|
+
chronic (0.9.0)
|
43
|
+
chronic_duration (0.9.6)
|
44
|
+
numerizer (~> 0.1.1)
|
45
|
+
coffee-rails (3.2.2)
|
46
|
+
coffee-script (>= 2.2.0)
|
47
|
+
railties (~> 3.2.0)
|
48
|
+
coffee-script (2.2.0)
|
49
|
+
coffee-script-source
|
50
|
+
execjs
|
51
|
+
coffee-script-source (1.4.0)
|
52
|
+
combustion (0.3.3)
|
53
|
+
rails (>= 3.0.0)
|
54
|
+
thor (>= 0.14.6)
|
55
|
+
database_cleaner (0.9.1)
|
56
|
+
diff-lcs (1.1.3)
|
57
|
+
erubis (2.7.0)
|
58
|
+
execjs (1.4.0)
|
59
|
+
multi_json (~> 1.0)
|
60
|
+
haml (3.1.7)
|
61
|
+
hike (1.2.1)
|
62
|
+
i18n (0.6.1)
|
63
|
+
journey (1.0.4)
|
64
|
+
jquery-rails (2.2.1)
|
65
|
+
railties (>= 3.0, < 5.0)
|
66
|
+
thor (>= 0.14, < 2.0)
|
67
|
+
json (1.7.6)
|
68
|
+
kgio (2.8.0)
|
69
|
+
mail (2.4.4)
|
70
|
+
i18n (>= 0.4.0)
|
71
|
+
mime-types (~> 1.16)
|
72
|
+
treetop (~> 1.4.8)
|
73
|
+
mime-types (1.20.1)
|
74
|
+
mocha (0.9.12)
|
75
|
+
mongoid (3.0.19)
|
76
|
+
activemodel (~> 3.1)
|
77
|
+
moped (~> 1.2)
|
78
|
+
origin (~> 1.0)
|
79
|
+
tzinfo (~> 0.3.22)
|
80
|
+
moped (1.3.2)
|
81
|
+
multi_json (1.5.0)
|
82
|
+
numerizer (0.1.1)
|
83
|
+
origin (1.0.11)
|
84
|
+
polyglot (0.3.3)
|
85
|
+
rack (1.4.5)
|
86
|
+
rack-cache (1.2)
|
87
|
+
rack (>= 0.4)
|
88
|
+
rack-ssl (1.3.3)
|
89
|
+
rack
|
90
|
+
rack-test (0.6.2)
|
91
|
+
rack (>= 1.0)
|
92
|
+
rails (3.2.11)
|
93
|
+
actionmailer (= 3.2.11)
|
94
|
+
actionpack (= 3.2.11)
|
95
|
+
activerecord (= 3.2.11)
|
96
|
+
activeresource (= 3.2.11)
|
97
|
+
activesupport (= 3.2.11)
|
98
|
+
bundler (~> 1.0)
|
99
|
+
railties (= 3.2.11)
|
100
|
+
railties (3.2.11)
|
101
|
+
actionpack (= 3.2.11)
|
102
|
+
activesupport (= 3.2.11)
|
103
|
+
rack-ssl (~> 1.3.2)
|
104
|
+
rake (>= 0.8.7)
|
105
|
+
rdoc (~> 3.4)
|
106
|
+
thor (>= 0.14.6, < 2.0)
|
107
|
+
raindrops (0.10.0)
|
108
|
+
rake (10.0.3)
|
109
|
+
rdoc (3.12.1)
|
110
|
+
json (~> 1.4)
|
111
|
+
rspec-core (2.12.2)
|
112
|
+
rspec-expectations (2.12.1)
|
113
|
+
diff-lcs (~> 1.1.3)
|
114
|
+
rspec-mocks (2.12.2)
|
115
|
+
rspec-rails (2.12.2)
|
116
|
+
actionpack (>= 3.0)
|
117
|
+
activesupport (>= 3.0)
|
118
|
+
railties (>= 3.0)
|
119
|
+
rspec-core (~> 2.12.0)
|
120
|
+
rspec-expectations (~> 2.12.0)
|
121
|
+
rspec-mocks (~> 2.12.0)
|
122
|
+
sass (3.2.5)
|
123
|
+
sass-rails (3.2.6)
|
124
|
+
railties (~> 3.2.0)
|
125
|
+
sass (>= 3.1.10)
|
126
|
+
tilt (~> 1.3)
|
127
|
+
sprockets (2.2.2)
|
128
|
+
hike (~> 1.2)
|
129
|
+
multi_json (~> 1.0)
|
130
|
+
rack (~> 1.0)
|
131
|
+
tilt (~> 1.1, != 1.3.0)
|
132
|
+
sqlite3 (1.3.7)
|
133
|
+
thor (0.17.0)
|
134
|
+
tilt (1.3.3)
|
135
|
+
treetop (1.4.12)
|
136
|
+
polyglot
|
137
|
+
polyglot (>= 0.3.1)
|
138
|
+
tzinfo (0.3.35)
|
139
|
+
unicorn (4.5.0)
|
140
|
+
kgio (~> 2.6)
|
141
|
+
rack
|
142
|
+
raindrops (~> 0.7)
|
143
|
+
whenever (0.8.2)
|
144
|
+
activesupport (>= 2.3.4)
|
145
|
+
chronic (>= 0.6.3)
|
146
|
+
|
147
|
+
PLATFORMS
|
148
|
+
ruby
|
149
|
+
|
150
|
+
DEPENDENCIES
|
151
|
+
chronic_duration
|
152
|
+
coffee-rails
|
153
|
+
combustion (~> 0.3.1)
|
154
|
+
database_cleaner
|
155
|
+
haml
|
156
|
+
jobbr!
|
157
|
+
jquery-rails
|
158
|
+
mocha
|
159
|
+
mongoid (~> 3.0)
|
160
|
+
rspec-rails
|
161
|
+
sass-rails
|
162
|
+
sqlite3
|
163
|
+
unicorn
|
164
|
+
whenever
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
9
|
+
load APP_RAKEFILE
|
10
|
+
|
11
|
+
# === Gems install tasks ===
|
12
|
+
Bundler::GemHelper.install_tasks
|
13
|
+
|
14
|
+
desc 'Run Rspec tests'
|
15
|
+
task :default do
|
16
|
+
["rspec spec"].each do |cmd|
|
17
|
+
puts "Starting to run #{cmd}..."
|
18
|
+
system("export DISPLAY=:99.0 && bundle exec #{cmd}")
|
19
|
+
raise "#{cmd} failed!" unless $?.exitstatus == 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
task :push_gem do
|
24
|
+
puts "Building gem (version: #{Jobbr::VERSION})"
|
25
|
+
system "gem build jobbr.gemspec"
|
26
|
+
puts 'Pushing to rubygems.org'
|
27
|
+
system "gem push jobbr-#{Jobbr::VERSION}.gem"
|
28
|
+
end
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#= require jquery
|
2
|
+
#= require jquery_ujs
|
3
|
+
#= require jquery-pjax
|
4
|
+
#= require bootstrap
|
5
|
+
#= require_self
|
6
|
+
|
7
|
+
scrollToBottom = ($container) ->
|
8
|
+
if $container.length > 0
|
9
|
+
$container.scrollTop($container[0].scrollHeight)
|
10
|
+
|
11
|
+
$(document).ready ->
|
12
|
+
$mainContainer = $('#main.container')
|
13
|
+
|
14
|
+
scrollToBottom($('.logs'))
|
15
|
+
$('a').pjax container: $mainContainer
|
16
|
+
|
17
|
+
$(document).on 'pjax:complete', ->
|
18
|
+
scrollToBottom($('.logs'))
|
19
|
+
|
20
|
+
interval = undefined
|
21
|
+
autoRefreshInterval = 5000
|
22
|
+
|
23
|
+
$('#auto-refresh').on 'click', ->
|
24
|
+
active = !$(this).hasClass('active')
|
25
|
+
$('i', $(this)).toggleClass('icon-spin', active)
|
26
|
+
if active
|
27
|
+
interval = setInterval(->
|
28
|
+
$.pjax({url: document.location, container: $mainContainer})
|
29
|
+
, autoRefreshInterval)
|
30
|
+
else
|
31
|
+
clearInterval(interval)
|
32
|
+
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
@import 'bootstrap';
|
2
|
+
@import 'font-awesome';
|
3
|
+
|
4
|
+
#auto-refresh {
|
5
|
+
float: right;
|
6
|
+
}
|
7
|
+
|
8
|
+
.job-status {
|
9
|
+
|
10
|
+
margin-left: 15px;
|
11
|
+
font-size: 18px;
|
12
|
+
|
13
|
+
&.waiting {
|
14
|
+
color: orange;
|
15
|
+
}
|
16
|
+
|
17
|
+
&.running, &.success {
|
18
|
+
color: limegreen;
|
19
|
+
}
|
20
|
+
&.failure {
|
21
|
+
color: red;
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
.breadcrumb {
|
27
|
+
|
28
|
+
.job-status {
|
29
|
+
margin-left: 5px;
|
30
|
+
font-size: 15px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.btn-toolbar {
|
34
|
+
float: right;
|
35
|
+
margin-top: -4px;
|
36
|
+
a {
|
37
|
+
line-height: 14px;
|
38
|
+
i {
|
39
|
+
font-size: 12px;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
.logs {
|
46
|
+
background-color: #424242;
|
47
|
+
color: white;
|
48
|
+
font-family: Monaco, 'Courier New';
|
49
|
+
height: 200px;
|
50
|
+
overflow: auto;
|
51
|
+
|
52
|
+
.kind, .date {
|
53
|
+
color: #AAAAAA;
|
54
|
+
}
|
55
|
+
.kind, .date {
|
56
|
+
&.error, &.fatal {
|
57
|
+
color: #FF8E8E;
|
58
|
+
}
|
59
|
+
&.warn {
|
60
|
+
color: orange;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
&.large {
|
65
|
+
height: 600px
|
66
|
+
}
|
67
|
+
|
68
|
+
}
|
69
|
+
|
70
|
+
.table td {
|
71
|
+
padding-top: 14px;
|
72
|
+
}
|
73
|
+
|
74
|
+
.btn-toolbar {
|
75
|
+
margin: -5px 0 0;
|
76
|
+
i {
|
77
|
+
font-size: 14px;
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Jobbr
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
|
4
|
+
layout :layout_by_resource
|
5
|
+
|
6
|
+
before_filter :set_locale
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def set_locale
|
11
|
+
I18n.locale = :en
|
12
|
+
end
|
13
|
+
|
14
|
+
def layout_by_resource
|
15
|
+
request.headers['X-PJAX'] ? false : 'jobbr/application'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Jobbr
|
2
|
+
|
3
|
+
class DelayedJobsController < ApplicationController
|
4
|
+
|
5
|
+
def create
|
6
|
+
@job = DelayedJob.run_delayed_by_name(params[:job_name], params)
|
7
|
+
render json: { id: @job.id }
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
job_run = Run.find(params[:id])
|
12
|
+
render json: { status: job_run.status, result: job_run.result, progress: job_run.progress }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Jobbr
|
2
|
+
|
3
|
+
class JobsController < ApplicationController
|
4
|
+
|
5
|
+
def index
|
6
|
+
@scheduled_jobs = Jobbr::ScheduledJob.all
|
7
|
+
@delayed_jobs = Jobbr::DelayedJob.all
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
@job = Job.by_name(params[:id]).first
|
12
|
+
@runs = Run.for_job(@job)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|