vixen 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/vixen +4 -0
- data/lib/vixen/command_line.rb +44 -0
- data/vixen.gemspec +6 -2
- metadata +5 -2
data/bin/vixen
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'vixen'
|
2
|
+
|
3
|
+
class Vixen::CommandLine
|
4
|
+
attr_reader :start
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@start = Time.now
|
8
|
+
end
|
9
|
+
|
10
|
+
def elapsed_time
|
11
|
+
"[%s]" % (Time.at(Time.now - start).utc.strftime '%T')
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
host = Vixen.local_connect
|
16
|
+
|
17
|
+
vms = host.paths_of_running_vms do |job_handle, event_type, more_event_info, client_data|
|
18
|
+
if event_type == Vixen::Constants::VixEventType[:find_item]
|
19
|
+
path = Vixen::Bridge.get_string_property more_event_info, Vixen::Constants::VixPropertyId[:found_item_location]
|
20
|
+
if path
|
21
|
+
new_line_after { print File.basename path }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if vms.empty?
|
27
|
+
new_line_after { print "No running virtual machines" }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def new_line_after
|
32
|
+
val = yield if block_given?
|
33
|
+
puts
|
34
|
+
val
|
35
|
+
end
|
36
|
+
|
37
|
+
def print(message, *args)
|
38
|
+
timed_message = "#{elapsed_time} " + message
|
39
|
+
$stdout.print timed_message, args
|
40
|
+
$stdout.flush
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
end
|
data/vixen.gemspec
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'vixen'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.9'
|
4
|
+
s.date = '2012-11-20'
|
5
|
+
|
6
|
+
|
4
7
|
s.summary = 'Ruby bindings for VMware VIX API'
|
5
8
|
s.description = <<-EOF
|
6
9
|
Vixen is an easy way to interact with VMware virtual machines from Ruby.
|
@@ -9,7 +12,8 @@ Gem::Specification.new do |s|
|
|
9
12
|
EOF
|
10
13
|
s.author = 'Jeff Weiss'
|
11
14
|
s.email = 'vixen-gem@jeffweiss.org'
|
12
|
-
s.
|
15
|
+
s.executables = ['vixen']
|
16
|
+
s.files = ['bin/vixen'] + (`git ls-files`.split("\n"))
|
13
17
|
s.require_paths = ['lib']
|
14
18
|
s.platform = Gem::Platform::RUBY
|
15
19
|
s.homepage = "https://github.com/jeffweiss/vixen"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vixen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -46,10 +46,12 @@ dependencies:
|
|
46
46
|
description: ! " Vixen is an easy way to interact with VMware virtual machines from
|
47
47
|
Ruby. \n\n Vixen is not affliated with or endorsed by VMware.\n"
|
48
48
|
email: vixen-gem@jeffweiss.org
|
49
|
-
executables:
|
49
|
+
executables:
|
50
|
+
- vixen
|
50
51
|
extensions: []
|
51
52
|
extra_rdoc_files: []
|
52
53
|
files:
|
54
|
+
- bin/vixen
|
53
55
|
- .gitignore
|
54
56
|
- Gemfile
|
55
57
|
- LICENSE
|
@@ -60,6 +62,7 @@ files:
|
|
60
62
|
- ext/linux/x86_64/libvixAllProducts.so
|
61
63
|
- lib/vixen.rb
|
62
64
|
- lib/vixen/bridge.rb
|
65
|
+
- lib/vixen/command_line.rb
|
63
66
|
- lib/vixen/constants.rb
|
64
67
|
- lib/vixen/model/base.rb
|
65
68
|
- lib/vixen/model/host.rb
|