vagrant-screenshot 0.1 → 0.2
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.
data/lib/vagrant-screenshot.rb
CHANGED
@@ -3,14 +3,10 @@ module Vagrant
|
|
3
3
|
module Command
|
4
4
|
class ScreenshotCommand < Base
|
5
5
|
|
6
|
-
VBOX_MANAGE = 'VBoxManage'
|
7
|
-
|
8
6
|
def execute
|
9
7
|
options = {}
|
10
8
|
filenames = []
|
11
9
|
|
12
|
-
raise Errors::VBoxManageCommandNotFound if vbox_manage_command.empty?
|
13
|
-
|
14
10
|
opts = build_screenshot_options options
|
15
11
|
argv = parse_options(opts)
|
16
12
|
return if !argv
|
@@ -18,11 +14,11 @@ module Vagrant
|
|
18
14
|
vm_name = argv[0]
|
19
15
|
with_target_vms(vm_name) do |vm|
|
20
16
|
if vm.state != :running
|
21
|
-
notify "Skiping #{vm.name}. VM not running"
|
17
|
+
notify :warn, "Skiping #{vm.name}. VM not running"
|
22
18
|
else
|
23
|
-
notify "Taking screenshot for #{vm.name}"
|
19
|
+
notify :info, "Taking screenshot for #{vm.name}"
|
24
20
|
filename = create_output_filename vm.name
|
25
|
-
take_screenshot vm
|
21
|
+
take_screenshot vm, filename
|
26
22
|
filenames << filename
|
27
23
|
open_generated_files(filenames) if options[:open]
|
28
24
|
end
|
@@ -32,10 +28,6 @@ module Vagrant
|
|
32
28
|
|
33
29
|
protected
|
34
30
|
|
35
|
-
def vbox_manage_command
|
36
|
-
%x[which VBoxManage].chomp
|
37
|
-
end
|
38
|
-
|
39
31
|
def open_command
|
40
32
|
# Currently just Mac's 'open' command is supported, if it's
|
41
33
|
# not found the -o option is not provided
|
@@ -61,17 +53,17 @@ module Vagrant
|
|
61
53
|
"screenshot-#{vm_name}.png"
|
62
54
|
end
|
63
55
|
|
64
|
-
def take_screenshot(
|
65
|
-
|
66
|
-
notify "Screenshot saved on #{filename}"
|
56
|
+
def take_screenshot(vm, filename)
|
57
|
+
vm.driver.execute_command ["controlvm", vm.uuid, "screenshotpng", filename]
|
58
|
+
notify :success, "Screenshot saved on #{filename}"
|
67
59
|
end
|
68
60
|
|
69
61
|
def open_generated_files(filenames)
|
70
|
-
%x[
|
62
|
+
%x[#{open_command} #{filenames.join(' ')}]
|
71
63
|
end
|
72
64
|
|
73
|
-
def notify(msg)
|
74
|
-
|
65
|
+
def notify(level, msg)
|
66
|
+
@env.ui.send(level, msg)
|
75
67
|
end
|
76
68
|
|
77
69
|
end
|
data/lib/vagrant_init.rb
ADDED
data/vagrant-screenshot.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "vagrant-screenshot"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.2"
|
7
7
|
s.authors = ["Igor Sobreira"]
|
8
8
|
s.email = ["igor@igorsobreira.com"]
|
9
9
|
s.homepage = "https://github.com/igorsobreira/vagrant-screenshot"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-screenshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Vagrant plugin to take screenshots of VMs
|
15
15
|
email:
|
@@ -23,8 +23,8 @@ files:
|
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
25
|
- lib/vagrant-screenshot.rb
|
26
|
-
- lib/vagrant-screenshot/errors.rb
|
27
26
|
- lib/vagrant-screenshot/screenshot_command.rb
|
27
|
+
- lib/vagrant_init.rb
|
28
28
|
- vagrant-screenshot.gemspec
|
29
29
|
homepage: https://github.com/igorsobreira/vagrant-screenshot
|
30
30
|
licenses: []
|