em-winrm 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,83 +1,83 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
- # Copyright:: Copyright (c) 2011 Seth Chisamore
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- module EventMachine
20
- module WinRM
21
- class Shell
22
- include EM::Deferrable
23
-
24
- attr_accessor :client, :server, :remote_id
25
-
26
- def initialize(client, server)
27
- @client = client
28
- @server = server
29
- @remote_id = client.open_shell
30
- WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_open")
31
- @out_channel = EM::Channel.new
32
- @err_channel = EM::Channel.new
33
- end
34
-
35
- #
36
- # called whenever the shell has output
37
- #
38
- def on_output(&block)
39
- @out_channel.subscribe block
40
- end
41
-
42
- #
43
- # called whenever the shell has error output
44
- #
45
- def on_error(&block)
46
- @err_channel.subscribe block
47
- end
48
-
49
- #
50
- # called whenever the shell is closed
51
- #
52
- def on_close(&block)
53
- @on_close = block
54
- end
55
-
56
- #
57
- # Open a shell and run a comamnd
58
- #
59
- def run_command(command)
60
- command_id = client.run_command(@remote_id, command)
61
- WinRM::Log.debug("#{server.host}[#{@remote_id}] => :run_command[#{command}]")
62
- output=client.get_command_output(@remote_id, command_id) do |out,error|
63
- @out_channel.push(out) if out
64
- @err_channel.push(error) if error
65
- end
66
- client.cleanup_command(@remote_id, command_id)
67
- WinRM::Log.debug("#{server.host}[#{@remote_id}] => :command_cleanup[#{command}]")
68
- @last_exit_code = output[:exitcode]
69
- close
70
- output[:exitcode]
71
- end
72
-
73
- #
74
- # Close and cleanup a shell
75
- #
76
- def close
77
- r = client.close_shell(@remote_id)
78
- WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_close")
79
- @on_close.call(r,@last_exit_code) if @on_close
80
- end
81
- end
82
- end
83
- end
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Seth Chisamore
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ module EventMachine
20
+ module WinRM
21
+ class Shell
22
+ include EM::Deferrable
23
+
24
+ attr_accessor :client, :server, :remote_id
25
+
26
+ def initialize(client, server)
27
+ @client = client
28
+ @server = server
29
+ @remote_id = client.open_shell
30
+ WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_open")
31
+ @out_channel = EM::Channel.new
32
+ @err_channel = EM::Channel.new
33
+ end
34
+
35
+ #
36
+ # called whenever the shell has output
37
+ #
38
+ def on_output(&block)
39
+ @out_channel.subscribe block
40
+ end
41
+
42
+ #
43
+ # called whenever the shell has error output
44
+ #
45
+ def on_error(&block)
46
+ @err_channel.subscribe block
47
+ end
48
+
49
+ #
50
+ # called whenever the shell is closed
51
+ #
52
+ def on_close(&block)
53
+ @on_close = block
54
+ end
55
+
56
+ #
57
+ # Open a shell and run a comamnd
58
+ #
59
+ def run_command(command)
60
+ command_id = client.run_command(@remote_id, command)
61
+ WinRM::Log.debug("#{server.host}[#{@remote_id}] => :run_command[#{command}]")
62
+ output=client.get_command_output(@remote_id, command_id) do |out,error|
63
+ @out_channel.push(out) if out
64
+ @err_channel.push(error) if error
65
+ end
66
+ client.cleanup_command(@remote_id, command_id)
67
+ WinRM::Log.debug("#{server.host}[#{@remote_id}] => :command_cleanup[#{command}]")
68
+ @last_exit_code = output[:exitcode]
69
+ close
70
+ output[:exitcode]
71
+ end
72
+
73
+ #
74
+ # Close and cleanup a shell
75
+ #
76
+ def close
77
+ r = client.close_shell(@remote_id)
78
+ WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_close")
79
+ @on_close.call(r,@last_exit_code) if @on_close
80
+ end
81
+ end
82
+ end
83
+ end
@@ -1,24 +1,24 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
- # Copyright:: Copyright (c) 2011 Seth Chisamore
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- module EventMachine
20
- module WinRM
21
- VERSION = "0.5.4"
22
- MAJOR, MINOR, TINY = VERSION.split('.')
23
- end
24
- end
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Seth Chisamore
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ module EventMachine
20
+ module WinRM
21
+ VERSION = "0.5.5"
22
+ MAJOR, MINOR, TINY = VERSION.split('.')
23
+ end
24
+ end
metadata CHANGED
@@ -1,99 +1,89 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: em-winrm
3
- version: !ruby/object:Gem::Version
4
- hash: 3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.5
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 4
10
- version: 0.5.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Seth Chisamore
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-13 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2014-02-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: eventmachine
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - "="
27
- - !ruby/object:Gem::Version
28
- hash: -500809314
29
- segments:
30
- - 1
31
- - 0
32
- - 0
33
- - beta
34
- - 3
35
- version: 1.0.0.beta.3
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
36
22
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: winrm
40
23
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
42
25
  none: false
43
- requirements:
26
+ requirements:
44
27
  - - ~>
45
- - !ruby/object:Gem::Version
46
- hash: 19
47
- segments:
48
- - 1
49
- - 1
50
- - 0
51
- version: 1.1.0
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: winrm
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.1.2
52
38
  type: :runtime
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: mixlib-log
56
39
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.2
46
+ - !ruby/object:Gem::Dependency
47
+ name: mixlib-log
48
+ requirement: !ruby/object:Gem::Requirement
58
49
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 27
63
- segments:
64
- - 1
65
- - 3
66
- - 0
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
67
53
  version: 1.3.0
68
54
  type: :runtime
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: uuidtools
72
55
  prerelease: false
73
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: uuidtools
64
+ requirement: !ruby/object:Gem::Requirement
74
65
  none: false
75
- requirements:
66
+ requirements:
76
67
  - - ~>
77
- - !ruby/object:Gem::Version
78
- hash: 9
79
- segments:
80
- - 2
81
- - 1
82
- - 1
68
+ - !ruby/object:Gem::Version
83
69
  version: 2.1.1
84
70
  type: :runtime
85
- version_requirements: *id004
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.1.1
86
78
  description: EventMachine based, asynchronous parallel WinRM client
87
- email:
79
+ email:
88
80
  - schisamo@opscode.com
89
81
  executables: []
90
-
91
82
  extensions: []
92
-
93
- extra_rdoc_files:
83
+ extra_rdoc_files:
94
84
  - README.rdoc
95
85
  - LICENSE
96
- files:
86
+ files:
97
87
  - .gitignore
98
88
  - Gemfile
99
89
  - LICENSE
@@ -107,38 +97,27 @@ files:
107
97
  - lib/em-winrm/version.rb
108
98
  homepage: http://github.com/schisamo/em-winrm
109
99
  licenses: []
110
-
111
100
  post_install_message:
112
101
  rdoc_options: []
113
-
114
- require_paths:
102
+ require_paths:
115
103
  - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
104
+ required_ruby_version: !ruby/object:Gem::Requirement
117
105
  none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 49
122
- segments:
123
- - 1
124
- - 9
125
- - 1
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
126
109
  version: 1.9.1
127
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
111
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
136
116
  requirements: []
137
-
138
117
  rubyforge_project:
139
- rubygems_version: 1.8.10
118
+ rubygems_version: 1.8.28
140
119
  signing_key:
141
120
  specification_version: 3
142
121
  summary: EventMachine based, asynchronous parallel WinRM client
143
122
  test_files: []
144
-
123
+ has_rdoc: true