smith 0.7.2 → 0.7.3
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.
- checksums.yaml +4 -4
- data/lib/smith/bootstrap.rb +11 -11
- data/lib/smith/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c23b69a6f4301a873fa28d72bf647d1a55f7be5
|
4
|
+
data.tar.gz: c95dbea268470374884fe322e12319b6d1722a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da08538d2ac1a625cf2d491308281591b4b76f01d88498c14bf395dab50e78966b8a26ef6b447ee341e6b6666f7d6f3a6cea3d3229af7515c34652c9589a911
|
7
|
+
data.tar.gz: 9484464efc2fd47fd667af75974a4ef7a18a9edc60897293465db77165af77ca18ffa75013295db3770f4c7d21f1cf5f2b1c21ab1386ef829c193bdf5b3b0530
|
data/lib/smith/bootstrap.rb
CHANGED
@@ -67,7 +67,7 @@ module Smith
|
|
67
67
|
# See the note at the in main.
|
68
68
|
def terminate!(exception=nil)
|
69
69
|
|
70
|
-
|
70
|
+
handle_excecption(exception)
|
71
71
|
|
72
72
|
if Smith.running?
|
73
73
|
send_dead_message
|
@@ -114,19 +114,21 @@ module Smith
|
|
114
114
|
# @param e [Exception] the exeption to format
|
115
115
|
# @return [String] formated exception
|
116
116
|
def format_exception(e)
|
117
|
-
"#{e.class.to_s}: #{e.inspect}\n\t".tap do
|
118
|
-
|
117
|
+
"#{e.class.to_s}: #{e.inspect}\n\t".tap do |exception_string|
|
118
|
+
exception_string << e.backtrace[0..-1].join("\n\t") if e.backtrace
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
#
|
122
|
+
# Handle any exceptions. This will run the on_exception proc defined in the
|
123
|
+
# agent and log the exception.
|
124
|
+
#
|
123
125
|
# @param e [Exception] the exeption to handle
|
124
|
-
def
|
125
|
-
if exception
|
126
|
-
@agent.__send__(:__exception_handler, exception)
|
126
|
+
def handle_excecption(exception)
|
127
|
+
if exception
|
128
|
+
@agent.__send__(:__exception_handler, exception) if @agent
|
127
129
|
logger.error { format_exception(exception) }
|
128
|
-
logger.error { "Terminating: #{@agent_uuid}." }
|
129
130
|
end
|
131
|
+
logger.error { "Terminating: #{@agent_uuid}." }
|
130
132
|
end
|
131
133
|
|
132
134
|
# Add the ../lib to the load path. This assumes the directory
|
@@ -140,13 +142,11 @@ module Smith
|
|
140
142
|
# This needs to be better thought out.
|
141
143
|
# TODO think this through some more.
|
142
144
|
def add_agent_load_path(path)
|
143
|
-
path = path.dirname.dirname.join('lib')
|
144
|
-
|
145
145
|
Smith.agent_directories.each do |path|
|
146
146
|
lib_path = path.parent.join('lib')
|
147
147
|
if lib_path.exist?
|
148
148
|
logger.info { "Adding #{lib_path} to load path" }
|
149
|
-
$LOAD_PATH <<
|
149
|
+
$LOAD_PATH << lib_path
|
150
150
|
else
|
151
151
|
logger.info { "No lib directory for: #{path.parent}." }
|
152
152
|
end
|
data/lib/smith/version.rb
CHANGED