em-winrm 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  An EventMachine client for Windows Remote Management (WinRM). This allows you to invoke commands on Windows machines from any machine that can run Ruby. This client leverages the EventMachine reactor to run the same command across multiple machines in parallel (think net-ssh-multi).
4
4
 
5
- WinRM allows you to call native object in Windows. This includes, but is not limited to, running batch scripts, powershell scripts and fetching WMI variables. For more information on WinRM, please visit {Microsoft's WinRM site}[http://msdn.microsoft.com/en-us/library/aa384426(v=VS.85).aspx].
5
+ WinRM allows you to call native objects in Windows. This includes, but is not limited to, running batch scripts, powershell scripts and fetching WMI variables. For more information on WinRM, please visit {Microsoft's WinRM site}[http://msdn.microsoft.com/en-us/library/aa384426(v=VS.85).aspx].
6
6
 
7
7
  = Example Usage
8
8
 
@@ -116,7 +116,7 @@ Gives the following output:
116
116
 
117
117
  = Credit
118
118
 
119
- {Dan Wanek}[http://github.com/zenchild] who wrote the {WinRM Ruby client gem}[https://github.com/zenchild/WinRM] that is used heavily in this gem.
119
+ Thanks to {Dan Wanek}[http://github.com/zenchild] who wrote the {WinRM Ruby client gem}[https://github.com/zenchild/WinRM] that is used heavily in this gem.
120
120
 
121
121
  = Contact
122
122
 
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency "eventmachine", ">= 1.0.0.beta.2"
23
- s.add_dependency "winrm", ">= 1.0.0rc1"
23
+ s.add_dependency "winrm", ">= 1.0.0rc2"
24
24
  s.add_dependency "mixlib-log", ">= 1.2.0"
25
25
  end
@@ -26,10 +26,11 @@ module EventMachine
26
26
  def initialize(master, host, options)
27
27
  @master = master
28
28
  @host = host
29
- @user = options[:user] || ENV['USER'] || ENV['USERNAME'] || "unknown"
30
- @port = options[:port] || 5985
31
- @password = options[:password]
32
29
  @transport = options[:transport] || :plaintext
30
+ @options = options
31
+ @options[:user] = @options.delete(:user) || ENV['USER'] || ENV['USERNAME'] || "unknown"
32
+ @options[:pass] = @options.delete(:password)
33
+ @options[:port] = @options.delete(:port) || 5985
33
34
  end
34
35
 
35
36
  #
@@ -68,9 +69,9 @@ module EventMachine
68
69
 
69
70
  def client
70
71
  @winrm ||= begin
71
- http_method = ( @port.to_s=~/(443|5986)/ ? 'https' : 'http' )
72
- endpoint = "#{http_method}://#{@host}:#{@port}/wsman"
73
- ::WinRM::WinRMWebService.new(endpoint, @transport, {:user => @user, :pass => @password})
72
+ http_method = ( @options[:port].to_s=~/(443|5986)/ ? 'https' : 'http' )
73
+ endpoint = "#{http_method}://#{@host}:#{@options[:port]}/wsman"
74
+ ::WinRM::WinRMWebService.new(endpoint, @transport, @options)
74
75
  rescue ::WinRM::WinRMAuthorizationError => error
75
76
  raise ::WinRM::WinRMAuthorizationError.new("#{error.message}@#{@host}")
76
77
  end
@@ -88,12 +88,11 @@ module EventMachine
88
88
  def unbind_backend(host)
89
89
  WinRM::Log.debug(":unbind_backend => #{host}")
90
90
  @servers[host] = nil
91
+ @on_finish.call(host) if @on_finish
91
92
 
92
93
  if @servers.values.compact.size.zero?
93
94
  @on_finish.call(:done) if @on_finish
94
- close
95
- else
96
- @on_finish.call(host) if @on_finish
95
+ close
97
96
  end
98
97
  end
99
98
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  module EventMachine
20
20
  module WinRM
21
- VERSION = "0.0.1"
21
+ VERSION = "0.0.2"
22
22
  MAJOR, MINOR, TINY = VERSION.split('.')
23
23
  end
24
24
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: em-winrm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Seth Chisamore
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-01 00:00:00 -05:00
13
+ date: 2011-03-04 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.0.0rc1
35
+ version: 1.0.0rc2
36
36
  type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency