ievms-ruby 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1b1ed064b1f9f0d07deb7d8a1599131c33cfd1c
4
- data.tar.gz: 89adcd248ac8f761c206df6e11c5eb6a7616c7da
3
+ metadata.gz: 249e1aad51f82e11e427dd5fae50c58761401f70
4
+ data.tar.gz: fd970f847bd82ad62e78525fccbf3689affd5db2
5
5
  SHA512:
6
- metadata.gz: 71ad9eb8e5775cb37307cde8aa88ae8e9c7a850d63bb69f716db50cce3b6b726d448c19367ae439d54b89a02a5449bf228b5cd89f58b0d198ccb2c58fa2c8028
7
- data.tar.gz: 1c498afdbe7b088c7c6d06ca7fc0b35a64b59b76df4363e3fe4985bf6b6e2b253b2dbf11238fa7eb3ef06c4350ccc390c7c067f8d494cf74f45392887b684276
6
+ metadata.gz: 036bd7897575e55f3f2a06a091a6c233c34fab0e111f536bf120dba21ba593b26d650776033c58ea4bc5a9ced55947fd2cb95eb16e53105c145a754b440f817b
7
+ data.tar.gz: b5d2a964d5a50c23e90cad5cdd53f14045352bcd22d13edf0a861fe07fe1c84eceed5a17027e9b04d7f4b3a28509fca1357259f5b946b781be1b981a28a84682
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /site
2
3
  /.yardoc
3
4
  /Gemfile.lock
4
5
  /_yardoc/
@@ -12,3 +13,4 @@
12
13
  *.o
13
14
  *.a
14
15
  mkmf.log
16
+ /vendor/
data/README.md CHANGED
@@ -21,66 +21,29 @@ Next to [ievms.sh](https://github.com/xdissent/ievms), `ievms-ruby` also works g
21
21
 
22
22
  ## Features
23
23
 
24
- * Upload files to guest machine
25
- * Download file from guest machine
24
+ * Upload and download files from guest machine
26
25
  * Execute cmd.exe and powershell commands on guest machine
27
26
  * Execute cmd.exe and powershell commands on guest machine as admin
28
- * Cat file guest machine from cli
27
+ * Shortcut commands for Windows guest like `cat`, `ps`, `reboot` and `shutdown`
28
+ * To be used as CLI utility or as library in a ruby script.
29
29
 
30
30
  ## Requirements
31
31
 
32
+ * Host Machine: OSX or Linux (only tested on OSX 10.9 & 10.10)
32
33
  * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) >= 5.0.6
33
34
  * VirtualBox Extension Pack and Guest Additions >= 5.0.6
34
- * Host Machine: OSX or Linux (only tested on OSX 10.9 & 10.10)
35
- * Virtual Machines created by .ievms (only tested with vanilla Win7 machines)
35
+ * Windows Machines created by [ievms](https://github.com/xdissent/ievms)
36
+
37
+ ### Recommended
38
+ * [iectrl](https://github.com/xdissent/iectrl), cli interface for simple
39
+ ievms admin commands
36
40
 
37
41
  ## Usage
38
42
 
39
43
  ### As library
40
- Use Ievms-ruby in provisioning scripts for windows E.g. for CI. Here's an example
41
- provisioning script using the Gem. It installs [Chocolatey](https://chocolatey.org), Ruby, and [git-for-windows](https://git-for-windows.github.io) without user interaction needed.
42
-
43
- Add this line to your application's Gemfile:
44
-
45
- ```ruby
46
- gem 'ievms-ruby'
47
- ```
48
-
49
- run `bundle install`
50
-
51
- ```ruby
52
- #!/usr/bin/env ruby
53
- require 'rubygems'
54
- require 'bundler/setup'
55
- require 'ievms/windows_guest'
56
-
57
- class ProvisionIE
58
-
59
- # Create interface for the 'IE9 - Win7' virtual box
60
- def init
61
- @machine = Ievms::WindowsGuest.new 'IE9 - Win7'
62
- end
63
-
64
- # Install the choco package manager (APT for Windows)
65
- def install_chocolatey
66
- print "Installing Chocolatey\n"
67
- choco_install_cmd = '@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString(\'https://chocolatey.org/install.ps1\'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin '
68
- @machine.run_command_as_admin(choco_install_cmd)
69
- end
70
-
71
- # Install ruby and git stuff, the reason why we wrote ievms-ruby
72
- def install_ruby_and_git
73
- %w( ruby msysgit ).each do |pkg|
74
- @machine.run_command_as_admin "c:\\ProgramData\\chocolatey\\bin\\choco install -y #{pkg}"
75
- end
76
- end
77
- end
78
-
79
- provision = ProvisionIE.new
80
- provision.init
81
- provision.install_chocolatey
82
- provision.install_ruby_and_git
83
- ```
44
+ Use Ievms-ruby in provisioning scripts for windows E.g. for Gitlab CI
45
+ or Jenkins integration. There are provisioning example's located in the
46
+ [ievms-ruby library documentation](http://mipmip.github.io/ievms-ruby/library/).
84
47
 
85
48
  ### From CLI
86
49
  Install the Gem on your system:
@@ -89,58 +52,53 @@ Install the Gem on your system:
89
52
 
90
53
  After installation you can use the `ievmsrb` cli program.
91
54
 
92
- #### ievmsrb commands
55
+ Here's the output of `ievmsrb help`
93
56
 
94
57
  ```bash
95
58
  $ ievmsrb help
96
59
 
97
60
  Commands:
98
- ievmsrb cat [vbox name] [file path] # cat file from path in Win vbox
99
- ievmsrb cmd [vbox name] [command to execute] # Run command with cmd.exe in Win vbox
100
- ievmsrb copy_from [vbox name] [path in vbox] [local file] # Copy file from Win vbox to local path
101
- ievmsrb copy_to [vbox name] [local file] [path in vbox] # Copy local file to Win vbox
102
- ievmsrb help [COMMAND] # Describe available commands or one specific command
103
- ievmsrb ps [vbox name] # Show running tasks in Win vbox
104
- ievmsrb reboot [vbox name] # Reboot Win box
105
- ievmsrb shutdown [vbox name] # Shutdown Win vbox
61
+ ievmsrb cat [vbox name] [file path] # cat file from path in Win vbox
62
+ ievmsrb cmd [vbox name] [command to execute] # Run command with cmd.exe in Win vbox
63
+ ievmsrb cmd_adm [vbox name] [command to execute] # Run command as Administrator with cmd.exe in Win vbox
64
+ ievmsrb copy_from [vbox name] [path in vbox] [local file] # Copy file from Win vbox to local path
65
+ ievmsrb copy_to [vbox name] [local file] [path in vbox] # Copy local file to Win vbox
66
+ ievmsrb copy_to_as_adm [vbox name] [local file] [path in vbox] # Copy local file to Win vbox as Administrator
67
+ ievmsrb help [COMMAND] # Describe available commands or one specific command
68
+ ievmsrb ps [vbox name] # Show running tasks in Win vbox
69
+ ievmsrb reboot [vbox name] # Reboot Win box
70
+ ievmsrb shutdown [vbox name] # Shutdown Win vbox
106
71
  ```
107
72
 
108
- #### ievmsrb examples
73
+ Read the docs for more info about [ievms-ruby CLI usage](http://mipmip.github.io/ievms-ruby/cli/).
109
74
 
110
- Display the contents of a guest file.
111
- ```bash
112
- $ ievmsrb cat "IE9 - Win7" 'C:\Windows\System32\Drivers\Etc\hosts'
113
- ```
75
+ ## Contributing
76
+ Please submit a new ticket if you want to report an issue.
77
+ Merge requests are welcome. See issues with `Help Wanted` label.
114
78
 
79
+ ### Testing
80
+ To run the tests you need to fullfil the testing requirements first:
115
81
 
116
- Execute a cmd on the guestmachine and show the output
117
- ```bash
118
- $ ievmsrb cmd "IE9 - Win7" 'tasklist'
119
- ```
82
+ * Install VirtualBox >= 5.0.4 at time of writing 5.0.6
120
83
 
84
+ * "IE9 - Win7" installed by ievms.sh and make sure its running
121
85
 
122
- Copy a file from the Windows Guest to a local path
123
- ```bash
124
- $ ievmsrb copy_from "IE9 - Win7" 'C:\Windows\System32\Drivers\Etc\hosts' ~/Desktop/hosts.win9
125
- ```
86
+ * [iectrl](https://github.com/xdissent/iectrl), cli interface for simple
126
87
 
127
- Turn of the Filewall executing a command as Administator
128
88
  ```bash
129
- $ ievmsrb cmd_adm "IE9 - Win7" 'NetSh Advfirewall set allprofiles state off'
89
+ $ npm install iectrl
90
+ $ echo 'PATH="$HOME/node_modules/.bin:$PATH"' >> ~/.profile
91
+ $ source ~/.Provider
130
92
  ```
131
93
 
132
- ## Contributing
133
- Please submit a new ticket if you want to report an issue.
134
- Merge requests are welcome. See issues with `Help Wanted` label.
135
-
136
- ### Testing
137
- To run the tests you need top fullfil the testing requirements first:
138
-
139
- * VirtualBox >= 5.0.4
140
- * "IE9 - Win7" installed by ievms.sh
141
94
  * Create an new virtual machine called `standbymachine`. Keep the disk size as
142
95
  small as possible. It should be turned off.
143
96
 
97
+ ```bash
98
+ VBoxManage createvm --name standbymachine --register
99
+ ```
100
+
101
+ * clone ievms-ruby
144
102
  ```
145
103
  git clone https://github.com/mipmip/ievms-ruby.git
146
104
  cd ievms-ruby
@@ -164,5 +122,3 @@ bundle exec rake
164
122
  - modern.IE - Provider of IE VM images.
165
123
  - virtualbox - Software for running Virtual Machines
166
124
  - shields.io - Creates the beautiful Windows Badges
167
-
168
-
@@ -0,0 +1,56 @@
1
+ # CLI util ievmsrb
2
+
3
+ The gem ievms-ruby comes with a CLI program calles ievmsrb. This
4
+ utility makes controlling virtual windows machines more easily is they
5
+ are setup with ievms.
6
+
7
+ ## Installing ievmsrb
8
+ Install the Gem on your system:
9
+
10
+ $ gem install ievms-ruby
11
+
12
+ After installation you can use the `ievmsrb` cli program.
13
+
14
+ ## Usage
15
+ Here's the output of `ievmsrb help`
16
+
17
+ ```bash
18
+ $ ievmsrb help
19
+
20
+ Commands:
21
+ ievmsrb cat [vbox name] [file path] # cat file from path in Win vbox
22
+ ievmsrb cmd [vbox name] [command to execute] # Run command with cmd.exe in Win vbox
23
+ ievmsrb cmd_adm [vbox name] [command to execute] # Run command as Administrator with cmd.exe in Win vbox
24
+ ievmsrb copy_from [vbox name] [path in vbox] [local file] # Copy file from Win vbox to local path
25
+ ievmsrb copy_to [vbox name] [local file] [path in vbox] # Copy local file to Win vbox
26
+ ievmsrb copy_to_as_adm [vbox name] [local file] [path in vbox] # Copy local file to Win vbox as Administrator
27
+ ievmsrb help [COMMAND] # Describe available commands or one specific command
28
+ ievmsrb ps [vbox name] # Show running tasks in Win vbox
29
+ ievmsrb reboot [vbox name] # Reboot Win box
30
+ ievmsrb shutdown [vbox name] # Shutdown Win vbox
31
+ ```
32
+
33
+ ## Some ievmsrb examples
34
+
35
+ Display the contents of a guest file.
36
+ ```bash
37
+ $ ievmsrb cat "IE9 - Win7" 'C:\Windows\System32\Drivers\Etc\hosts'
38
+ ```
39
+
40
+
41
+ Execute a cmd on the guestmachine and show the output
42
+ ```bash
43
+ $ ievmsrb cmd "IE9 - Win7" 'tasklist'
44
+ ```
45
+
46
+
47
+ Copy a file from the Windows Guest to a local path
48
+ ```bash
49
+ $ ievmsrb copy_from "IE9 - Win7" 'C:\Windows\System32\Drivers\Etc\hosts' ~/Desktop/hosts.win9
50
+ ```
51
+
52
+ Turn of the Filewall executing a command as Administator
53
+ ```bash
54
+ $ ievmsrb cmd_adm "IE9 - Win7" 'NetSh Advfirewall set allprofiles state off'
55
+ ```
56
+
@@ -0,0 +1,15 @@
1
+ # Welcome to ievms-ruby
2
+
3
+ Ievms-ruby is a Ruby interface for Windows boxes made by
4
+ [ievms.sh](https://github.com/xdissent/ievms). It helps you to provision
5
+ your IE boxes from [modern.ie](https://modern.ie), but also great to use
6
+ as CLI program to fire commands to a Windows machine without leaving
7
+ your terminal.
8
+
9
+ Here you can find all ievms-ruby documentation along with example scripts.
10
+
11
+ If you'd like to fork ievms-ruby, see
12
+ [http://github.com/mipmip/ievms-ruby](http://github.com/mipmip/ievms-ruby)
13
+
14
+
15
+ ![image](http://picdrop.t3lab.com/8I3tMPLniI.png)
@@ -0,0 +1,29 @@
1
+ # Ievms-ruby Library
2
+
3
+ Use ievms-ruby as library to create provisioning scripts for ievms
4
+ windows boxes. To examplain how to use ievms-ruby we have created some
5
+ example scripts. But first you need to know how to use ievms-ruby in
6
+ your project.
7
+
8
+ ## Install ievms-ruby gem
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'ievms-ruby'
14
+ ```
15
+
16
+ run `bundle install` or `bunde install --path vendor`. If you're
17
+ creating a standalone executable put these lines at on top of your script:
18
+
19
+ ```ruby
20
+ #!/usr/bin/env ruby
21
+
22
+ require 'rubygems'
23
+ require 'bundler/setup'
24
+ require 'ievms/windows_guest'
25
+ ```
26
+
27
+ Now you can use the ievms-ruby API. Have a look at the
28
+ [provisioning examples](provisioning_examples/) how.
29
+
@@ -0,0 +1,43 @@
1
+ # Provisioning examples
2
+
3
+ Here you can find usable example provisioning scripts.
4
+
5
+ ## Auto install Chocolatey and git-for-windows
6
+
7
+ provisioning script using the Gem. It installs [Chocolatey](https://chocolatey.org), Ruby, and [git-for-windows](https://git-for-windows.github.io) without user interaction needed.
8
+
9
+
10
+ ```ruby
11
+ #!/usr/bin/env ruby
12
+ require 'rubygems'
13
+ require 'bundler/setup'
14
+ require 'ievms/windows_guest'
15
+
16
+ class ProvisionIE
17
+
18
+ # Create interface for the 'IE9 - Win7' virtual box
19
+ def init
20
+ @machine = Ievms::WindowsGuest.new 'IE9 - Win7'
21
+ end
22
+
23
+ # Install the choco package manager (APT for Windows)
24
+ def install_chocolatey
25
+ print "Installing Chocolatey\n"
26
+ choco_install_cmd = '@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString(\'https://chocolatey.org/install.ps1\'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin '
27
+ @machine.run_command_as_admin(choco_install_cmd)
28
+ end
29
+
30
+ # Install ruby and git stuff, the reason why we wrote ievms-ruby
31
+ def install_ruby_and_git
32
+ %w( ruby msysgit ).each do |pkg|
33
+ @machine.run_command_as_admin "c:\\ProgramData\\chocolatey\\bin\\choco "\
34
+ "install -y #{pkg}"
35
+ end
36
+ end
37
+ end
38
+
39
+ provision = ProvisionIE.new
40
+ provision.init
41
+ provision.install_chocolatey
42
+ provision.install_ruby_and_git
43
+ ```
@@ -1,4 +1,6 @@
1
1
  class IevmsRb < Thor
2
+ class_option :verbose, :desc => 'Be more verbose', :type => :boolean, :aliases => '-v'
3
+ class_option :timeout, :desc => 'Timeout in seconds', :type => :numeric
2
4
 
3
5
  desc "cat [vbox name] [file path]", "cat file from path in Win vbox"
4
6
  def cat(vbox_name,guest_path)
@@ -61,6 +63,9 @@ class IevmsRb < Thor
61
63
 
62
64
  def init vbox_name
63
65
  @machine = Ievms::WindowsGuest.new vbox_name
66
+ #@machine.methods.sort
67
+ @machine.verbose = true if options[:verbose]
68
+ @machine.timeout_secs = options[:timeout] if options[:timeout]
64
69
  end
65
70
  end
66
71
 
@@ -1,3 +1,3 @@
1
1
  module Ievms
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -2,6 +2,7 @@ require "ievms/version"
2
2
  require 'open3'
3
3
  require 'fileutils'
4
4
  require 'tempfile'
5
+ require 'timeout'
5
6
 
6
7
  # VM admin username
7
8
  USERNAME = 'IEUser'
@@ -15,10 +16,13 @@ IEVMS_HOME = ENV['HOME']+'/.ievms'
15
16
  module Ievms
16
17
  class WindowsGuest
17
18
  attr_accessor :verbose
18
-
19
- @verbose = false
19
+ attr_accessor :timeout_secs
20
20
 
21
21
  def initialize(vbox_name)
22
+
23
+ @verbose = false
24
+ @timeout_secs = 600 #default timeout for a single task 5 minutes
25
+
22
26
  @vbox_name = vbox_name
23
27
 
24
28
  is_vm vbox_name
@@ -90,16 +94,19 @@ module Ievms
90
94
 
91
95
  upload_string_as_file_to_guest(command, 'C:\Users\IEUser\ievms.bat', true)
92
96
 
93
- guestcontrol_exec "schtasks.exe", "schtasks.exe /run /tn ievms"
97
+ _ = Timeout::timeout(@timeout_secs) {
94
98
 
95
- unless quiet
96
- print "..."
97
- while schtasks_query_ievms.include? 'Running'
98
- print "."
99
- sleep 2
99
+ guestcontrol_exec "schtasks.exe", "schtasks.exe /run /tn ievms"
100
+
101
+ unless quiet
102
+ print "..."
103
+ while schtasks_query_ievms.include? 'Running'
104
+ print "."
105
+ sleep 1
106
+ end
107
+ print "\n"
100
108
  end
101
- print "\n"
102
- end
109
+ }
103
110
 
104
111
  end
105
112
 
@@ -124,10 +131,16 @@ module Ievms
124
131
  # execute final guest control shell cmd
125
132
  # returns [stdout,stderr,status] from capture3
126
133
  def guestcontrol_exec(image, cmd)
127
- wait_for_guestcontrol(@vbox_name)
128
- cmd = "VBoxManage guestcontrol \"#{@vbox_name}\" run --username \"#{USERNAME}\" --password '#{PASSWD}' --exe \"#{image}\" -- #{cmd}"
129
- # print cmd + "\n"
130
- return Open3.capture3(cmd)
134
+
135
+ _ = Timeout::timeout(@timeout_secs) {
136
+ wait_for_guestcontrol(@vbox_name)
137
+ cmd = "VBoxManage guestcontrol \"#{@vbox_name}\" run --username \"#{USERNAME}\" --password '#{PASSWD}' --exe \"#{image}\" -- #{cmd}"
138
+
139
+ log_stdout cmd, false if @verbose
140
+
141
+ return Open3.capture3(cmd)
142
+ }
143
+
131
144
  end
132
145
 
133
146
  # function taken from ievms
@@ -0,0 +1,21 @@
1
+ site_name: 'Ievms-ruby'
2
+ pages:
3
+ - [index.md, Home]
4
+ - [cli.md, ievmsrb (CLI)]
5
+ - [library.md, Ievms-ruby library]
6
+ - [provisioning_examples.md, Provisioning Examples]
7
+ theme: readthedocs
8
+ #theme: cerulean
9
+ #theme: amelia
10
+ #theme: bootstrap
11
+ #theme: cosmo
12
+ #theme: cyborg
13
+ #theme: flatly
14
+ #theme: journal
15
+ #theme: mkdocs
16
+ #theme: readable
17
+ #theme: simplex
18
+ #theme: slate
19
+ #theme: spacelab
20
+ #theme: united
21
+ #theme: yeti
@@ -1,6 +1,5 @@
1
1
  require 'simplecov'
2
2
 
3
-
4
3
  SimpleCov.start do
5
4
  add_filter '/test/'
6
5
  add_filter '/vendor/'
@@ -13,3 +12,29 @@ require 'minitest/pride'
13
12
 
14
13
  require "codeclimate-test-reporter"
15
14
  CodeClimate::TestReporter.start
15
+
16
+ module IevmsRubyTestsShared
17
+
18
+ def initialize(name = nil)
19
+ print "Running test case: #{name}\n"
20
+ @test_name = name
21
+ super(name) unless name.nil?
22
+ end
23
+
24
+ def ensure_machine_running vbox_name
25
+
26
+ iectrl = `iectrl status "#{vbox_name}"`
27
+ if not iectrl.include?('RUNNING')
28
+ iectrl = `iectrl start "#{vbox_name}"`
29
+ sleep 5
30
+ iectrl = `iectrl status "#{vbox_name}"`
31
+ if not iectrl.include?('RUNNING')
32
+ iectrl = `VBoxManage startvm --type headless "#{vbox_name}"`
33
+ sleep 5
34
+ end
35
+
36
+ IevmsRb.start(['ps', "IE9 - Win7"])
37
+ end
38
+
39
+ end
40
+ end
@@ -5,16 +5,17 @@ require 'ievms/windows_guest'
5
5
  require 'timeout'
6
6
 
7
7
  class TestWin7 < Minitest::Test
8
+ include IevmsRubyTestsShared
9
+
10
+
8
11
  def setup
9
- iectrl = `iectrl status "IE9 - Win7"`
10
- if not iectrl.include?('RUNNING')
11
- iectrl = `iectrl start "IE9 - Win7"`
12
- sleep 5
13
- IevmsRb.start(['ps', "IE9 - Win7"])
14
- end
12
+ ensure_machine_running("IE9 - Win7")
15
13
  end
16
14
 
17
- def test_non_existing_guest
15
+ def test_timeout_option
16
+ assert_raises {
17
+ run_capture(["cmd", "IE9 - Win7", "ping 127.0.0.1 -n 6 > nul", "--verbose", "--timeout", "3" ])
18
+ }
18
19
  end
19
20
 
20
21
  def test_ps
@@ -42,7 +43,6 @@ class TestWin7 < Minitest::Test
42
43
  out2 = run_capture ['cat',"IE9 - Win7", 'C:\Users\IEUser\ievms_test_upload3.txt']
43
44
  assert_equal "[IE9 - Win7] Copying /tmp/ievms_test_upload3.txt to C:\\Users\\IEUser\\ievms_test_upload3.txt\n", out
44
45
  assert_match(/uploadasadmin_yes/, out2)
45
-
46
46
  end
47
47
 
48
48
  def test_copy_to_as_adm
@@ -54,7 +54,6 @@ class TestWin7 < Minitest::Test
54
54
  out2 = run_capture ['cat',"IE9 - Win7", 'C:\ievms_test_upload2.txt']
55
55
  assert_equal "[IE9 - Win7] Copying /tmp/ievms_test_upload2.txt to C:\\ievms_test_upload2.txt as Administrator\n", out
56
56
  assert_match(/uploadasadmin_yes/, out2)
57
-
58
57
  end
59
58
 
60
59
  def test_reboot
@@ -3,15 +3,11 @@ require 'ievms/windows_guest'
3
3
  require 'timeout'
4
4
 
5
5
  class TestWin7 < Minitest::Test
6
- def setup
7
6
 
8
- iectrl = `iectrl status "IE9 - Win7"`
9
- if not iectrl.include?('RUNNING')
10
- iectrl = `iectrl start "IE9 - Win7"`
11
- sleep 5
12
- IevmsRb.start(['ps', "IE9 - Win7"])
13
- end
7
+ include IevmsRubyTestsShared
14
8
 
9
+ def setup
10
+ ensure_machine_running("IE9 - Win7")
15
11
  @machine = Ievms::WindowsGuest.new 'IE9 - Win7'
16
12
  end
17
13
 
@@ -33,10 +29,28 @@ class TestWin7 < Minitest::Test
33
29
 
34
30
  end
35
31
 
32
+ def test_long_cmd
33
+ @machine.run_command 'ping 127.0.0.1 -n 6 > nul'
34
+ end
35
+
36
36
  def test_long_admin_cmd
37
37
  @machine.run_command_as_admin 'ping 127.0.0.1 -n 6 > nul'
38
38
  end
39
39
 
40
+ def test_long_cmd_timeout
41
+ @machine.timeout_secs = 3
42
+ assert_raises {
43
+ @machine.run_command 'ping 127.0.0.1 -n 6 > nul'
44
+ }
45
+ end
46
+
47
+ def test_long_admin_cmd_timeout
48
+ @machine.timeout_secs = 3
49
+ assert_raises {
50
+ @machine.run_command_as_admin 'ping 127.0.0.1 -n 6 > nul'
51
+ }
52
+ end
53
+
40
54
  def test_upload_string_as_file
41
55
  @machine.run_command 'if exist C:\Users\IEUser\testfile.txt del C:\Users\IEUser\testfile.txt && Exit'
42
56
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ievms-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pim Snel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,10 +94,15 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - bin/ievmsrb
97
+ - docs/cli.md
98
+ - docs/index.md
99
+ - docs/library.md
100
+ - docs/provisioning_examples.md
97
101
  - ievms-ruby.gemspec
98
102
  - lib/ievms/ievms_cli.rb
99
103
  - lib/ievms/version.rb
100
104
  - lib/ievms/windows_guest.rb
105
+ - mkdocs.yml
101
106
  - test/_test.bat
102
107
  - test/_test_as_admin.bat
103
108
  - test/test_helper.rb