cuken 0.1.13 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/.rvmrc +61 -0
  2. data/Gemfile +17 -15
  3. data/Gemfile.lock +55 -63
  4. data/VERSION +1 -1
  5. data/cuken.gems +46 -0
  6. data/cuken.gemspec +85 -31
  7. data/features/about.md +4 -0
  8. data/features/avagrant_steps/vagrant_steps.feature +13 -0
  9. data/features/chef_examples/cookbooks_cookbook.feature +1 -1
  10. data/features/chef_examples/cookbooks_metadata.feature +5 -5
  11. data/features/chef_examples/cookbooks_repo.feature +1 -1
  12. data/features/chef_examples/knife_admin_client.feature +12 -12
  13. data/features/chef_examples/knife_client_create.feature +1 -1
  14. data/features/chef_examples/zenoss_example/01_chef_server_setup.feature +1 -1
  15. data/features/chef_examples/zenoss_example/02_monitor_vm_setup.feature +1 -1
  16. data/features/chef_steps/cookbook_steps.feature +6 -16
  17. data/features/command_examples/commands.feature +3 -3
  18. data/features/command_examples/exit_statuses.feature +49 -0
  19. data/features/command_examples/file_system_commands.feature +128 -0
  20. data/features/command_examples/flushing.feature +24 -0
  21. data/features/command_examples/interactive.feature +57 -0
  22. data/features/command_examples/no_clobber.feature +41 -0
  23. data/features/command_examples/output.feature +205 -0
  24. data/features/command_steps/command_steps.feature +49 -42
  25. data/features/file_examples/files.feature +5 -5
  26. data/features/git_examples/git_clone.feature +33 -0
  27. data/features/ssh_examples/ssh.feature +11 -2
  28. data/features/step_definitions/cuken_steps.rb +3 -2
  29. data/features/support/env.rb +2 -1
  30. data/lib/cuken/all.rb +1 -0
  31. data/lib/cuken/api/aruba/api.rb +342 -0
  32. data/lib/cuken/api/aruba/hooks.rb +63 -0
  33. data/lib/cuken/api/aruba/process.rb +74 -0
  34. data/lib/cuken/api/aruba.rb +5 -0
  35. data/lib/cuken/api/chef/common.rb +8 -1
  36. data/lib/cuken/api/chef/cookbook.rb +31 -5
  37. data/lib/cuken/api/chef/knife.rb +3 -3
  38. data/lib/cuken/api/chef/role.rb +3 -3
  39. data/lib/cuken/api/chef.rb +98 -9
  40. data/lib/cuken/api/cmd.rb +8 -8
  41. data/lib/cuken/api/common.rb +11 -23
  42. data/lib/cuken/api/file.rb +38 -38
  43. data/lib/cuken/api/git/clone.rb +25 -0
  44. data/lib/cuken/api/git/common.rb +37 -0
  45. data/lib/cuken/api/git/remote.rb +16 -0
  46. data/lib/cuken/api/git/repository.rb +62 -0
  47. data/lib/cuken/api/git.rb +69 -0
  48. data/lib/cuken/api/rvm/common.rb +10 -0
  49. data/lib/cuken/api/rvm/gemsets.rb +33 -0
  50. data/lib/cuken/api/rvm/wip.rb +554 -0
  51. data/lib/cuken/api/rvm.rb +25 -479
  52. data/lib/cuken/api/ssh.rb +85 -4
  53. data/lib/cuken/api/vagrant/common.rb +7 -4
  54. data/lib/cuken/api/vagrant/v_m.rb +2 -2
  55. data/lib/cuken/api/vagrant.rb +3 -3
  56. data/lib/cuken/common.rb +3 -1
  57. data/lib/cuken/cucumber/chef/common.rb +3 -3
  58. data/lib/cuken/cucumber/chef/cookbook/action.rb +81 -0
  59. data/lib/cuken/cucumber/chef/cookbook/local.rb +71 -0
  60. data/lib/cuken/cucumber/chef/cookbook/remote.rb +37 -0
  61. data/lib/cuken/cucumber/chef/cookbook.rb +3 -140
  62. data/lib/cuken/cucumber/chef/cookbook_steps.rb +1 -1
  63. data/lib/cuken/cucumber/chef/deploy_steps.rb +1 -1
  64. data/lib/cuken/cucumber/chef/done_directory_steps.rb +2 -2
  65. data/lib/cuken/cucumber/chef/done_file_steps.rb +5 -5
  66. data/lib/cuken/cucumber/chef/knife.rb +1 -1
  67. data/lib/cuken/cucumber/chef.rb +1 -1
  68. data/lib/cuken/cucumber/cmd/execution.rb +34 -0
  69. data/lib/cuken/cucumber/cmd/exit_status.rb +30 -0
  70. data/lib/cuken/cucumber/cmd.rb +2 -36
  71. data/lib/cuken/cucumber/common.rb +42 -6
  72. data/lib/cuken/cucumber/file.rb +42 -37
  73. data/lib/cuken/cucumber/git/clone.rb +51 -0
  74. data/lib/cuken/cucumber/git/common.rb +36 -0
  75. data/lib/cuken/cucumber/git/local.rb +19 -0
  76. data/lib/cuken/cucumber/git/remote.rb +22 -0
  77. data/lib/cuken/cucumber/git.rb +26 -0
  78. data/lib/cuken/cucumber/output/all.rb +41 -0
  79. data/lib/cuken/cucumber/output/cmd.rb +46 -0
  80. data/lib/cuken/cucumber/output/stderr.rb +33 -0
  81. data/lib/cuken/cucumber/output/stdout.rb +34 -0
  82. data/lib/cuken/cucumber/rvm/common.rb +0 -0
  83. data/lib/cuken/cucumber/rvm/gemsets.rb +32 -0
  84. data/lib/cuken/cucumber/rvm/hooks.rb +0 -0
  85. data/lib/cuken/cucumber/rvm.rb +3 -1
  86. data/lib/cuken/cucumber/ssh/common.rb +51 -0
  87. data/lib/cuken/cucumber/ssh.rb +3 -35
  88. data/lib/cuken/cucumber/vagrant.rb +1 -1
  89. data/lib/cuken/git.rb +21 -0
  90. data/spec/api/rvm/gemsets/api_spec.rb +41 -0
  91. data/spec/api/rvm/gemsets/helper_spec.rb +19 -0
  92. data/spec/api/rvm_spec.rb +63 -15
  93. data/spec/api/vagrant/v_m/Vagrantfile +82 -0
  94. data/spec/api/vagrant/v_m/api_spec.rb +37 -0
  95. data/spec/spec_helper.rb +39 -0
  96. metadata +123 -45
  97. data/spec/cuken_spec.rb +0 -7
@@ -0,0 +1,41 @@
1
+ require Pathname(__FILE__).ascend { |d| h=d+'spec_helper.rb'; break h if h.file? }
2
+ #Reference:
3
+ # http://www.metaskills.net/2010/07/30/the-rvm-ruby-api/
4
+ @announce = true
5
+ module ::Cuken::Api::Rvm
6
+
7
+ describe Gemsets do
8
+
9
+ before(:each) do
10
+ end
11
+
12
+ after(:all) do
13
+ end
14
+
15
+ context "#check_gemset_activation([gemset], true)" do
16
+ before(:all) do
17
+ current=`rvm current`
18
+ @rvm_rubie_now=current[/(.*)@/,1]
19
+ @rvm_gemset_now=current[/@(.*)/,1]
20
+ end
21
+
22
+ it "should confirm a given rubie and gemset is active" do
23
+ check_gemset_activation("#{@rvm_rubie_now}@#{@rvm_gemset_now}").should be_true
24
+ end
25
+
26
+ it "should confirm a given rubie and gemset is not active" do
27
+ check_gemset_activation("rvm_rubie@rvm_gemset", false).should be_false
28
+ end
29
+
30
+ it "should confirm a given rubie and gemset is present" do
31
+ check_gemset_presence(["=> #{@rvm_gemset_now}"]).should be_true
32
+ end
33
+
34
+ it "should confirm a given rubie and gemset is not present" do
35
+ check_gemset_presence(["rvm_gemset"], false).should be_false
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,19 @@
1
+ module ::Cuken
2
+ module Api
3
+
4
+ describe Rvm do
5
+
6
+ before(:all) do
7
+ include ::Cuken::Api::Rvm
8
+ end
9
+
10
+ describe ".current_name" do
11
+ it "should return the full rubie and gemset name" do
12
+ ::Cuken::Api::Rvm.current.expanded_name.should =~ /(.*)@(.*)/
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+
19
+ end
data/spec/api/rvm_spec.rb CHANGED
@@ -2,19 +2,22 @@ require Pathname(__FILE__).ascend { |d| h=d+'spec_helper.rb'; break h if h.file?
2
2
 
3
3
  #Reference:
4
4
  # http://www.metaskills.net/2010/07/30/the-rvm-ruby-api/
5
-
5
+ @announce = true
6
6
  module ::Cuken::Api
7
7
  describe Rvm do
8
8
  before(:all) do
9
9
  include ::Cuken::Api::Rvm
10
+ current=`rvm current`
11
+ @rvm_rubie_now=current[/(.*)@/,1]
12
+ @rvm_gemset_now=current[/@(.*)/,1]
10
13
  # ::FakeFS.activate!
11
14
  # ::FakeFS::FileSystem.clear
12
- @rvmrc_root = setup_rvmrc_gems_files(1)
13
- @rvmrc_file = Dir.glob(@rvmrc_root + '/**' + '/.rvmrc')[-1]
15
+ # @rvmrc_root = setup_rvmrc_gems_files(1)
16
+ # @rvmrc_file = Dir.glob(@rvmrc_root + '/**' + '/.rvmrc')[-1]
14
17
  end
15
18
  before(:each) do
16
19
  puts self.class
17
- @rvmrc_processor= ::Cuken::Api::Rvm::RvmrcProcessor.new(@rvmrc_file)
20
+ # @rvmrc_processor= ::Cuken::Api::Rvm::RvmrcProcessor.new(@rvmrc_file)
18
21
  end
19
22
  after(:all) do
20
23
  # ::FakeFS.deactivate!
@@ -27,10 +30,53 @@ module ::Cuken::Api
27
30
  # FakeFS { lambda{ ::B3::Bdd::Helpers.b3_setup}.should raise_error(RuntimeError, /Could not find BigBlueButton's sources root./) }
28
31
  # end
29
32
  # end
33
+ describe "run_simple_gemset" do
34
+ context "with no options given" do
35
+ it "should use the current rubie and gemset in the RVM environment " do
36
+ ::Cuken::Api::Rvm.run_simple_gemset( "puts 'x'" ).should match "#{`rvm current`}".strip
37
+ end
38
+ end
39
+ context "with rubie given" do
40
+ it "should use the current gemset in the RVM environment" do
41
+ current_env = `rvm current`
42
+ rubie = current_env[/(.*)@/,1]
43
+ ::Cuken::Api::Rvm.run_simple_gemset( "RVM.current.expanded_name.to_s", :ruby => rubie ).should match "#{`rvm current`}".strip
44
+ end
45
+ end
46
+ context "with gemset given" do
47
+ it "should use the current rubie in the RVM environment" do
48
+ current_env = `rvm current`
49
+ gs = current_env[/@(.*)/,1]
50
+ ::Cuken::Api::Rvm.run_simple_gemset( "RVM.current.expanded_name.to_s", :gemset => gs ).should match "#{`rvm current`}".strip
51
+ end
52
+ end
53
+ context "with any existing ruby and gemset given" do
54
+ it "should use the given rubie and gemset in the RVM environment" do
55
+ current_env = `rvm current`
56
+ curr_rubie = current_env[/(.*)@/,1]
57
+ rl = ::RVM.list_strings
58
+ rl.delete("=> #{curr_rubie}")
59
+ rl.shift(1)
60
+ rb = rl[rand(rl.size)]
61
+ gsl = ::RVM.list_gemsets.find_all{|g| /#{rb}/.match g}
62
+ rbgs = gsl[rand(gsl.size)]
63
+ rb, gs = rbgs.split('@')
64
+ #gs = gs.nil? ? 'default' : gs
65
+ rb = "ruby-1.9.2-p180"
66
+ gs = "bbb_bdd_sys_os"
67
+ cmd = <<-"EOT".gsub(/^ /,'')
68
+ #!/usr/bin/env ruby
69
+ puts "patchlevel: #{RUBY_PATCHLEVEL}, release_date: #{RUBY_RELEASE_DATE}, ruby_version: #{RUBY_VERSION}, ruby_platform: #{RUBY_PLATFORM}"
70
+ `echo "patchlevel: #{RUBY_PATCHLEVEL}, release_date: #{RUBY_RELEASE_DATE}, ruby_version: #{RUBY_VERSION}, ruby_platform: #{RUBY_PLATFORM}" >/tmp/this_is_it.txt`
71
+ EOT
30
72
 
31
- describe ".rvm_current_name" do
32
- it "should return the full rubie and gemset name" do
33
- ::Cuken::Api::Rvm.rvm_current_name.should =~ /ruby(.*)@(.*)/
73
+ lambda{::Cuken::Api::Rvm.run_simple_gemset( cmd, :ruby => rb, :gemset => gs )}.should_not raise_error
74
+ end
75
+ end
76
+ context "with any non-existing ruby and gemset given" do
77
+ it "should raise RuntimeError" do
78
+ lambda{::Cuken::Api::Rvm.run_simple_gemset( "never called", :ruby => 'more', :gemset => 'junk' )}.should raise_error ::ArgumentError, 'The RVM gemset more@junk is not present.'
79
+ end
34
80
  end
35
81
  end
36
82
 
@@ -101,7 +147,7 @@ module ::Cuken::Api
101
147
 
102
148
  context ".rvmrc_rubies without root path argument" do
103
149
  it "should return RVM Ruby names that exist in the .rvmrc files" do
104
- ::Cuken::Api::Rvm.rvm_install_rubies = {'ruby-1.9.2-p136' => {:alias => 'cuken192'}}
150
+ ::Cuken::Api::Rvm.rvm_install_rubies = { "#{@rvm_rubie_now}" => {:alias => 'cuken192'}}
105
151
  res = ::Cuken::Api::Rvm.rvmrc_rubies
106
152
  res.should have(1).item
107
153
  res.first.should have(2).items
@@ -118,10 +164,10 @@ module ::Cuken::Api
118
164
  FakeFS { lambda{ ::Cuken::Api::Rvm.rvm_rubies_setup}.should raise_error(RuntimeError, /RVM library not loaded./) }
119
165
  end
120
166
  it "should not install existing RVM rubies that exists in the .rvmrc files" do
121
- rvm_now=(`rvm current`)[/(.*)@/,1]
122
- mock(::RVM).install(rvm_now,{}).times(0){true}
167
+ pending
168
+ mock(::RVM).install( "ruby-1.9.2-p136",{}).times(0){true}
123
169
  mock(::RVM).alias_create.with(is_a(String),/@vagrant/).times(1) { true }
124
- ::Cuken::Api::Rvm.rvm_rubies_setup.should have(1).item
170
+ ::Cuken::Api::Rvm.rvm_rubies_setup.should be_instance_of Array
125
171
  end
126
172
  end
127
173
 
@@ -149,11 +195,13 @@ module ::Cuken::Api
149
195
 
150
196
  context ".rvmrc_gems_install when gem is not installed" do
151
197
  it "should install gems added to rvm_install_gemspecs" do
198
+ pending "NotImplementedError: super from singleton method that is defined to multiple classes is not supported; this will be fixed in 1.9.3 or later"
152
199
  FakeFS do
153
200
  root_path = setup_rvmrc_gems_files(8)
154
201
  ::Cuken::Api::Rvm.rvm_install_gemspecs << ['gem_a', '1.0.0']
155
202
  ::Cuken::Api::Rvm.rvm_install_gemspecs << ['gem_b', '2.0.0']
156
- mock(::RVM).use.with("ruby-1.9.2-p136").times(2){true}
203
+ mock(::RVM).use.with( "ruby-1.9.2-p136" ).times(2){stub!.successful?{true}}
204
+ mock(::RVM::Environment).rvm.with( :use, "ruby-1.9.2-p136" ).times(2){stub!.successful?{true}}
157
205
  #mock(::RVM).gemset.stub!.create.with(is_a(String)).times(9){true}
158
206
  mock(::RVM).gemset.times(27).stub!.use!.with(is_a(String)).times(27){true}
159
207
  # mock(::RVM).gemset_import.with(is_a(String)).times(8) { true }
@@ -173,12 +221,12 @@ module ::Cuken::Api
173
221
  ::Cuken::Api::Rvm.rvm_install_gemspecs << ['gem_a', '1.0.0']
174
222
  ::Cuken::Api::Rvm.rvm_install_gemspecs << ['gem_b', '2.0.0']
175
223
  stub(::RVM).use.verbose.with(is_a(String))
176
- #stub(::RVM).gemset.times(27).stub!.create.verbose.with(is_a(Array)).times(27){true}
177
- stub(::RVM).gemset.times(27).stub!.use.verbose.with(is_a(String)).times(27){true}
224
+ # this next mock times(45) is sensitive to run env. Run on its own it is times(27)
225
+ stub(::RVM).gemset.times(45).stub!.use.verbose.with(is_a(String)).times(0){true}
178
226
  # mock(::RVM).use.with(is_a(String)).times(1){true}
179
227
  # mock(::RVM).gemset_import.with(is_a(String)).times(8) { true }
180
228
  mock(::RVM).perform_set_operation.with(is_a(Symbol),is_a(String),is_a(String),is_a(String),is_a(String)).times(0){ stub!.stdout{ "some progress messages" } }
181
- mock(::RVM).ruby_eval.with(is_a(String)).times(27){ stub!.stdout{'true'}}
229
+ mock(::RVM).ruby_eval.with(is_a(String)).times(0){ stub!.stdout{'true'}}
182
230
  ::Cuken::Api::Rvm.rvmrc_gems_install(root_path).should be_true
183
231
  end
184
232
  end
@@ -0,0 +1,82 @@
1
+ Vagrant::Config.run do |config|
2
+ # All Vagrant configuration is done here. The most common configuration
3
+ # options are documented and commented below. For a complete reference,
4
+ # please see the online documentation at vagrantup.com.
5
+
6
+ # Every Vagrant virtual environment requires a box to build off of.
7
+ config.vm.box = "base"
8
+
9
+ # The url from where the 'config.vm.box' box will be fetched if it
10
+ # doesn't already exist on the user's system.
11
+ # config.vm.box_url = "http://domain.com/path/to/above.box"
12
+
13
+ # Boot with a GUI so you can see the screen. (Default is headless)
14
+ # config.vm.boot_mode = :gui
15
+
16
+ # Assign this VM to a host only network IP, allowing you to access it
17
+ # via the IP.
18
+ # config.vm.network "33.33.33.10"
19
+
20
+ # Forward a port from the guest to the host, which allows for outside
21
+ # computers to access the VM, whereas host only networking does not.
22
+ # config.vm.forward_port "http", 80, 8080
23
+
24
+ # Share an additional folder to the guest VM. The first argument is
25
+ # an identifier, the second is the path on the guest to mount the
26
+ # folder, and the third is the path on the host to the actual folder.
27
+ # config.vm.share_folder "v-data", "/vagrant_data", "../data"
28
+
29
+ # Enable provisioning with Puppet stand alone. Puppet manifests
30
+ # are contained in a directory path relative to this Vagrantfile.
31
+ # You will need to create the manifests directory and a manifest in
32
+ # the file base.pp in the manifests_path directory.
33
+ #
34
+ # An example Puppet manifest to provision the message of the day:
35
+ #
36
+ # # File { owner => 0, group => 0, mode => 0644 }
37
+ # #
38
+ # # file { '/etc/motd':
39
+ # # content => "Welcome to your Vagrant-built virtual machine!
40
+ # # Managed by Puppet.\n"
41
+ # # }
42
+ #
43
+ # config.vm.provision :puppet do |puppet|
44
+ # puppet.manifests_path = "manifests"
45
+ # puppet.manifest_file = "base.pp"
46
+ # end
47
+
48
+ # Enable provisioning with chef solo, specifying a cookbooks path (relative
49
+ # to this Vagrantfile), and adding some recipes and/or roles.
50
+ #
51
+ # config.vm.provision :chef_solo do |chef|
52
+ # chef.cookbooks_path = "cookbooks"
53
+ # chef.add_recipe "mysql"
54
+ # chef.add_role "web"
55
+ #
56
+ # # You may also specify custom JSON attributes:
57
+ # chef.json.merge!({ :mysql_password => "foo" })
58
+ # end
59
+
60
+ # Enable provisioning with chef server, specifying the chef server URL,
61
+ # and the path to the validation key (relative to this Vagrantfile).
62
+ #
63
+ # The Opscode Platform uses HTTPS. Substitute your organization for
64
+ # ORGNAME in the URL and validation key.
65
+ #
66
+ # If you have your own Chef Server, use the appropriate URL, which may be
67
+ # HTTP instead of HTTPS depending on your configuration. Also change the
68
+ # validation key to validation.pem.
69
+ #
70
+ # config.vm.provision :chef_server do |chef|
71
+ # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
72
+ # chef.validation_key_path = "ORGNAME-validator.pem"
73
+ # end
74
+ #
75
+ # If you're using the Opscode platform, your validator client is
76
+ # ORGNAME-validator, replacing ORGNAME with your organization name.
77
+ #
78
+ # IF you have your own Chef Server, the default validation client name is
79
+ # chef-validator, unless you changed the configuration.
80
+ #
81
+ # chef.validation_client_name = "ORGNAME-validator"
82
+ end
@@ -0,0 +1,37 @@
1
+ require Pathname(__FILE__).ascend { |d| h=d+'spec_helper.rb'; break h if h.file? }
2
+ @announce = true
3
+ module ::Cuken::Api::Vagrant
4
+
5
+ describe VM do
6
+
7
+ before(:each) do
8
+ end
9
+
10
+ after(:all) do
11
+ end
12
+
13
+ context "#state(name)" do
14
+ before(:all) do
15
+ in_dir do
16
+ puts Dir.getwd
17
+ File.open("Vagrantfile", "w") { |f| f << test_vagrantfile(['web','db']) }
18
+ @vagrant_vm = ::VagrantVMExampleHelpers.create_vm_instance('web')
19
+ end
20
+
21
+ end
22
+ after(:all) do
23
+ in_dir do
24
+ FileUtils.rm('Vagrantfile')
25
+ end
26
+ end
27
+
28
+ it "should confirm a non-existent VM is not running" do
29
+ in_dir do
30
+ @vagrant_vm.state(:web).should be_nil
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,15 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'bundler'
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
3
11
  require 'rspec'
12
+ #require 'cucumber'
4
13
  require 'stringio'
5
14
  require 'fakefs/safe'
6
15
  require 'fakefs/spec_helpers'
@@ -10,9 +19,11 @@ require 'chef/mixins'
10
19
  require 'chef/knife/configure'
11
20
  require 'chef/knife/client_create'
12
21
 
22
+ require 'cuken/api/aruba'
13
23
  require 'cuken/api/rvm'
14
24
  require 'cuken/api/chef'
15
25
  require 'cuken/api/chef/knife'
26
+ require 'cuken/api/vagrant'
16
27
 
17
28
  # Requires supporting files with custom matchers and macros, etc,
18
29
  # in ./support/ and its subdirectories.
@@ -22,6 +33,11 @@ RSpec.configure do |config|
22
33
 
23
34
  config.mock_with :rr
24
35
  include ::Cuken::Api::Chef
36
+ include ::Cuken::Api::Rvm
37
+ include ::Cuken::Api::Rvm::Gemsets
38
+ include ::Cuken::Api::Vagrant
39
+ include ::Vagrant::TestHelpers
40
+
25
41
  # or if that doesn't work due to a version incompatibility
26
42
  # config.mock_with RR::Adapters::Rspec
27
43
  end
@@ -65,4 +81,27 @@ def setup_rvmrc_gems_files(count)
65
81
  end
66
82
  root.to_s
67
83
  end
84
+ def test_vagrantfile(names=['web','db'])
85
+ %Q{
86
+ Vagrant::Config.run do |config|
87
+ config.vm.define :#{names[0]} do |config|
88
+ config.vm.box = "#{names[0]}"
89
+ config.vm.forward_port("http", 80, 8080)
90
+ end
68
91
 
92
+ config.vm.define :#{names[1]} do |cnfg|
93
+ cnfg.vm.box = "#{names[1]}"
94
+ cnfg.vm.forward_port("#{names[1]}", 3306, 3306)
95
+ end
96
+ end
97
+ }
98
+ end
99
+
100
+ class ::VagrantVMExampleHelpers
101
+ include ::Cuken::Api::Aruba::Api
102
+ include ::Cuken::Api::Vagrant::VM
103
+
104
+ def self.create_vm_instance(name)
105
+ new(name)
106
+ end
107
+ end