Skip to content

Commit

Permalink
Removes deprecated attribute 'context' from Net::SSH::Simple::Result.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-o-e committed Oct 26, 2011
1 parent b7ca6ac commit 784baf6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
21 changes: 21 additions & 0 deletions lib/net/ssh/simple.rb
@@ -1,3 +1,24 @@
#
# Copyright (C) 2011 by moe@busyloop.net
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
require 'net/ssh/simple/version'
require 'blockenspiel'
require 'hashie'
Expand Down
32 changes: 23 additions & 9 deletions lib/net/ssh/simple/core.rb
@@ -1,3 +1,24 @@
#
# Copyright (C) 2011 by moe@busyloop.net
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
module Net
module SSH
# Net::SSH::Simple is a simple wrapper around Net::SSH and Net::SCP.
Expand Down Expand Up @@ -559,7 +580,7 @@ def with_session(host, opts={:timeout => 60}, &block)
@result[:success] = false
@result[:timed_out] = true
@result[:finish_at] = Time.new
raise Net::SSH::Simple::Error, [e, [host,opts,@result]]
raise Net::SSH::Simple::Error, [e, @result]
end
end

Expand Down Expand Up @@ -590,20 +611,13 @@ class Error < RuntimeError
# Reference to the underlying Exception
attr_reader :wrapped

# Context of the operation that failed, as an Array: [host, opts, result].
#
# @deprecated
# This will be removed soon, use {#result} instead!
attr_reader :context

# {Net::SSH::Simple::Result} of the interrupted operation.
attr_reader :result

def initialize(msg, e=$!)
super(msg)
@wrapped = e
@context = msg[1]
@result = msg[1][2]
@result = msg[1]
end

def to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/net/ssh/simple/version.rb
@@ -1,7 +1,7 @@
module Net
module SSH
class Simple
VERSION = "1.2.1"
VERSION = "1.3.0"
end
end
end

0 comments on commit 784baf6

Please sign in to comment.