wristwatch 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md ADDED
@@ -0,0 +1,39 @@
1
+ Wristwatch
2
+ ==========
3
+ Need to run timer-based tasks, but you have no control over your cron?
4
+ Heroku's hourly cron got you puzzled? Wristwatch is here to help.
5
+
6
+ How-to
7
+ ------
8
+ Tell it what to do, and which intervals to use, and Wristwatch does the
9
+ rest:
10
+
11
+ hourly "Flush unsent emails" do
12
+ Notifier.flush_unsent
13
+ end
14
+
15
+ daily "Reindex Solr" do
16
+ Rake::Task['sunspot:reindex'].execute
17
+ end
18
+
19
+ daily "Send reminder emails" do
20
+ Notifier.remind_users_to_call_mom
21
+ end
22
+
23
+
24
+ Wristwatch gives you lots of basic intervals to play with:
25
+ * hourly
26
+ * bi-hourly
27
+ * quarter-hourly
28
+ * bi-daily
29
+ * daily
30
+ * weekly
31
+ * bi-monthly
32
+ * monthly
33
+
34
+ and so on. See intervals.rb for details, and re-open it to add your own
35
+ task triggers.
36
+
37
+ Future
38
+ ------
39
+ Full configuration, logging and more. Stay tuned!
@@ -7,7 +7,7 @@ module Wristwatch
7
7
  end
8
8
 
9
9
  def list
10
- @schedule.inject([]) {|list, interval| list += @tasks[interval] }
10
+ @schedule.inject([]) {|list, interval| list += @tasks[interval] if @tasks[interval]; list }
11
11
  end
12
12
 
13
13
  def execute
@@ -3,11 +3,11 @@ module Wristwatch
3
3
 
4
4
  def build
5
5
  instance_eval instructions
6
+ self
6
7
  end
7
8
 
8
9
  def add_task(name, *args, &blk)
9
- raise ArgumentError, "Wristwatch manifests require that you pass a block to be executed" unless block_given?
10
- self[name] = [] unless has_key?(name)
10
+ self[name] = [] unless self[name].respond_to?(:<<)
11
11
  self[name] << build_task(*args, &blk)
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Wristwatch
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wristwatch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Scott Burton
@@ -36,6 +36,7 @@ files:
36
36
  - .gitignore
37
37
  - Gemfile
38
38
  - Rakefile
39
+ - Readme.md
39
40
  - lib/core_ext/numeric.rb
40
41
  - lib/wristwatch.rb
41
42
  - lib/wristwatch/cron.rake