Class: VagrantUp::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
DaptivChefCI::RakeTaskHelpers, Rake::DSL
Defined in:
lib/daptiv-chef-ci/vagrant_up_task.rb

Overview

Example usage, ups and provisions a Vagrant box without halting or destroying it.

VagrantUp::RakeTask.new ‘up’ do |t|

t.provider = :vmware_fusion
t.up_timeout_in_seconds = 3600
t.environment = { :ENV_VAR1 => 'val1', :ENV_VAR2 => 'val2' }

end

This class lets you define Rake tasks to drive Vagrant.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DaptivChefCI::RakeTaskHelpers

#execute, #exit_on_failure, #exit_on_failure=

Constructor Details

#initialize(name = 'vagrant_up', desc = 'Vagrant up task') {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Parameters:

  • name (String) (defaults to: 'vagrant_up')

    The task name.

  • desc (String) (defaults to: 'Vagrant up task')

    Description of the task.

  • provider (String)

    vagrant provider to use if other than the default virtualbox provider

Yields:

  • (_self)

Yield Parameters:



31
32
33
34
35
36
37
38
# File 'lib/daptiv-chef-ci/vagrant_up_task.rb', line 31

def initialize(name = 'vagrant_up', desc = 'Vagrant up task')
  @name, @desc = name, desc
  @provider = :virtualbox
  @up_timeout_in_seconds = 7200
  @environment = {}
  yield self if block_given?
  define_task
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment.



26
27
28
# File 'lib/daptiv-chef-ci/vagrant_up_task.rb', line 26

def environment
  @environment
end

#providerObject

Returns the value of attribute provider.



24
25
26
# File 'lib/daptiv-chef-ci/vagrant_up_task.rb', line 24

def provider
  @provider
end

#up_timeout_in_secondsObject

Returns the value of attribute up_timeout_in_seconds.



25
26
27
# File 'lib/daptiv-chef-ci/vagrant_up_task.rb', line 25

def up_timeout_in_seconds
  @up_timeout_in_seconds
end

#vagrant_driver=(value) ⇒ Object

Sets the attribute vagrant_driver

Parameters:

  • value

    the value to set the attribute vagrant_driver to.



23
24
25
# File 'lib/daptiv-chef-ci/vagrant_up_task.rb', line 23

def vagrant_driver=(value)
  @vagrant_driver = value
end