sidekiq-cron 0.1.7 → 0.1.8

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.7
1
+ 0.1.8
@@ -48,6 +48,7 @@ module Sidekiq
48
48
  #enque cron job to queue
49
49
  def enque! time = Time.now
50
50
  @last_run_time = time
51
+ @last_enqueue_time = time
51
52
 
52
53
  Sidekiq::Client.push(@message.is_a?(String) ? Sidekiq.load_json(@message) : @message)
53
54
 
@@ -158,7 +159,7 @@ module Sidekiq
158
159
  end
159
160
 
160
161
  attr_accessor :name, :cron, :klass, :args, :message
161
- attr_reader :last_run_time
162
+ attr_reader :last_run_time, :last_enqueue_time
162
163
 
163
164
  def initialize input_args = {}
164
165
  args = input_args.stringify_keys
@@ -174,6 +175,7 @@ module Sidekiq
174
175
 
175
176
  #set last run time
176
177
  @last_run_time = Time.parse(args['last_run_time'].to_s) rescue Time.now
178
+ @last_enqueue_time = Time.parse(args['last_enqueue_time'].to_s) rescue nil
177
179
 
178
180
  #get right arguments for job
179
181
  @args = args["args"].nil? ? [] : parse_args( args["args"] )
@@ -247,6 +249,7 @@ module Sidekiq
247
249
  message: @message.is_a?(String) ? @message : Sidekiq.dump_json(@message || {}),
248
250
  status: @status,
249
251
  last_run_time: @last_run_time,
252
+ last_enqueue_time: @last_enqueue_time,
250
253
  }
251
254
  end
252
255
 
@@ -0,0 +1,12 @@
1
+ de:
2
+ Job: Job
3
+ Cron: Cron
4
+ CronJobs: Cronjobs
5
+ EnqueueNow: In Warteschlange
6
+ AreYouSureDeleteCronJob: Sind Sie sicher, dass sie den Cronjob %{job} löschen wollen?
7
+ NoCronJobsFound: "Keine Cronjobs gefunden"
8
+ Enable: Aktivieren
9
+ Disable: Deaktivieren
10
+ 'Last enque': Eingereiht
11
+ disabled: deaktiviert
12
+ enabled: aktiviert
@@ -5,3 +5,8 @@ en:
5
5
  EnqueueNow: Enqueue Now
6
6
  AreYouSureDeleteCronJob: Are you sure you want to delete the %{job} cron job?
7
7
  NoCronJobsFound: "No cron jobs found"
8
+ Enable: Enabled
9
+ Disable: Disable
10
+ 'Last enque': Last enqueued
11
+ disabled: disabled
12
+ enabled: enabled
@@ -34,7 +34,7 @@ module Sidekiq
34
34
  end
35
35
  end
36
36
 
37
- rescue => ex
37
+ rescue Exception => ex
38
38
  # Most likely a problem with redis networking.
39
39
  # Punt and try again at the next interval
40
40
  logger.error ex.message
@@ -1,28 +1,28 @@
1
1
  <header class='row'>
2
- <div class='span5'>
2
+ <div class='span5 col-sm-5'>
3
3
  <h3><%=t 'CronJobs' %></h3>
4
4
  </div>
5
5
  </header>
6
6
  <% if @cron_jobs.size > 0 %>
7
7
 
8
- <table class="table table-hover table-bordered table-striped">
8
+ <table class="table table-hover table-bordered table-striped table-white">
9
9
  <thead>
10
10
  <th><%= t('Status') %></th>
11
11
  <th><%= t('Name') %></th>
12
12
  <th><%= t('Cron') %></th>
13
13
  <th><%= t('Last enque') %></th>
14
14
  <th><%= t('Arguments') %></th>
15
- <th width="253px"><%= t('Actions')%></th>
15
+ <th width="280"><%= t('Actions')%></th>
16
16
  </thead>
17
17
 
18
18
  <tbody>
19
19
  <% @cron_jobs.sort{|a,b| a.sort_name <=> b.sort_name }.each_with_index do |job, index| %>
20
20
  <% style = "#{job.status == 'disabled' ? "background: #ecc": ""}" %>
21
21
  <tr>
22
- <td style="<%= style %>"><%= job.status %></td>
22
+ <td style="<%= style %>"><%= t job.status %></td>
23
23
  <td style="<%= style %>"><%= job.name %></td>
24
24
  <td style="<%= style %>"><b><%= job.cron.gsub(" ", "&nbsp;") %></b></td>
25
- <td style="<%= style %>"><%= relative_time(job.last_run_time) %></td>
25
+ <td style="<%= style %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
26
26
  <td style="<%= style %>">
27
27
  <% if job.message and job.message.to_s.size > 100 %>
28
28
  <button data-toggle="collapse" data-target=".worker_<%= index %>" class="btn btn-xs"><%= t('ShowAll')%></button>
@@ -21,7 +21,7 @@ header.row
21
21
  td[style="#{style}"]= job.name
22
22
  td[style="#{style}"]
23
23
  b == job.cron.gsub(" ", "&nbsp;")
24
- td[style="#{style}"]== relative_time(job.last_run_time)
24
+ td[style="#{style}"]== job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-"
25
25
  td[style="#{style}"]
26
26
  - if job.message and job.message.to_s.size > 100
27
27
  button data-toggle="collapse" data-target=".worker_#{index}" class="btn btn-mini" = t('ShowAll')
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.7"
8
+ s.version = "0.1.8"
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-11-05"
12
+ s.date = "2013-11-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 = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "lib/sidekiq/cron.rb",
32
32
  "lib/sidekiq/cron/job.rb",
33
33
  "lib/sidekiq/cron/launcher.rb",
34
+ "lib/sidekiq/cron/locales/de.yml",
34
35
  "lib/sidekiq/cron/locales/en.yml",
35
36
  "lib/sidekiq/cron/poller.rb",
36
37
  "lib/sidekiq/cron/views/cron.erb",
@@ -40,6 +40,7 @@ class CronWebExtensionTest < Test::Unit::TestCase
40
40
  should 'display cron web with cron jobs table' do
41
41
  Sidekiq::Cron::Job.create(@args)
42
42
  get '/cron'
43
+ assert_equal 200, last_response.status
43
44
  refute last_response.body.include?('No cron jobs found')
44
45
  assert last_response.body.include?('table')
45
46
  assert last_response.body.include?("TestNameOfCronJob")
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.7
4
+ version: 0.1.8
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-11-05 00:00:00.000000000 Z
12
+ date: 2013-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -273,6 +273,7 @@ files:
273
273
  - lib/sidekiq/cron.rb
274
274
  - lib/sidekiq/cron/job.rb
275
275
  - lib/sidekiq/cron/launcher.rb
276
+ - lib/sidekiq/cron/locales/de.yml
276
277
  - lib/sidekiq/cron/locales/en.yml
277
278
  - lib/sidekiq/cron/poller.rb
278
279
  - lib/sidekiq/cron/views/cron.erb
@@ -298,7 +299,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
299
  version: '0'
299
300
  segments:
300
301
  - 0
301
- hash: -3162312327206843445
302
+ hash: -1914216490910981092
302
303
  required_rubygems_version: !ruby/object:Gem::Requirement
303
304
  none: false
304
305
  requirements: