runciter 0.0.1 → 0.0.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/runciter/app.rb CHANGED
@@ -23,9 +23,14 @@ module Runciter
23
23
  def register!
24
24
  doc = @api[:apps].create(@name)
25
25
  @id = doc['_id']
26
+
26
27
  if cron_str = @opts.delete(:cron)
27
28
  @api[:apps].cron(@id, cron_str)
28
29
  end
30
+
31
+ if alert_emails = @opts.delete(:alert)
32
+ @api[:apps].alert_emails(@id, [alert_emails].flatten)
33
+ end
29
34
  rescue
30
35
  warn $!
31
36
  end
data/lib/runciter/run.rb CHANGED
@@ -27,7 +27,7 @@ module Runciter
27
27
  end
28
28
 
29
29
  def die!(e)
30
- @app.api[:runs].die(@id, [e.message, e.backtrace].join("\n"))
30
+ @app.api[:runs].die(@id, [e.message, e.backtrace.join("\n")].join("\n"))
31
31
  @heart.terminate
32
32
  rescue
33
33
  warn $!
@@ -44,8 +44,10 @@ module Runciter
44
44
 
45
45
  def run_heartbeat_thread!
46
46
  @heart = Thread.new do
47
- @app.api[:runs].heartbeat(@id)
48
- sleep @opts[:heartbeat_interval]
47
+ loop do
48
+ @app.api[:runs].heartbeat(@id)
49
+ sleep @opts[:heartbeat_interval]
50
+ end
49
51
  end
50
52
  rescue
51
53
  warn $!
data/spec/app_spec.rb CHANGED
@@ -3,8 +3,14 @@ require 'spec_helper'
3
3
  module Runciter
4
4
  describe App do
5
5
  it 'works' do
6
- app = App.new('Spec App', SPEC_URL, :cron => '30 * * * *')
6
+ app = App.new(
7
+ 'Spec App',
8
+ SPEC_URL,
9
+ :cron => '30 * * * *',
10
+ :alert => 'test@example.com'
11
+ )
7
12
  app.task('Try Things', :steps => 10) do |r|
13
+ raise 'fail'
8
14
  10.times { sleep 1; r.step! }
9
15
  end
10
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runciter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2012-09-21 00:00:00.000000000 Z
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jimson