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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60291ee6d180d1883c743e69e17c590f350c29ee
4
- data.tar.gz: 9c2e93dad014cdc16a813c38c3ffc3402d68a81e
3
+ metadata.gz: 0c23b69a6f4301a873fa28d72bf647d1a55f7be5
4
+ data.tar.gz: c95dbea268470374884fe322e12319b6d1722a77
5
5
  SHA512:
6
- metadata.gz: 0ade57bcee554e10eac994c33f3ce32660d19e8938d25fb49e91c1e6c3c7494823f7c2bb3bad0734e9852a076ad04ad46b4f015d0822e6768f77ed8ed7cb951c
7
- data.tar.gz: d3c2507f28b378a2d74924ee0d04ff03dd6605e2153587284cd0526ccd64549855eab4267f132e506b4e2a8fa452b984972fdf659a6940c641a0b869ba021683
6
+ metadata.gz: 4da08538d2ac1a625cf2d491308281591b4b76f01d88498c14bf395dab50e78966b8a26ef6b447ee341e6b6666f7d6f3a6cea3d3229af7515c34652c9589a911
7
+ data.tar.gz: 9484464efc2fd47fd667af75974a4ef7a18a9edc60897293465db77165af77ca18ffa75013295db3770f4c7d21f1cf5f2b1c21ab1386ef829c193bdf5b3b0530
@@ -67,7 +67,7 @@ module Smith
67
67
  # See the note at the in main.
68
68
  def terminate!(exception=nil)
69
69
 
70
- run_exception_handler(exception)
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
- str << e.backtrace[0..-1].join("\n\t") if e.backtrace
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
- # Run the on_exception proc defined in the agent.
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 run_exception_handler(exception)
125
- if exception && @agent
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 << path
149
+ $LOAD_PATH << lib_path
150
150
  else
151
151
  logger.info { "No lib directory for: #{path.parent}." }
152
152
  end
@@ -1,3 +1,3 @@
1
1
  module Smith
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Heycock