instalatron 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ Requirements:
2
+
3
+ VirtualBox 4.0.8
4
+ ImageMagick >= 6.6.4
data/bin/instalatron-play CHANGED
@@ -4,7 +4,7 @@ require 'instalatron'
4
4
  require 'yaml'
5
5
  require 'mixlib/cli'
6
6
 
7
- def play_session(vm_name, script, custom_seq = nil)
7
+ def play_session(vm_name, script, custom_seq = nil, key_press_delay = 0)
8
8
  ctrlc_gap = 0
9
9
  basedir = File.dirname(script)
10
10
  script = YAML.load_file(script)
@@ -21,7 +21,7 @@ def play_session(vm_name, script, custom_seq = nil)
21
21
  img = Instalatron.detect_screen(vm_name)
22
22
  if Instalatron.same_image?(ref_img, img)
23
23
  puts "Screen detected: #{screen[:name]}"
24
- Instalatron.command_window screen[:sequence], vm_name
24
+ Instalatron.command_window screen[:sequence], vm_name, key_press_delay
25
25
  break
26
26
  end
27
27
  rescue Interrupt, SystemExit
@@ -81,6 +81,16 @@ class MyCLI
81
81
  :long => "--destroy-vm",
82
82
  :description => "Destroy the VM after running the tests"
83
83
 
84
+ option :headless,
85
+ :long => "--headless",
86
+ :description => "Run the VMs without GUI",
87
+ :default => false
88
+
89
+ option :key_press_delay,
90
+ :long => "--key-press-delay SECS",
91
+ :description => "Delay between key presses",
92
+ :default => 0
93
+
84
94
  option :help,
85
95
  :short => "-h",
86
96
  :long => "--help",
@@ -115,10 +125,10 @@ if not File.exist?(iso_file)
115
125
  end
116
126
 
117
127
  # Create VBox VM first
118
- Instalatron.create_vm :vm_name => vm_name, :iso_file => iso_file
128
+ Instalatron.create_vm :vm_name => vm_name, :iso_file => iso_file, :headless => cli.config[:headless]
119
129
 
120
130
  puts "Playing script using VM #{vm_name}\n\n"
121
- play_session vm_name, script, cli.config[:custom_sequence]
131
+ play_session vm_name, script, cli.config[:custom_sequence], cli.config[:key_press_delay]
122
132
 
123
133
  if cli.config[:destroy_vm]
124
134
  puts "Unregistering and deleting VM #{vm_name}"
data/lib/instalatron.rb CHANGED
@@ -4,7 +4,7 @@ require 'virtualbox'
4
4
 
5
5
  module Instalatron
6
6
 
7
- VERSION = '0.1.2'
7
+ VERSION = '0.1.3'
8
8
 
9
9
  def self.destroy_vm(vm_name)
10
10
  `VBoxManage controlvm '#{vm_name}' poweroff > /dev/null 2>&1`
@@ -23,6 +23,10 @@ module Instalatron
23
23
  vboxcmd = params[:vboxcmd] || 'VBoxManage'
24
24
  vm_memory = params[:vm_memory] || 512
25
25
  vm_cpus = params[:vm_cpus] || 1
26
+ if params[:headless].nil?
27
+ params[:headless] = false
28
+ end
29
+ headless = params[:headless] ? 'headless':'gui'
26
30
  # listing os types
27
31
  # VirtualBox::Global.global.lib.virtualbox.guest_os_types.each do |os|
28
32
  # puts os.id
@@ -67,7 +71,7 @@ module Instalatron
67
71
 
68
72
  `#{vboxcmd} storageattach '#{vm_name}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '#{full_iso_file}' >/dev/null 2>&1`
69
73
 
70
- vm.start
74
+ vm.start headless
71
75
  end
72
76
 
73
77
  def self.command_window(seq, vm_name, key_press_delay = 0)
@@ -79,7 +83,7 @@ module Instalatron
79
83
  keycodes.split.each do |k|
80
84
  `VBoxManage controlvm #{vm_name} keyboardputscancode '#{k}' >/dev/null 2>&1`
81
85
  end
82
- #sleep key_press_delay
86
+ sleep key_press_delay.to_i
83
87
  end
84
88
  end
85
89
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instalatron
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sergio Rubio
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-08 00:00:00 Z
18
+ date: 2011-06-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -106,12 +106,12 @@ extensions: []
106
106
 
107
107
  extra_rdoc_files:
108
108
  - LICENSE.txt
109
- - README.rdoc
109
+ - README.md
110
110
  files:
111
111
  - .document
112
112
  - Gemfile
113
113
  - LICENSE.txt
114
- - README.rdoc
114
+ - README.md
115
115
  - Rakefile
116
116
  - bin/instalatron-changeterm
117
117
  - bin/instalatron-monitor
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = instalatron
2
-
3
- Description goes here.
4
-
5
- == Contributing to instalatron
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 Abiquo Inc. See LICENSE.txt for
18
- further details.
19
-