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 +1 -1
- data/Manifest.txt +1 -2
- data/README.txt +21 -6
- data/Rakefile +1 -1
- data/lib/whinytasks.rb +7 -9
- metadata +6 -7
- data/bin/whinytasks +0 -0
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -1,26 +1,41 @@
|
|
1
1
|
= whinytasks
|
2
2
|
|
3
|
-
*
|
3
|
+
* http://adamthorsen.com/whinytasks
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
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
|
-
*
|
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
|
-
|
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
|
-
*
|
34
|
+
* requires rake
|
20
35
|
|
21
36
|
== INSTALL:
|
22
37
|
|
23
|
-
|
38
|
+
sudo gem install whinytasks
|
24
39
|
|
25
40
|
== LICENSE:
|
26
41
|
|
data/Rakefile
CHANGED
data/lib/whinytasks.rb
CHANGED
@@ -1,31 +1,29 @@
|
|
1
|
-
|
2
|
-
|
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: #{
|
11
|
-
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,
|
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
|
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, "
|
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.
|
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:
|
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
|
-
|
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:
|
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:
|
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
|