sidekiq-cron 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -0,0 +1,62 @@
1
+ <header class='row'>
2
+ <div class='span5'>
3
+ <h3><%=t 'CronJobs' %></h3>
4
+ </div>
5
+ </header>
6
+ <% if @cron_jobs.size > 0 %>
7
+
8
+ <table class="table table-hover table-bordered table-striped">
9
+ <thead>
10
+ <th><%= t('Status') %></th>
11
+ <th><%= t('Name') %></th>
12
+ <th><%= t('Cron') %></th>
13
+ <th><%= t('Last enque') %></th>
14
+ <th><%= t('Arguments') %></th>
15
+ <th width="253px"><%= t('Actions')%></th>
16
+ </thead>
17
+
18
+ <tbody>
19
+ <% @cron_jobs.sort{|a,b| a.sort_name <=> b.sort_name }.each_with_index do |job, index| %>
20
+ <% style = "#{job.status == 'disabled' ? "background: #ecc": ""}" %>
21
+ <tr>
22
+ <td style="<%= style %>"><%= job.status %></td>
23
+ <td style="<%= style %>"><%= job.name %></td>
24
+ <td style="<%= style %>"><b><%= job.cron.gsub(" ", "&nbsp;") %></b></td>
25
+ <td style="<%= style %>"><%= relative_time(job.last_run_time) %></td>
26
+ <td style="<%= style %>">
27
+ <% if job.message and job.message.to_s.size > 100 %>
28
+ <button data-toggle="collapse" data-target=".worker_<%= index %>" class="btn btn-mini"><%= t('ShowAll')%></button>
29
+ <div class="toggle worker_<%= index %>" style="display: inline;"><%= job.message[0..100] + "... " %></div>
30
+ <div class="toggle worker_<%= index %>" style="display: none;"><%= job.message %></div>
31
+ <% else %>
32
+ <%= job.message %>
33
+ <% end %>
34
+ </td>
35
+ <td style="<%= style %>">
36
+ <% if job.status == 'enabled' %>
37
+ <form action="<%= root_path %>cron/<%= job.name %>/enque" method="post">
38
+ <input class='btn btn-mini pull-left' type="submit" name="enque" value="<%= t('EnqueueNow') %>"/>
39
+ </form>
40
+ <form action="<%= root_path %>cron/<%= job.name %>/disable" method="post">
41
+ <input class='btn btn-mini pull-left' type="submit" name="disable" value="<%= t('Disable') %>"/>
42
+ </form>
43
+ <% else %>
44
+ <form action="<%= root_path %>cron/<%= job.name %>/enque" method="post">
45
+ <input class='btn btn-mini pull-left' type="submit" name="enque" value="<%= t('EnqueueNow') %>"/>
46
+ </form>
47
+ <form action="<%= root_path %>cron/<%= job.name %>/enable" method="post">
48
+ <input class='btn btn-mini pull-left' type="submit" name="enable" value="<%= t('Enable') %>"/>
49
+ </form>
50
+ <form action="<%= root_path %>cron/<%= job.name %>/delete" method="post">
51
+ <input class='btn btn-mini btn-danger pull-left' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
52
+ </form>
53
+ <% end %>
54
+ </td>
55
+ </tr>
56
+ <% end %>
57
+ </tbody>
58
+ </table>
59
+ <% else %>
60
+ <span class='alert alert-success'><%= t('NoCronJobsFound') %></span>
61
+ <% end %>
62
+
@@ -30,11 +30,19 @@ module Sidekiq
30
30
 
31
31
  #index page of cron jobs
32
32
  app.get '/cron' do
33
+
34
+ require 'slim'
35
+
33
36
  view_path = File.join(File.expand_path("..", __FILE__), "views")
34
37
 
35
38
  @cron_jobs = Sidekiq::Cron::Job.all
36
39
 
37
- render(:slim, File.read(File.join(view_path, "cron.slim")))
40
+ #if Slim renderer exists and sidekiq has layout.slim in views
41
+ if defined?(Slim) && File.exists?(File.join(settings.views,"layout.slim"))
42
+ render(:slim, File.read(File.join(view_path, "cron.slim")))
43
+ else
44
+ render(:erb, File.read(File.join(view_path, "cron.erb")))
45
+ end
38
46
  end
39
47
 
40
48
  #enque cron job
data/sidekiq-cron.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sidekiq-cron"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ondrej Bartas"]
12
- s.date = "2013-08-26"
12
+ s.date = "2013-08-29"
13
13
  s.description = "Enables to set jobs to be run in specified time (using CRON notation)"
14
14
  s.email = "ondrej@bartas.cz"
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/sidekiq/cron/launcher.rb",
34
34
  "lib/sidekiq/cron/locales/en.yml",
35
35
  "lib/sidekiq/cron/poller.rb",
36
+ "lib/sidekiq/cron/views/cron.erb",
36
37
  "lib/sidekiq/cron/views/cron.slim",
37
38
  "lib/sidekiq/cron/web_extension.rb",
38
39
  "sidekiq-cron.gemspec",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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: 2013-08-26 00:00:00.000000000 Z
12
+ date: 2013-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -275,6 +275,7 @@ files:
275
275
  - lib/sidekiq/cron/launcher.rb
276
276
  - lib/sidekiq/cron/locales/en.yml
277
277
  - lib/sidekiq/cron/poller.rb
278
+ - lib/sidekiq/cron/views/cron.erb
278
279
  - lib/sidekiq/cron/views/cron.slim
279
280
  - lib/sidekiq/cron/web_extension.rb
280
281
  - sidekiq-cron.gemspec
@@ -297,7 +298,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
298
  version: '0'
298
299
  segments:
299
300
  - 0
300
- hash: -1445982085601461411
301
+ hash: 1743263306931781088
301
302
  required_rubygems_version: !ruby/object:Gem::Requirement
302
303
  none: false
303
304
  requirements: