winrm 1.1.3 → 1.2.0.dev1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f98c1cfc63e401f92df6150d7c21a7855e4479b
4
- data.tar.gz: 9ead6674acfe95b0164408814c4649b0142d312f
3
+ metadata.gz: 511758c3dc1a2583d6dcb92b9d2eafa642e7e979
4
+ data.tar.gz: 58f0ae48acdc7c05a81433bbf6884e43599e1851
5
5
  SHA512:
6
- metadata.gz: 4a0b02e78d87600396e91e50c685fd928643c2cce6ef43d92fc835d89aa7e614fec5d924ee87837b5795b1cb3cc986ff3807c5a13b6a3391730aaf1e536ffc06
7
- data.tar.gz: 9aafc7838af16d9b216a44a407326a1acbbe4c55287ff54b6ddcdf04ae5f521cf3f146ce918af94186f1419e02a620a0cf5cf5ec47b43673aa2f0ccfa532ff7e
6
+ metadata.gz: e0c8499a69b5e3e60dec696780c16a2dfe8e407906527421ad9cd50202751ea9b63d3ded13540746554909866e1d1db768c0265655abc97c090328de12fe6a77
7
+ data.tar.gz: 893c8aafbc5eb3d0ea23445c8796f2ab3776378f3e64c9e5b589e17906a6554066eed71393b44709eb2df09451f27e70e6e3a88ee2fb395698831a4bd58ccd04
data/.gitignore CHANGED
@@ -2,6 +2,9 @@
2
2
  *.gem
3
3
  pkg/*
4
4
  .rvmrc
5
- test/spec/creds*.json
6
- test/config.yml
7
- traces/
5
+ .idea
6
+ .bundle
7
+ spec/spec/creds*.json
8
+ spec/config.yml
9
+ traces/
10
+ Gemfile.lock
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --format nested
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
-
4
- gem 'rspec'
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Windows Remote Management (WinRM) for Ruby
2
+ [![Build Status](https://travis-ci.org/WinRb/WinRM.svg?branch=master)](https://travis-ci.org/WinRb/WinRM)
3
+ [![Gem Version](https://badge.fury.io/rb/winrm.svg)](http://badge.fury.io/rb/winrm)
2
4
 
3
5
  This is a SOAP library that uses the functionality in Windows Remote
4
6
  Management(WinRM) to call native object in Windows. This includes, but is
@@ -79,6 +81,35 @@ You can read more about that on issue [#29](https://github.com/WinRb/WinRM/issue
79
81
  to be created because the SOAP backend is no longer a Singleton type
80
82
  class.
81
83
 
84
+ ## Contributing
85
+
86
+ 1. Fork it.
87
+ 2. Create a branch (git checkout -b my_feature_branch)
88
+ 3. Run the unit and integration tests (bundle exec rake integration)
89
+ 4. Commit your changes (git commit -am "Added a sweet feature")
90
+ 5. Push to the branch (git push origin my_feature_branch)
91
+ 6. Create a pull requst from your branch into master (Please be sure to provide enough detail for us to cipher what this change is doing)
92
+
93
+ ### Running the tests
94
+
95
+ We use Bundler to manage dependencies during development.
96
+
97
+ ```
98
+ $ bundle install
99
+ ```
100
+
101
+ Once you have the dependencies, you can run the unit tests with `rake`:
102
+
103
+ ```
104
+ $ bundle exec rake spec
105
+ ```
106
+
107
+ To run the integration tests you will need a Windows box with the WinRM service properly configured. Its easiest to use a Vagrant Windows box.
108
+
109
+ 1. Create a Windows VM with WinRM configured (see above).
110
+ 2. Copy the config-example.yml to config.yml - edit this file with your WinRM connection details.
111
+ 3. Run `bundle exec rake integration`
112
+
82
113
  ## My Info
83
114
  * Twitter: [@zentourist](https://twitter.com/zentourist)
84
115
  * BLOG: [http://distributed-frostbite.blogspot.com/](http://distributed-frostbite.blogspot.com/)
data/Rakefile CHANGED
@@ -1,12 +1,23 @@
1
- require "bundler/gem_tasks"
1
+ require 'rubygems'
2
+ require 'bundler/setup'
2
3
  require 'rspec/core/rake_task'
3
4
 
4
- RSpec::Core::RakeTask.new(:spec) do |t|
5
- t.pattern = "spec/unit/**/*_spec.rb"
6
- t.rspec_opts = '--format documentation --color'
5
+ # Change to the directory of this file.
6
+ Dir.chdir(File.expand_path("../", __FILE__))
7
+
8
+ # For gem creation and bundling
9
+ require "bundler/gem_tasks"
10
+
11
+ RSpec::Core::RakeTask.new(:spec) do |task|
12
+ task.pattern = "test/spec/*_spec.rb"
13
+ task.rspec_opts = [ '--color', '-f documentation' ]
14
+ task.rspec_opts << '-tunit'
7
15
  end
8
16
 
9
- RSpec::Core::RakeTask.new(:spec_all) do |t|
10
- t.pattern = "spec/**/*_spec.rb"
11
- t.rspec_opts = '--format documentation --color'
17
+ # Run the integration test suite
18
+ RSpec::Core::RakeTask.new(:integration) do |task|
19
+ task.pattern = "test/spec/*_spec.rb"
20
+ task.rspec_opts = [ '--color', '-f documentation' ]
12
21
  end
22
+
23
+ task :default => "spec"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.2.0.dev1
@@ -0,0 +1,5 @@
1
+ 1.2.0
2
+ - Allow user to disable SSL peer ceritifcate validation #44
3
+ - Allow commands with "'" chars on Ruby 2.x, fixes #69
4
+ - Fixed uninitialized constant Module::Kconv in Ruby 2.x, fixes #65
5
+ - Commands with non-ASCII chars should work, #70
@@ -17,7 +17,7 @@
17
17
  =end
18
18
 
19
19
  require 'date'
20
- require 'kconv' if(RUBY_VERSION.start_with? '1.9') # bug in rubyntlm with ruby 1.9.x
20
+ require 'kconv' # rubyntlm .0.1.1 doesn't require kconv, workaround for issue #65
21
21
  require 'logging'
22
22
 
23
23
  module WinRM
@@ -20,7 +20,7 @@ module WinRM
20
20
  module HTTP
21
21
 
22
22
  # A generic HTTP transport that utilized HTTPClient to send messages back and forth.
23
- # This backend will maintain state for every WinRMWebService instance that is instatiated so it
23
+ # This backend will maintain state for every WinRMWebService instance that is instantiated so it
24
24
  # is possible to use GSSAPI with Keep-Alive.
25
25
  class HttpTransport
26
26
 
@@ -60,14 +60,22 @@ module WinRM
60
60
  auths = @httpcli.www_auth.instance_variable_get('@authenticator')
61
61
  auths.delete_if {|i| i.is_a? HTTPClient::SSPINegotiateAuth }
62
62
  end
63
+
64
+ # Disable SSL Peer Verification
65
+ def no_ssl_peer_verification!
66
+ @httpcli.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
67
+ end
68
+
63
69
  end
64
70
 
71
+
65
72
  class HttpPlaintext < HttpTransport
66
73
  def initialize(endpoint, user, pass, opts)
67
74
  super(endpoint)
68
75
  @httpcli.set_auth(nil, user, pass)
69
76
  no_sspi_auth! if opts[:disable_sspi]
70
77
  basic_auth_only! if opts[:basic_auth_only]
78
+ no_ssl_peer_verification! if opts[:no_ssl_peer_verification]
71
79
  end
72
80
  end
73
81
 
@@ -79,6 +87,7 @@ module WinRM
79
87
  @httpcli.ssl_config.set_trust_ca(ca_trust_path) unless ca_trust_path.nil?
80
88
  no_sspi_auth! if opts[:disable_sspi]
81
89
  basic_auth_only! if opts[:basic_auth_only]
90
+ no_ssl_peer_verification! if opts[:no_ssl_peer_verification]
82
91
  end
83
92
  end
84
93
 
@@ -133,7 +133,12 @@ module WinRM
133
133
  s.input = "#{NS_WIN_SHELL}:CommandLine"
134
134
  s.body = { "#{NS_WIN_SHELL}:Command" => "\"#{command}\"", "#{NS_WIN_SHELL}:Arguments" => arguments}
135
135
 
136
- resp = send_message(s.to_xml)
136
+ # Grab the command element and unescape any single quotes - issue 69
137
+ xml = s.to_xml
138
+ escaped_cmd = /<#{NS_WIN_SHELL}:Command>(.+)<\/#{NS_WIN_SHELL}:Command>/.match(xml)[1]
139
+ xml.sub!(escaped_cmd, escaped_cmd.gsub(/&#39;/, "'"))
140
+
141
+ resp = send_message(xml)
137
142
  (resp/"//#{NS_WIN_SHELL}:CommandId").text
138
143
  end
139
144
 
@@ -252,16 +257,8 @@ module WinRM
252
257
  def run_powershell_script(script_file, &block)
253
258
  # if an IO object is passed read it..otherwise assume the contents of the file were passed
254
259
  script = script_file.kind_of?(IO) ? script_file.read : script_file
255
-
256
- script = script.chars.to_a.join("\x00").chomp
257
- script << "\x00" unless script[-1].eql? "\x00"
258
- if(defined?(script.encode))
259
- script = script.encode('ASCII-8BIT')
260
- script = Base64.strict_encode64(script)
261
- else
262
- script = Base64.encode64(script).chomp
263
- end
264
-
260
+ script = script.encode('UTF-16LE', 'UTF-8')
261
+ script = Base64.strict_encode64(script)
265
262
  shell_id = open_shell
266
263
  command_id = run_command(shell_id, "powershell -encodedCommand #{script}")
267
264
  command_output = get_command_output(shell_id, command_id, &block)
@@ -0,0 +1,36 @@
1
+ describe "Test remote WQL features via WinRM", :integration => true do
2
+ before(:all) do
3
+ @winrm = winrm_connection
4
+ end
5
+
6
+ it 'should run a CMD command string' do
7
+ output = @winrm.run_cmd('ipconfig /all')
8
+ expect(output[:exitcode]).to eq(0)
9
+ expect(output[:data]).to_not be_empty
10
+ end
11
+
12
+ it 'should run a CMD command with proper arguments' do
13
+ output = @winrm.run_cmd('ipconfig', %w{/all})
14
+ expect(output[:exitcode]).to eq(0)
15
+ expect(output[:data]).to_not be_empty
16
+ end
17
+
18
+ it 'should run a CMD command with block' do
19
+ outvar = ''
20
+ @winrm.run_cmd('ipconfig', %w{/all}) do |stdout, stderr|
21
+ outvar << stdout
22
+ end
23
+ expect(outvar).to match(/Windows IP Configuration/)
24
+ end
25
+
26
+ it 'should run a CMD command that contains an apostrophe' do
27
+ output = @winrm.run_cmd(%q{echo 'hello world'})
28
+ expect(output[:exitcode]).to eq(0)
29
+ expect(output[:data][0][:stdout]).to match(/'hello world'/)
30
+ end
31
+
32
+ it 'should run a CMD command that is empty' do
33
+ output = @winrm.run_cmd('')
34
+ expect(output[:exitcode]).to eq(0)
35
+ end
36
+ end
@@ -5,8 +5,8 @@
5
5
  # realm: "your.realm"
6
6
 
7
7
  ## Plain Text
8
- #auth_type: plaintext
9
- #endpoint: "http://localhost:5985/wsman"
10
- #options:
11
- # user: vagrant
12
- # pass: vagrant
8
+ auth_type: plaintext
9
+ endpoint: "http://localhost:5985/wsman"
10
+ options:
11
+ user: vagrant
12
+ pass: vagrant
@@ -1,30 +1,28 @@
1
- $: << File.dirname(__FILE__)
2
- require 'spec_helper'
3
- require 'Nori'
1
+ require 'nori'
4
2
 
5
- describe "Test Nori Type Cast Toggler" do
3
+ describe "Test Nori Type Cast Toggler", :unit => true do
6
4
  before(:all) do
7
5
  @winrm = winrm_connection
8
6
  end
9
7
 
10
8
  it 'should have nori advanced type casting on' do
11
- Nori.advanced_typecasting?.should == true
9
+ expect(Nori.advanced_typecasting?).to be true
12
10
  end
13
11
 
14
12
  it 'should turn off nori advanced type casting' do
15
13
  @winrm.toggle_nori_type_casting :off
16
- Nori.advanced_typecasting?.should == false
14
+ expect(Nori.advanced_typecasting?).to be false
17
15
  end
18
16
 
19
17
  it 'should return nori advanced type casting to the original state' do
20
18
  @winrm.toggle_nori_type_casting :original
21
- Nori.advanced_typecasting?.should == true
19
+ expect(Nori.advanced_typecasting?).to be true
22
20
  end
23
21
 
24
22
  it 'should turn on nori advanced type casting' do
25
23
  @winrm.toggle_nori_type_casting :off
26
24
  @winrm.toggle_nori_type_casting :on
27
- Nori.advanced_typecasting?.should == true
25
+ expect(Nori.advanced_typecasting?).to be true
28
26
  end
29
27
 
30
28
  end
@@ -1,7 +1,4 @@
1
- $: << File.dirname(__FILE__)
2
- require 'spec_helper'
3
-
4
- describe "Test remote Powershell features via WinRM" do
1
+ describe "Test remote Powershell features via WinRM", :integration => true do
5
2
  before(:all) do
6
3
  @winrm = winrm_connection
7
4
  end
@@ -10,6 +7,6 @@ describe "Test remote Powershell features via WinRM" do
10
7
  ps_file = File.open("#{File.dirname(__FILE__)}/test.ps1", 'r+')
11
8
  output = @winrm.run_powershell_script(ps_file)
12
9
  ps_file.close
13
- output[:exitcode].should == 0
10
+ expect(output[:exitcode]).to eq(0)
14
11
  end
15
12
  end
@@ -1,19 +1,27 @@
1
- $: << File.dirname(__FILE__) + '/../../lib/'
1
+ require 'rubygems'
2
+ require 'bundler/setup'
2
3
  require 'winrm'
3
4
  require 'json'
4
5
 
5
6
  module ConnectionHelper
6
- # To run this test put a file called 'creds.json' in this directory with the following format:
7
- # {"user":"myuser","pass":"mypass","endpoint":"http://mysys.com/wsman","realm":"MY.REALM"}
8
- WINRM_CONFIG = File.expand_path("#{File.dirname(__FILE__)}/../config.yml")
9
7
 
10
8
  def winrm_connection
11
- config = symbolize_keys(YAML.load(File.read(WINRM_CONFIG)))
9
+ config = symbolize_keys(YAML.load(File.read(winrm_config_path)))
12
10
  config[:options].merge!( :basic_auth_only => true ) unless config[:auth_type].eql? :kerberos
13
11
  winrm = WinRM::WinRMWebService.new(config[:endpoint], config[:auth_type].to_sym, config[:options])
14
12
  winrm
15
13
  end
16
14
 
15
+ def winrm_config_path
16
+ # Copy config-example.yml to config.yml and edit for your local configuration
17
+ path = File.expand_path("#{File.dirname(__FILE__)}/config.yml")
18
+ if !File.exists?(path)
19
+ # user hasn't done this, so use sane defaults for unit tests
20
+ path = File.expand_path("#{File.dirname(__FILE__)}/config-example.yml")
21
+ end
22
+ path
23
+ end
24
+
17
25
  def symbolize_keys(hash)
18
26
  hash.inject({}){|result, (key, value)|
19
27
  new_key = case key
File without changes
@@ -0,0 +1,70 @@
1
+ describe "Test WinRM primitive methods" do
2
+ before(:all) do
3
+ @winrm = winrm_connection
4
+ end
5
+
6
+ describe "open and close shell", :integration => true do
7
+
8
+ it 'should #open_shell and #close_shell' do
9
+ sid = @winrm.open_shell
10
+ # match a UUID
11
+ expect(sid).to match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/)
12
+ expect(@winrm.close_shell(sid)).to be true
13
+ end
14
+
15
+ it 'should #run_command and #cleanup_command' do
16
+ sid = @winrm.open_shell
17
+
18
+ cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
19
+ expect(sid).to match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/)
20
+
21
+ expect(@winrm.cleanup_command(sid, cmd_id)).to be true
22
+ @winrm.close_shell(sid)
23
+ end
24
+
25
+ it 'should #get_command_output' do
26
+ sid = @winrm.open_shell
27
+ cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
28
+
29
+ output = @winrm.get_command_output(sid, cmd_id)
30
+ expect(output[:exitcode]).to eq(0)
31
+ expect(output[:data]).to_not be_empty
32
+
33
+ @winrm.cleanup_command(sid, cmd_id)
34
+ @winrm.close_shell(sid)
35
+ end
36
+
37
+ it 'should #get_command_output with a block' do
38
+ sid = @winrm.open_shell
39
+ cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
40
+
41
+ outvar = ''
42
+ @winrm.get_command_output(sid, cmd_id) do |stdout, stderr|
43
+ outvar << stdout
44
+ end
45
+ expect(outvar).to match(/Windows IP Configuration/)
46
+
47
+ @winrm.cleanup_command(sid, cmd_id)
48
+ @winrm.close_shell(sid)
49
+ end
50
+ end
51
+
52
+ describe "simple values", :unit => true do
53
+ it 'should set #op_timeout' do
54
+ expect(@winrm.op_timeout(120)).to eq('PT2M0S')
55
+ expect(@winrm.op_timeout(1202)).to eq('PT20M2S')
56
+ expect(@winrm.op_timeout(86400)).to eq('PT24H0S')
57
+ end
58
+
59
+ it 'should set #max_env_size' do
60
+ @winrm.max_env_size(153600 * 4)
61
+ expect(@winrm.instance_variable_get('@max_env_sz')).to eq(614400)
62
+ end
63
+
64
+ it 'should set #locale' do
65
+ @winrm.locale('en-ca')
66
+ expect(@winrm.instance_variable_get('@locale')).to eq('en-ca')
67
+ end
68
+ end
69
+
70
+ end
@@ -1,13 +1,10 @@
1
- $: << File.dirname(__FILE__)
2
- require 'spec_helper'
3
-
4
- describe "Test remote WQL features via WinRM" do
1
+ describe "Test remote WQL features via WinRM", :integration => true do
5
2
  before(:all) do
6
3
  @winrm = winrm_connection
7
4
  end
8
5
 
9
6
  it 'should run a WQL query against Win32_Service' do
10
7
  output = @winrm.run_wql('select Name,Status from Win32_Service')
11
- output.should_not be_empty
8
+ expect(output).to_not be_empty
12
9
  end
13
10
  end
@@ -24,11 +24,13 @@ Gem::Specification.new do |s|
24
24
  s.extra_rdoc_files = %w(README.md LICENSE)
25
25
 
26
26
  s.required_ruby_version = '>= 1.9.0'
27
- s.add_runtime_dependency 'gssapi', '~> 1.0.0'
28
- s.add_runtime_dependency 'httpclient', '~> 2.2', '>= 2.2.0.2'
29
- s.add_runtime_dependency 'nokogiri', '~> 1.5'
30
- s.add_runtime_dependency 'rubyntlm', '~> 0.1.1'
31
- s.add_runtime_dependency 'uuidtools', '~> 2.1.2'
32
- s.add_runtime_dependency 'savon', '= 0.9.5'
33
- s.add_runtime_dependency 'logging', '~> 1.6', '>= 1.6.1'
27
+ s.add_runtime_dependency 'gssapi', '~> 1.0.0'
28
+ s.add_runtime_dependency 'httpclient', '~> 2.2', '>= 2.2.0.2'
29
+ s.add_runtime_dependency 'nokogiri', '~> 1.5'
30
+ s.add_runtime_dependency 'rubyntlm', '~> 0.1.1'
31
+ s.add_runtime_dependency 'uuidtools', '~> 2.1.2'
32
+ s.add_runtime_dependency 'savon', '= 0.9.5'
33
+ s.add_runtime_dependency 'logging', '~> 1.6', '>= 1.6.1'
34
+ s.add_development_dependency 'rspec', '~> 3.0.0'
35
+ s.add_development_dependency 'rake', '~> 10.3.2'
34
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winrm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0.dev1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Wanek
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-09 00:00:00.000000000 Z
12
+ date: 2014-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gssapi
@@ -121,6 +121,34 @@ dependencies:
121
121
  - - '>='
122
122
  - !ruby/object:Gem::Version
123
123
  version: 1.6.1
124
+ - !ruby/object:Gem::Dependency
125
+ name: rspec
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ~>
129
+ - !ruby/object:Gem::Version
130
+ version: 3.0.0
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ version: 3.0.0
138
+ - !ruby/object:Gem::Dependency
139
+ name: rake
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ version: 10.3.2
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ~>
150
+ - !ruby/object:Gem::Version
151
+ version: 10.3.2
124
152
  description: |2
125
153
  Ruby library for Windows Remote Management
126
154
  email:
@@ -133,11 +161,14 @@ extra_rdoc_files:
133
161
  - LICENSE
134
162
  files:
135
163
  - .gitignore
164
+ - .rspec
165
+ - .travis.yml
136
166
  - Gemfile
137
167
  - LICENSE
138
168
  - README.md
139
169
  - Rakefile
140
170
  - VERSION
171
+ - changelog.md
141
172
  - lib/winrm.rb
142
173
  - lib/winrm/exceptions/exceptions.rb
143
174
  - lib/winrm/helpers/iso8601_duration.rb
@@ -145,15 +176,14 @@ files:
145
176
  - lib/winrm/soap_provider.rb
146
177
  - lib/winrm/winrm_service.rb
147
178
  - preamble
148
- - test/.rspec
149
- - test/config-example.yml
150
- - test/spec/cmd_spec.rb
151
- - test/spec/nori_type_casting_spec.rb
152
- - test/spec/powershell_spec.rb
153
- - test/spec/spec_helper.rb
154
- - test/spec/test.ps1
155
- - test/spec/winrm_primitives_spec.rb
156
- - test/spec/wql_spec.rb
179
+ - spec/cmd_spec.rb
180
+ - spec/config-example.yml
181
+ - spec/nori_type_casting_spec.rb
182
+ - spec/powershell_spec.rb
183
+ - spec/spec_helper.rb
184
+ - spec/test.ps1
185
+ - spec/winrm_primitives_spec.rb
186
+ - spec/wql_spec.rb
157
187
  - winrm.gemspec
158
188
  homepage: http://github.com/WinRb/WinRM
159
189
  licenses: []
@@ -173,12 +203,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
203
  version: 1.9.0
174
204
  required_rubygems_version: !ruby/object:Gem::Requirement
175
205
  requirements:
176
- - - '>='
206
+ - - '>'
177
207
  - !ruby/object:Gem::Version
178
- version: '0'
208
+ version: 1.3.1
179
209
  requirements: []
180
210
  rubyforge_project:
181
- rubygems_version: 2.0.6
211
+ rubygems_version: 2.0.14
182
212
  signing_key:
183
213
  specification_version: 4
184
214
  summary: Ruby library for Windows Remote Management
@@ -1,28 +0,0 @@
1
- $: << File.dirname(__FILE__)
2
- require 'spec_helper'
3
-
4
- describe "Test remote WQL features via WinRM" do
5
- before(:all) do
6
- @winrm = winrm_connection
7
- end
8
-
9
- it 'should run a CMD command string' do
10
- output = @winrm.run_cmd('ipconfig /all')
11
- output[:exitcode].should == 0
12
- output[:data].should_not be_empty
13
- end
14
-
15
- it 'should run a CMD command with proper arguments' do
16
- output = @winrm.run_cmd('ipconfig', %w{/all})
17
- output[:exitcode].should == 0
18
- output[:data].should_not be_empty
19
- end
20
-
21
- it 'should run a CMD command with block' do
22
- outvar = ''
23
- @winrm.run_cmd('ipconfig', %w{/all}) do |stdout, stderr|
24
- outvar << stdout
25
- end
26
- outvar.should =~ /Windows IP Configuration/
27
- end
28
- end
@@ -1,68 +0,0 @@
1
- $: << File.dirname(__FILE__)
2
- require 'spec_helper'
3
-
4
- describe "Test WinRM primitive methods" do
5
- before(:all) do
6
- @winrm = winrm_connection
7
- end
8
-
9
- it 'should #open_shell and #close_shell' do
10
- sid = @winrm.open_shell
11
- # match a UUID
12
- sid.should =~ /^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/
13
- @winrm.close_shell(sid).should be_true
14
- end
15
-
16
- it 'should #run_command and #cleanup_command' do
17
- sid = @winrm.open_shell
18
-
19
- cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
20
- cmd_id.should =~ /^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/
21
-
22
- @winrm.cleanup_command(sid, cmd_id).should be_true
23
- @winrm.close_shell(sid)
24
- end
25
-
26
- it 'should #get_command_output' do
27
- sid = @winrm.open_shell
28
- cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
29
-
30
- output = @winrm.get_command_output(sid, cmd_id)
31
- output[:exitcode].should == 0
32
- output[:data].should_not be_empty
33
-
34
- @winrm.cleanup_command(sid, cmd_id)
35
- @winrm.close_shell(sid)
36
- end
37
-
38
- it 'should #get_command_output with a block' do
39
- sid = @winrm.open_shell
40
- cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
41
-
42
- outvar = ''
43
- @winrm.get_command_output(sid, cmd_id) do |stdout, stderr|
44
- outvar << stdout
45
- end
46
- outvar.should =~ /Windows IP Configuration/
47
-
48
- @winrm.cleanup_command(sid, cmd_id)
49
- @winrm.close_shell(sid)
50
- end
51
-
52
- it 'should set #op_timeout' do
53
- @winrm.op_timeout(120).should == 'PT2M0S'
54
- @winrm.op_timeout(1202).should == 'PT20M2S'
55
- @winrm.op_timeout(86400).should == 'PT24H0S'
56
- end
57
-
58
- it 'should set #max_env_size' do
59
- @winrm.max_env_size(153600 * 4)
60
- @winrm.instance_variable_get('@max_env_sz').should == 614400
61
- end
62
-
63
- it 'should set #locale' do
64
- @winrm.locale('en-ca')
65
- @winrm.instance_variable_get('@locale').should == 'en-ca'
66
- end
67
-
68
- end