vmonkey 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 151ce3a9f5e0fd86c90160eeaeaeb86beb1c1ed2
4
- data.tar.gz: 76482a7d3c1ae75380e5a142e92f022b8e5b6fb2
3
+ metadata.gz: 73473f9859e69b977f39d70718c324209348f108
4
+ data.tar.gz: 918674b456eab8cd11cdfef9cb6a46b8b2d4e3dd
5
5
  SHA512:
6
- metadata.gz: f6f5c3793741a9b35673d528f5ebbedf5f4deb1bbb6c6aebfb06a0756c77401dc1ee1bdde6dcf0580715e3b7b56cc68f4e147fc619bffa5731823173b8476528
7
- data.tar.gz: afd7fa870b0a69de22aa4f84479740ae75f7dd71fab238656ef0e96182fb3206068316a2b034ae98c5becb6f641ce0a05b9845c543f650ab70398c624b57a4c4
6
+ metadata.gz: 41cd3ffe4dd03e1212eb4dac8f2b02db048f585528137f24869eb90656cdf113510656dc18455177013a75ae2ac139dbeb9257e0ff2a35d1195c7b2fdc25ced9
7
+ data.tar.gz: a7d9dd69f806cab2edb56ed01b4e8ce74587c33478ed902d40cbec8f7f1a6ac7f4f61b7b7c5fd943482a87fe8e7c23cab2ec92cefe7978d86622bd8f31368be9
@@ -1,3 +1,3 @@
1
1
  module Vmonkey
2
- VERSION = '0.11.0'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -25,4 +25,20 @@ class RbVmomi::VIM::Folder
25
25
  self.childEntity.grep(RbVmomi::VIM::VirtualMachine).select { |v| v.config.nil? || (v.config && !v.config.template) }
26
26
  end
27
27
 
28
+ def folder(path)
29
+ self.traverse path, RbVmomi::VIM::Folder
30
+ end
31
+
32
+ def folder!(path)
33
+ folder(path) || raise("Folder not found. [#{path}]")
34
+ end
35
+
36
+ def mk_folder(path)
37
+ self.traverse path, RbVmomi::VIM::Folder, true
38
+ end
39
+
40
+ def destroy
41
+ self.Destroy_Task.wait_for_completion
42
+ end
43
+
28
44
  end
data/spec/folder_spec.rb CHANGED
@@ -6,8 +6,50 @@ describe RbVmomi::VIM::Folder do
6
6
  @folder ||= @monkey.folder VM_SPEC_OPTS[:working_folder]
7
7
  end
8
8
 
9
- describe '#vm_pool' do
10
- subject { @folder.vm_pool }
11
- it { should_not be_nil }
9
+ # describe '#vm_pool' do
10
+ # subject { @folder.vm_pool }
11
+ # it { should_not be_nil }
12
+ # end
13
+
14
+ describe '#folder!' do
15
+ it 'should raise an error when the folder doesn\'t exist' do
16
+ expect { @folder.folder! 'not_here' }.to raise_error
17
+ end
18
+ end
19
+
20
+ describe '#folder' do
21
+ before :all do
22
+ @folder.mk_folder 'vmonkeytmp/tmp2'
23
+ end
24
+
25
+ it 'should find a folder by a single path element' do
26
+ expect(@folder.folder('vmonkeytmp')).to_not be_nil
27
+ expect(@folder.folder('vmonkeytmp').name).to eq('vmonkeytmp')
28
+ end
29
+
30
+ it 'should find a folder by a nested path' do
31
+ expect(@folder.folder('vmonkeytmp/tmp2')).to_not be_nil
32
+ expect(@folder.folder('vmonkeytmp/tmp2').name).to eq('tmp2')
33
+ end
34
+
35
+ after :all do
36
+ @folder.folder('vmonkeytmp').destroy
37
+ end
38
+ end
39
+
40
+ describe '#mk_folder' do
41
+ before :all do
42
+ @sub = @folder.mk_folder 'vmonkeytmp/tmp3'
43
+ end
44
+
45
+ it 'should create nested folders' do
46
+ expect(@folder.folder!('vmonkeytmp/tmp3').name).to eq('tmp3')
47
+ expect(@folder.folder!('vmonkeytmp/tmp3').parent.parent.name).to eq(@folder.name)
48
+ expect(@sub.name).to eq('tmp3')
49
+ end
50
+
51
+ after :all do
52
+ @folder.folder!('vmonkeytmp').destroy
53
+ end
12
54
  end
13
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmonkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dupras