whinytasks 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  === 1.0.0 / 2008-09-06
2
2
 
3
- * 1 major enhancement
3
+ * added whine_if config var to allow conditional whining based on the environment (production, dev, etc)
4
4
 
5
5
  * Birthday!
6
6
 
data/Manifest.txt CHANGED
@@ -2,6 +2,5 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
- bin/whinytasks
6
5
  lib/whinytasks.rb
7
- test/test_whinytasks.rb
6
+ test/test_whinytasks.rb
data/README.txt CHANGED
@@ -1,26 +1,41 @@
1
1
  = whinytasks
2
2
 
3
- * FIX (url)
3
+ * http://adamthorsen.com/whinytasks
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- FIX (describe your package)
7
+ WhinyTasks is sort of like ExceptionMailer but specifically designed for rake tasks that
8
+ run in the background. With any website, background jobs tend to accumulate and sometimes
9
+ it's hard to tell if they're working properly. WhinyTasks defines the whiny_task method,
10
+ which can be used in place of the task method and results in tasks that send emails to
11
+ a designated address when an exception occurrs during the execution of the task.
8
12
 
9
13
  == FEATURES/PROBLEMS:
10
14
 
11
- * FIX (list of features or problems)
15
+ * Sends an email to a configurable address if an exception occurs during the
16
+ execution of a rake task.
12
17
 
13
18
  == SYNOPSIS:
14
19
 
15
- FIX (code sample of usage)
20
+ WhinyTasks::CONFIG = {
21
+ :to => "alice@example.com",
22
+ :to_alias => "Alice",
23
+ :from => "no-reply@example.com",
24
+ :from_alias => "Site Exception Notifier"
25
+ :whine_if => "Merb.environment == 'production'"
26
+ }
27
+
28
+ whiny_task :run_background_jobs => :environment do
29
+ raise "Uh oh!"
30
+ end
16
31
 
17
32
  == REQUIREMENTS:
18
33
 
19
- * FIX (list of requirements)
34
+ * requires rake
20
35
 
21
36
  == INSTALL:
22
37
 
23
- * FIX (sudo gem install, anything else)
38
+ sudo gem install whinytasks
24
39
 
25
40
  == LICENSE:
26
41
 
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
  require './lib/whinytasks.rb'
6
6
 
7
- Hoe.new('whinytasks', Whinytasks::VERSION) do |p|
7
+ Hoe.new('whinytasks', WhinyTasks::VERSION) do |p|
8
8
  p.developer('Adam Thorsen', 'adam.thorsen@gmail.com')
9
9
  end
10
10
 
data/lib/whinytasks.rb CHANGED
@@ -1,31 +1,29 @@
1
- class Whinytasks
2
- VERSION = '0.0.1'
1
+ module WhinyTasks
2
+ VERSION = '0.0.2'
3
3
  end
4
4
 
5
- WHINY_CONFIG={:from_alias => "Leads", :from => "admin@halogenguides.com",
6
- :to_alias => "administrators", :to => "adam@halogenguides.com"}
7
5
  class Object
8
6
  def whine(subject, message)
9
7
  msg = <<END_OF_MESSAGE
10
- From: #{WHINY_CONFIG[:from_alias]} <#{WHINY_CONFIG[:from]}>
11
- To: #{WHINY_CONFIG[:to_alias]} <#{WHINY_CONFIG[:to]}>
8
+ From: #{WhinyTasks::CONFIG[:from_alias]} <#{WhinyTasks::CONFIG[:from]}>
9
+ To: #{WhinyTasks::CONFIG[:to_alias]} <#{WhinyTasks::CONFIG[:to]}>
12
10
  Subject: #{subject}
13
11
 
14
12
  #{message}
15
13
  END_OF_MESSAGE
16
14
 
17
15
  Net::SMTP.start('localhost') do |smtp|
18
- smtp.send_message msg, WHINY_CONFIG[:from], WHINY_CONFIG[:to]
16
+ smtp.send_message msg, WhinyTasks::CONFIG[:from], WhinyTasks::CONFIG[:to]
19
17
  end
20
18
  end
21
19
 
22
20
  def whiny_task(deps, &block)
23
- if RAILS_ENV == "production"
21
+ if eval(WhinyTasks::CONFIG[:whine_if])
24
22
  block_with_exception_handling = Proc.new do
25
23
  begin
26
24
  block.call
27
25
  rescue Exception => e
28
- whine(e.message, "this is the message")
26
+ whine(e.message, e.backtrace.join("\n"))
29
27
  end
30
28
  end
31
29
  task deps, &block_with_exception_handling
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whinytasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Thorsen
@@ -22,11 +22,11 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.7.0
24
24
  version:
25
- description: FIX (describe your package)
25
+ description: WhinyTasks is sort of like ExceptionMailer but specifically designed for rake tasks that run in the background. With any website, background jobs tend to accumulate and sometimes it's hard to tell if they're working properly. WhinyTasks defines the whiny_task method, which can be used in place of the task method and results in tasks that send emails to a designated address when an exception occurrs during the execution of the task.
26
26
  email:
27
27
  - adam.thorsen@gmail.com
28
- executables:
29
- - whinytasks
28
+ executables: []
29
+
30
30
  extensions: []
31
31
 
32
32
  extra_rdoc_files:
@@ -38,11 +38,10 @@ files:
38
38
  - Manifest.txt
39
39
  - README.txt
40
40
  - Rakefile
41
- - bin/whinytasks
42
41
  - lib/whinytasks.rb
43
42
  - test/test_whinytasks.rb
44
43
  has_rdoc: true
45
- homepage: FIX (url)
44
+ homepage: http://adamthorsen.com/whinytasks
46
45
  post_install_message:
47
46
  rdoc_options:
48
47
  - --main
@@ -67,6 +66,6 @@ rubyforge_project: whinytasks
67
66
  rubygems_version: 1.2.0
68
67
  signing_key:
69
68
  specification_version: 2
70
- summary: FIX (describe your package)
69
+ summary: WhinyTasks is sort of like ExceptionMailer but specifically designed for rake tasks that run in the background
71
70
  test_files:
72
71
  - test/test_whinytasks.rb
data/bin/whinytasks DELETED
File without changes