winrm 1.7.3 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -10
  3. data/.rspec +3 -3
  4. data/.travis.yml +12 -12
  5. data/Gemfile +9 -9
  6. data/LICENSE +202 -202
  7. data/README.md +213 -194
  8. data/Rakefile +36 -36
  9. data/Vagrantfile +9 -9
  10. data/WinrmAppveyor.psm1 +32 -0
  11. data/appveyor.yml +51 -42
  12. data/bin/rwinrm +97 -97
  13. data/changelog.md +3 -0
  14. data/lib/winrm.rb +42 -42
  15. data/lib/winrm/command_executor.rb +6 -2
  16. data/lib/winrm/command_output_decoder.rb +53 -53
  17. data/lib/winrm/exceptions/exceptions.rb +57 -57
  18. data/lib/winrm/helpers/iso8601_duration.rb +58 -58
  19. data/lib/winrm/helpers/powershell_script.rb +42 -42
  20. data/lib/winrm/http/response_handler.rb +82 -82
  21. data/lib/winrm/http/transport.rb +17 -0
  22. data/lib/winrm/output.rb +43 -43
  23. data/lib/winrm/soap_provider.rb +39 -39
  24. data/lib/winrm/version.rb +1 -1
  25. data/lib/winrm/winrm_service.rb +550 -547
  26. data/preamble +17 -17
  27. data/spec/auth_timeout_spec.rb +16 -16
  28. data/spec/cmd_spec.rb +102 -102
  29. data/spec/command_executor_spec.rb +27 -10
  30. data/spec/command_output_decoder_spec.rb +37 -37
  31. data/spec/config-example.yml +19 -19
  32. data/spec/exception_spec.rb +50 -50
  33. data/spec/issue_184_spec.rb +67 -67
  34. data/spec/issue_59_spec.rb +23 -23
  35. data/spec/matchers.rb +74 -74
  36. data/spec/output_spec.rb +110 -110
  37. data/spec/powershell_spec.rb +97 -97
  38. data/spec/response_handler_spec.rb +59 -59
  39. data/spec/spec_helper.rb +73 -73
  40. data/spec/stubs/responses/get_command_output_response.xml.erb +13 -13
  41. data/spec/stubs/responses/open_shell_v1.xml +19 -19
  42. data/spec/stubs/responses/open_shell_v2.xml +20 -20
  43. data/spec/stubs/responses/soap_fault_v1.xml +36 -36
  44. data/spec/stubs/responses/soap_fault_v2.xml +42 -42
  45. data/spec/stubs/responses/wmi_error_v2.xml +41 -41
  46. data/spec/transport_spec.rb +139 -124
  47. data/spec/winrm_options_spec.rb +76 -76
  48. data/spec/winrm_primitives_spec.rb +51 -51
  49. data/spec/wql_spec.rb +14 -14
  50. data/winrm.gemspec +40 -40
  51. metadata +4 -3
data/README.md CHANGED
@@ -1,194 +1,213 @@
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)
4
- [![Build status](https://ci.appveyor.com/api/projects/status/ods9tvos78k5c15h?svg=true)](https://ci.appveyor.com/project/winrb/winrm)
5
-
6
- This is a SOAP library that uses the functionality in Windows Remote
7
- Management(WinRM) to call native object in Windows. This includes, but is
8
- not limitted to, running batch scripts, powershell scripts and fetching WMI
9
- variables. For more information on WinRM, please visit Microsoft's WinRM
10
- site: http://msdn.microsoft.com/en-us/library/aa384426(v=VS.85).aspx
11
-
12
- ## Supported WinRM Versions
13
- WinRM 1.1 is supported, however 2.0 and higher is recommended. [See MSDN](http://technet.microsoft.com/en-us/library/ff520073(v=ws.10).aspx) for information about WinRM versions and supported operating systems.
14
-
15
- ## Install
16
- `gem install -r winrm` then on the server `winrm quickconfig` as admin
17
-
18
- ## Example
19
- ```ruby
20
- require 'winrm'
21
- endpoint = 'http://mywinrmhost:5985/wsman'
22
- krb5_realm = 'EXAMPLE.COM'
23
- winrm = WinRM::WinRMWebService.new(endpoint, :kerberos, :realm => krb5_realm)
24
- winrm.create_executor do |executor|
25
- executor.run_cmd('ipconfig /all') do |stdout, stderr|
26
- STDOUT.print stdout
27
- STDERR.print stderr
28
- end
29
- end
30
- ```
31
-
32
- There are various connection types you can specify upon initialization:
33
-
34
- It is recommended that you <code>:disable_sspi => true</code> if you are using the plaintext or ssl transport.
35
-
36
- ### Deprecated methods
37
- As of version 1.5.0 `WinRM::WinRMWebService` methods `cmd`, `run_cmd`, `powershell`, and `run_powershell_script` have been deprecated and will be removed from the next major version of the WinRM gem.
38
-
39
- Use the `run_cmd` and `run_powershell_script` of the `WinRM::CommandExecutor` class instead. The `CommandExecutor` allows multiple commands to be run from the same WinRM shell providing a significant performance improvement when issuing multiple calls.
40
-
41
- #### NTLM/Negotiate
42
- ```ruby
43
- winrm = WinRM::WinRMWebService.new(endpoint, :negotiate, :user => myuser, :pass => mypass)
44
- ```
45
-
46
- #### Plaintext
47
- Note: It is strongly recommended that you use `:negotiate` instead of `:plaintext`. As the name infers, the `:plaintext` transport includes authentication credentials in plain text.
48
- ```ruby
49
- WinRM::WinRMWebService.new(endpoint, :plaintext, :user => myuser, :pass => mypass, :disable_sspi => true)
50
-
51
- ## Same but force basic authentication:
52
- WinRM::WinRMWebService.new(endpoint, :plaintext, :user => myuser, :pass => mypass, :basic_auth_only => true)
53
- ```
54
-
55
- #### SSL
56
- ```ruby
57
- WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :disable_sspi => true)
58
-
59
- # Specifying CA path
60
- WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :ca_trust_path => '/etc/ssl/certs/cert.pem', :basic_auth_only => true)
61
-
62
- # Same but force basic authentication:
63
- WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :basic_auth_only => true)
64
-
65
- # Basic auth over SSL w/self signed cert
66
- # Enabling no_ssl_peer_verification is not recommended. HTTPS connections are still encrypted,
67
- # but the WinRM gem is not able to detect forged replies or man in the middle attacks.
68
- WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :basic_auth_only => true, :no_ssl_peer_verification => true)
69
-
70
- # Verify against a known fingerprint
71
- WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :basic_auth_only => true, :ssl_peer_fingerprint => '6C04B1A997BA19454B0CD31C65D7020A6FC2669D')
72
- ```
73
-
74
- ##### Create a self signed cert for WinRM
75
- You may want to create a self signed certificate for servicing https WinRM connections. You can use the following PowerShell script to create a cert and enable the WinRM HTTPS listener. Unless you are running windows server 2012 R2 or later, you must install makecert.exe from the Windows SDK, otherwise use `New-SelfSignedCertificate`.
76
-
77
- ```powershell
78
- $hostname = $Env:ComputerName
79
-
80
- C:\"Program Files"\"Microsoft SDKs"\Windows\v7.1\Bin\makecert.exe -r -pe -n "CN=$hostname,O=vagrant" -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 "$hostname.cer"
81
-
82
- $thumbprint = (& ls cert:LocalMachine/my).Thumbprint
83
-
84
- # Windows 2012R2 and above can use New-SelfSignedCertificate
85
- $thumbprint = (New-SelfSignedCertificate -DnsName $hostname -CertStoreLocation cert:\LocalMachine\my).Thumbprint
86
-
87
- $cmd = "winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname=`"$hostname`";CertificateThumbprint=`"$thumbprint`"}'"
88
- iex $cmd
89
- ```
90
-
91
- #### Kerberos
92
- ```ruby
93
- WinRM::WinRMWebService.new(endpoint, :kerberos, :realm => 'MYREALM.COM')
94
- ```
95
-
96
- ## Retries and opening a shell
97
- Especially if provisioning a new machine, it's possible the winrm service is not yet running when first attempting to connect. The `WinRMWebService` accepts the options `:retry_limit` and `:retry_delay` to specify the maximum number of attempts to make and how long to wait in between. These default to 3 attempts and a 10 second delay.
98
- ```ruby
99
- WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :retry_limit => 30, :retry_delay => 10)
100
- ```
101
-
102
- ## Logging
103
- The `WinRMWebService` exposes a `logger` attribute and uses the [logging](https://rubygems.org/gems/logging) gem to manage logging behavior. By default this appends to `STDOUT` and has a level of `:warn`, but one can adjust the level or add additional appenders.
104
- ```ruby
105
- winrm = WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass)
106
-
107
- # suppress warnings
108
- winrm.logger.level = :error
109
-
110
- # Log to a file
111
- winrm.logger.add_appenders(Logging.appenders.file('error.log'))
112
- ```
113
-
114
- If a consuming application uses its own logger that complies to the logging API, you can simply swap it in:
115
- ```ruby
116
- winrm.logger = my_logger
117
- ```
118
-
119
- ## Troubleshooting
120
- You may have some errors like ```WinRM::WinRMAuthorizationError```.
121
- You can run the following commands on the server to try to solve the problem:
122
- ```
123
- winrm set winrm/config/client/auth @{Basic="true"}
124
- winrm set winrm/config/service/auth @{Basic="true"}
125
- winrm set winrm/config/service @{AllowUnencrypted="true"}
126
- ```
127
- You can read more about that on issue [#29](https://github.com/WinRb/WinRM/issues/29)
128
-
129
- Also see [this post](http://www.hurryupandwait.io/blog/understanding-and-troubleshooting-winrm-connection-and-authentication-a-thrill-seekers-guide-to-adventure) for more general tips related to winrm connection and authentication issues.
130
-
131
-
132
- ## Current features
133
-
134
- 1. GSSAPI support: This is the default way that Windows authenticates and
135
- secures WinRM messages. In order for this to work the computer you are
136
- connecting to must be a part of an Active Directory domain and you must
137
- have local credentials via kinit. GSSAPI support is dependent on the
138
- gssapi gem which only supports the MIT Kerberos libraries at this time.
139
-
140
- If you are using this method there is no longer a need to change the
141
- WinRM service authentication settings. You can simply do a
142
- 'winrm quickconfig' on your server or enable WinRM via group policy and
143
- everything should be working.
144
-
145
- 2. Multi-Instance support: Moving away from Handsoap allows multiple
146
- instances to be created because the SOAP backend is no longer a Singleton
147
- type class.
148
-
149
- 3. 100% Ruby: Nokogiri while faster can present additional frustration for
150
- users above and beyond what is already required to get WinRM working.
151
- The goal of this gem is make using WinRM easy. In V2 we plan on making
152
- the parser swappable in case you really do need the performance.
153
-
154
- ## Contributing
155
-
156
- 1. Fork it.
157
- 2. Create a branch (git checkout -b my_feature_branch)
158
- 3. Run the unit and integration tests (bundle exec rake integration)
159
- 4. Commit your changes (git commit -am "Added a sweet feature")
160
- 5. Push to the branch (git push origin my_feature_branch)
161
- 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)
162
-
163
- ### Running the tests
164
-
165
- We use Bundler to manage dependencies during development.
166
-
167
- ```
168
- $ bundle install
169
- ```
170
-
171
- Once you have the dependencies, you can run the unit tests with `rake`:
172
-
173
- ```
174
- $ bundle exec rake spec
175
- ```
176
-
177
- 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 (mwrock/Windows2012R2 is public on [atlas](https://atlas.hashicorp.com/mwrock/boxes/Windows2012R2) with an evaluation version of Windows 2012 R2).
178
-
179
- 1. Create a Windows VM with WinRM configured (see above).
180
- 2. Copy the config-example.yml to config.yml - edit this file with your WinRM connection details.
181
- 3. Ensure that the box you are running the test against has a default shell profile (check ~\Documents\WindowsPowerShell). If any of your shell profiles generate stdout or stderr output, the test validators may get thrown off.
182
- 4. Run `bundle exec rake integration`
183
-
184
- ## WinRM Author
185
- * Twitter: [@zentourist](https://twitter.com/zentourist)
186
- * BLOG: [http://distributed-frostbite.blogspot.com/](http://distributed-frostbite.blogspot.com/)
187
- * Add me in LinkedIn: [http://www.linkedin.com/in/danwanek](http://www.linkedin.com/in/danwanek)
188
- * Find me on irc.freenode.net in #ruby-lang (zenChild)
189
-
190
- ## Maintainers
191
- * Paul Morton (https://github.com/pmorton)
192
- * Shawn Neal (https://github.com/sneal)
193
-
194
- [Contributors](https://github.com/WinRb/WinRM/graphs/contributors)
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)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/ods9tvos78k5c15h?svg=true)](https://ci.appveyor.com/project/winrb/winrm)
5
+
6
+ This is a SOAP library that uses the functionality in Windows Remote
7
+ Management(WinRM) to call native object in Windows. This includes, but is
8
+ not limitted to, running batch scripts, powershell scripts and fetching WMI
9
+ variables. For more information on WinRM, please visit Microsoft's WinRM
10
+ site: http://msdn.microsoft.com/en-us/library/aa384426(v=VS.85).aspx
11
+
12
+ ## Supported WinRM Versions
13
+ WinRM 1.1 is supported, however 2.0 and higher is recommended. [See MSDN](http://technet.microsoft.com/en-us/library/ff520073(v=ws.10).aspx) for information about WinRM versions and supported operating systems.
14
+
15
+ ## Install
16
+ `gem install -r winrm` then on the server `winrm quickconfig` as admin
17
+
18
+ ## Example
19
+ ```ruby
20
+ require 'winrm'
21
+ endpoint = 'http://mywinrmhost:5985/wsman'
22
+ krb5_realm = 'EXAMPLE.COM'
23
+ winrm = WinRM::WinRMWebService.new(endpoint, :kerberos, :realm => krb5_realm)
24
+ winrm.create_executor do |executor|
25
+ executor.run_cmd('ipconfig /all') do |stdout, stderr|
26
+ STDOUT.print stdout
27
+ STDERR.print stderr
28
+ end
29
+ end
30
+ ```
31
+
32
+ There are various connection types you can specify upon initialization:
33
+
34
+ It is recommended that you <code>:disable_sspi => true</code> if you are using the plaintext or ssl transport.
35
+
36
+ ### Deprecated methods
37
+ As of version 1.5.0 `WinRM::WinRMWebService` methods `cmd`, `run_cmd`, `powershell`, and `run_powershell_script` have been deprecated and will be removed from the next major version of the WinRM gem.
38
+
39
+ Use the `run_cmd` and `run_powershell_script` of the `WinRM::CommandExecutor` class instead. The `CommandExecutor` allows multiple commands to be run from the same WinRM shell providing a significant performance improvement when issuing multiple calls.
40
+
41
+ #### NTLM/Negotiate
42
+ ```ruby
43
+ winrm = WinRM::WinRMWebService.new(endpoint, :negotiate, :user => myuser, :pass => mypass)
44
+ ```
45
+
46
+ #### Plaintext
47
+ Note: It is strongly recommended that you use `:negotiate` instead of `:plaintext`. As the name infers, the `:plaintext` transport includes authentication credentials in plain text.
48
+ ```ruby
49
+ WinRM::WinRMWebService.new(endpoint, :plaintext, :user => myuser, :pass => mypass, :disable_sspi => true)
50
+
51
+ ## Same but force basic authentication:
52
+ WinRM::WinRMWebService.new(endpoint, :plaintext, :user => myuser, :pass => mypass, :basic_auth_only => true)
53
+ ```
54
+
55
+ #### SSL
56
+ ```ruby
57
+ WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :disable_sspi => true)
58
+
59
+ # Specifying CA path
60
+ WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :ca_trust_path => '/etc/ssl/certs/cert.pem', :basic_auth_only => true)
61
+
62
+ # Same but force basic authentication:
63
+ WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :basic_auth_only => true)
64
+
65
+ # Basic auth over SSL w/self signed cert
66
+ # Enabling no_ssl_peer_verification is not recommended. HTTPS connections are still encrypted,
67
+ # but the WinRM gem is not able to detect forged replies or man in the middle attacks.
68
+ WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :basic_auth_only => true, :no_ssl_peer_verification => true)
69
+
70
+ # Verify against a known fingerprint
71
+ WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :basic_auth_only => true, :ssl_peer_fingerprint => '6C04B1A997BA19454B0CD31C65D7020A6FC2669D')
72
+
73
+ # Specifying a Client Cert, key and (optional) key password for password-less authentication
74
+ WinRM::WinRMWebService.new(endpoint, :ssl, :client_cert => '/path/to/cert.pem', :client_key => '/path/to/key.key', :key_pass => 'password', :no_ssl_peer_verification => true)
75
+
76
+ # Specifying a Client Cert object, key object and (optional) key password for password-less authentication
77
+ WinRM::WinRMWebService.new(endpoint, :ssl, :client_cert => <X509::Certificate object>, :client_key => <PKey::Pkey object>, :key_pass => 'password', :no_ssl_peer_verification => true)
78
+ ```
79
+
80
+ ##### Create a self signed cert for WinRM
81
+ You may want to create a self signed certificate for servicing https WinRM connections. You can use the following PowerShell script to create a cert and enable the WinRM HTTPS listener. Unless you are running windows server 2012 R2 or later, you must install makecert.exe from the Windows SDK, otherwise use `New-SelfSignedCertificate`.
82
+
83
+ ```powershell
84
+ $hostname = $Env:ComputerName
85
+
86
+ C:\"Program Files"\"Microsoft SDKs"\Windows\v7.1\Bin\makecert.exe -r -pe -n "CN=$hostname,O=vagrant" -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 "$hostname.cer"
87
+
88
+ $thumbprint = (& ls cert:LocalMachine/my).Thumbprint
89
+
90
+ # Windows 2012R2 and above can use New-SelfSignedCertificate
91
+ $thumbprint = (New-SelfSignedCertificate -DnsName $hostname -CertStoreLocation cert:\LocalMachine\my).Thumbprint
92
+
93
+ $cmd = "winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname=`"$hostname`";CertificateThumbprint=`"$thumbprint`"}'"
94
+ iex $cmd
95
+ ```
96
+
97
+ ##### Setting up Certificate based authentication
98
+ Perform the following steps to authenticate with a certificate instead of a username and password:
99
+
100
+ 1. Generate a certificate with an Extended Key Usage of Client Authentication and a Subject Alternative Name with the UPN of the user. See this [powershell function](https://github.com/WinRb/WinRM/blob/master/WinrmAppveyor.psm1#L1) as an example of using `openssl` to create a self signed user certificate in `.pem` and `.pfx` formats along with the private key file.
101
+
102
+ 2. Import the pfx file into the `TrustedPeople` directory of the `LocalMachine` certificate store on the windows endpoint.
103
+
104
+ 3. Import the issuing certificate authority certificate in the endpoint's `Root` certificates. If your client certificate is self signed, this will be the client certificate.
105
+
106
+ 4. Enable certificate authentication on the endpoint: `Set-Item -Path WSMan:\localhost\Service\Auth\Certificate -Value $true`
107
+
108
+ 5. Add a winrm user mapping for the issuing certificate: `New-Item -Path WSMan:\localhost\ClientCertificate -Subject <user UPN> -URI * -Issuer <issuing certificate thumbprint> -Credential (Get-Credential) -Force`
109
+
110
+ #### Kerberos
111
+ ```ruby
112
+ WinRM::WinRMWebService.new(endpoint, :kerberos, :realm => 'MYREALM.COM')
113
+ ```
114
+
115
+ ## Retries and opening a shell
116
+ Especially if provisioning a new machine, it's possible the winrm service is not yet running when first attempting to connect. The `WinRMWebService` accepts the options `:retry_limit` and `:retry_delay` to specify the maximum number of attempts to make and how long to wait in between. These default to 3 attempts and a 10 second delay.
117
+ ```ruby
118
+ WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass, :retry_limit => 30, :retry_delay => 10)
119
+ ```
120
+
121
+ ## Logging
122
+ The `WinRMWebService` exposes a `logger` attribute and uses the [logging](https://rubygems.org/gems/logging) gem to manage logging behavior. By default this appends to `STDOUT` and has a level of `:warn`, but one can adjust the level or add additional appenders.
123
+ ```ruby
124
+ winrm = WinRM::WinRMWebService.new(endpoint, :ssl, :user => myuser, :pass => mypass)
125
+
126
+ # suppress warnings
127
+ winrm.logger.level = :error
128
+
129
+ # Log to a file
130
+ winrm.logger.add_appenders(Logging.appenders.file('error.log'))
131
+ ```
132
+
133
+ If a consuming application uses its own logger that complies to the logging API, you can simply swap it in:
134
+ ```ruby
135
+ winrm.logger = my_logger
136
+ ```
137
+
138
+ ## Troubleshooting
139
+ You may have some errors like ```WinRM::WinRMAuthorizationError```.
140
+ You can run the following commands on the server to try to solve the problem:
141
+ ```
142
+ winrm set winrm/config/client/auth @{Basic="true"}
143
+ winrm set winrm/config/service/auth @{Basic="true"}
144
+ winrm set winrm/config/service @{AllowUnencrypted="true"}
145
+ ```
146
+ You can read more about that on issue [#29](https://github.com/WinRb/WinRM/issues/29)
147
+
148
+ Also see [this post](http://www.hurryupandwait.io/blog/understanding-and-troubleshooting-winrm-connection-and-authentication-a-thrill-seekers-guide-to-adventure) for more general tips related to winrm connection and authentication issues.
149
+
150
+
151
+ ## Current features
152
+
153
+ 1. GSSAPI support: This is the default way that Windows authenticates and
154
+ secures WinRM messages. In order for this to work the computer you are
155
+ connecting to must be a part of an Active Directory domain and you must
156
+ have local credentials via kinit. GSSAPI support is dependent on the
157
+ gssapi gem which only supports the MIT Kerberos libraries at this time.
158
+
159
+ If you are using this method there is no longer a need to change the
160
+ WinRM service authentication settings. You can simply do a
161
+ 'winrm quickconfig' on your server or enable WinRM via group policy and
162
+ everything should be working.
163
+
164
+ 2. Multi-Instance support: Moving away from Handsoap allows multiple
165
+ instances to be created because the SOAP backend is no longer a Singleton
166
+ type class.
167
+
168
+ 3. 100% Ruby: Nokogiri while faster can present additional frustration for
169
+ users above and beyond what is already required to get WinRM working.
170
+ The goal of this gem is make using WinRM easy. In V2 we plan on making
171
+ the parser swappable in case you really do need the performance.
172
+
173
+ ## Contributing
174
+
175
+ 1. Fork it.
176
+ 2. Create a branch (git checkout -b my_feature_branch)
177
+ 3. Run the unit and integration tests (bundle exec rake integration)
178
+ 4. Commit your changes (git commit -am "Added a sweet feature")
179
+ 5. Push to the branch (git push origin my_feature_branch)
180
+ 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)
181
+
182
+ ### Running the tests
183
+
184
+ We use Bundler to manage dependencies during development.
185
+
186
+ ```
187
+ $ bundle install
188
+ ```
189
+
190
+ Once you have the dependencies, you can run the unit tests with `rake`:
191
+
192
+ ```
193
+ $ bundle exec rake spec
194
+ ```
195
+
196
+ 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 (mwrock/Windows2012R2 is public on [atlas](https://atlas.hashicorp.com/mwrock/boxes/Windows2012R2) with an evaluation version of Windows 2012 R2).
197
+
198
+ 1. Create a Windows VM with WinRM configured (see above).
199
+ 2. Copy the config-example.yml to config.yml - edit this file with your WinRM connection details.
200
+ 3. Ensure that the box you are running the test against has a default shell profile (check ~\Documents\WindowsPowerShell). If any of your shell profiles generate stdout or stderr output, the test validators may get thrown off.
201
+ 4. Run `bundle exec rake integration`
202
+
203
+ ## WinRM Author
204
+ * Twitter: [@zentourist](https://twitter.com/zentourist)
205
+ * BLOG: [http://distributed-frostbite.blogspot.com/](http://distributed-frostbite.blogspot.com/)
206
+ * Add me in LinkedIn: [http://www.linkedin.com/in/danwanek](http://www.linkedin.com/in/danwanek)
207
+ * Find me on irc.freenode.net in #ruby-lang (zenChild)
208
+
209
+ ## Maintainers
210
+ * Paul Morton (https://github.com/pmorton)
211
+ * Shawn Neal (https://github.com/sneal)
212
+
213
+ [Contributors](https://github.com/WinRb/WinRM/graphs/contributors)
data/Rakefile CHANGED
@@ -1,36 +1,36 @@
1
- # encoding: UTF-8
2
- require 'rubygems'
3
- require 'bundler/setup'
4
- require 'rspec/core/rake_task'
5
- require 'rubocop/rake_task'
6
- require 'bundler/gem_tasks'
7
-
8
- # Change to the directory of this file.
9
- Dir.chdir(File.expand_path('../', __FILE__))
10
-
11
- desc 'Open a Pry console for this library'
12
- task :console do
13
- require 'pry'
14
- require 'winrm'
15
- ARGV.clear
16
- Pry.start
17
- end
18
-
19
- RSpec::Core::RakeTask.new(:spec) do |task|
20
- task.pattern = 'spec/*_spec.rb'
21
- task.rspec_opts = ['--color', '-f documentation']
22
- task.rspec_opts << '-tunit'
23
- end
24
-
25
- # Run the integration test suite
26
- RSpec::Core::RakeTask.new(:integration) do |task|
27
- task.pattern = 'spec/*_spec.rb'
28
- task.rspec_opts = ['--color', '-f documentation']
29
- task.rspec_opts << '-tintegration'
30
- end
31
-
32
- RuboCop::RakeTask.new
33
-
34
- task default: [:spec, :rubocop]
35
-
36
- task all: [:default, :integration]
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+ require 'bundler/gem_tasks'
7
+
8
+ # Change to the directory of this file.
9
+ Dir.chdir(File.expand_path('../', __FILE__))
10
+
11
+ desc 'Open a Pry console for this library'
12
+ task :console do
13
+ require 'pry'
14
+ require 'winrm'
15
+ ARGV.clear
16
+ Pry.start
17
+ end
18
+
19
+ RSpec::Core::RakeTask.new(:spec) do |task|
20
+ task.pattern = 'spec/*_spec.rb'
21
+ task.rspec_opts = ['--color', '-f documentation']
22
+ task.rspec_opts << '-tunit'
23
+ end
24
+
25
+ # Run the integration test suite
26
+ RSpec::Core::RakeTask.new(:integration) do |task|
27
+ task.pattern = 'spec/*_spec.rb'
28
+ task.rspec_opts = ['--color', '-f documentation']
29
+ task.rspec_opts << '-tintegration'
30
+ end
31
+
32
+ RuboCop::RakeTask.new
33
+
34
+ task default: [:spec, :rubocop]
35
+
36
+ task all: [:default, :integration]