em-ssh 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.5.1
2
+ - [#21](https://github.com/simulacre/em-ssh/pull/22) - Fix em-ssh throws exception when no logger is defined [@mandre](https://github.com/mandre)
3
+ - [#20](https://github.com/simulacre/em-ssh/pull/20) - Fix Interactive timeout wasn't set if parameter not fed [@freakhill](https://github.com/freakhill)
4
+
1
5
  0.5.0
2
6
  - Shell an Connection instances can have their own Loggers
3
7
  - [#18](https://github.com/simulacre/em-ssh/pull/18) - Target devices and options for specs can be configured through environment variables [@freakhill](https://github.com/freakhill)
@@ -115,10 +115,10 @@ module EventMachine
115
115
  def wait_for(strregex, opts = { })
116
116
  ###
117
117
  log = opts[:log] || NullLogger.new
118
- timeout = opts[:timeout].is_a?(Fixnum) ? opts[:timeout] : DEFAULT_TIMEOUT
118
+ timeout_value = opts[:timeout].is_a?(Fixnum) ? opts[:timeout] : DEFAULT_TIMEOUT
119
119
  ###
120
- log.debug("wait_for(#{strregex.inspect}, :timeout => #{opts[:timeout] || @timeout})")
121
- opts = { :timeout => @timeout }.merge(opts)
120
+ log.debug("wait_for(#{strregex.inspect}, :timeout => #{timeout_value})")
121
+ opts = { :timeout => timeout_value }.merge(opts)
122
122
  found = nil
123
123
  f = Fiber.current
124
124
  trace = caller
@@ -127,7 +127,7 @@ module EventMachine
127
127
  matched = false
128
128
  started = Time.new
129
129
 
130
- timeout = proc do
130
+ timeout_proc = proc do
131
131
  data_callback && data_callback.cancel
132
132
  f.resume(TimeoutError.new("#{connection.host}: inactivity timeout (#{opts[:timeout]}) while waiting for #{strregex.inspect}; received: #{buffer.inspect}; waited total: #{Time.new - started}"))
133
133
  end
@@ -144,14 +144,14 @@ module EventMachine
144
144
  @buffer = matched.post_match
145
145
  f.resume(matched.pre_match + matched.to_s)
146
146
  else
147
- timer = EM::Timer.new(opts[:timeout], &timeout)
147
+ timer = EM::Timer.new(opts[:timeout], &timeout_proc)
148
148
  end
149
149
  end
150
150
 
151
151
  # Check against current buffer
152
152
  EM::next_tick { data_callback.call() if buffer.length > 0 }
153
153
 
154
- timer = EM::Timer.new(opts[:timeout], &timeout)
154
+ timer = EM::Timer.new(opts[:timeout], &timeout_proc)
155
155
  Fiber.yield.tap do |res|
156
156
  if res.is_a?(Exception)
157
157
  res.set_backtrace(Array(res.backtrace) + trace)
@@ -6,6 +6,10 @@ module EventMachine
6
6
  class Channel
7
7
  class NullLogger < ::Logger
8
8
 
9
+ def initialize
10
+ super(nil)
11
+ end
12
+
9
13
  def add(*params, &block)
10
14
  nil
11
15
  end
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  class Ssh
3
- VERSION='0.5.0'
3
+ VERSION='0.5.1'
4
4
  end # class::Ssh
5
5
  end # module::EventMachine
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-26 00:00:00.000000000 Z
12
+ date: 2013-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine