Class: Vagrant::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Vagrant::RakeTask
- Includes:
- DaptivChefCI::RakeTaskHelpers, Rake::DSL
- Defined in:
- lib/daptiv-chef-ci/vagrant_task.rb
Overview
Example usage, creates a vmware base box:
Vagrant::RakeTask.new ‘vagrant_fusion’ do |t|
t.provider = :vmware_fusion
t.create_box = true
t.box_name = 'windows-server-vmwarefusion.box'
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
-
#box_name ⇒ Object
Returns the value of attribute box_name.
-
#create_box ⇒ Object
Returns the value of attribute create_box.
-
#destroy_retry_attempts ⇒ Object
Returns the value of attribute destroy_retry_attempts.
-
#destroy_timeout_in_seconds ⇒ Object
Returns the value of attribute destroy_timeout_in_seconds.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#halt_retry_attempts ⇒ Object
Returns the value of attribute halt_retry_attempts.
-
#halt_timeout_in_seconds ⇒ Object
Returns the value of attribute halt_timeout_in_seconds.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#up_timeout_in_seconds ⇒ Object
Returns the value of attribute up_timeout_in_seconds.
-
#vagrant_driver ⇒ Object
writeonly
Sets the attribute vagrant_driver.
-
#vagrantfile_dir ⇒ Object
Returns the value of attribute vagrantfile_dir.
Instance Method Summary collapse
-
#initialize(name = 'vagrant', desc = 'Vagrant up, halt, destroy, package task') {|_self| ... } ⇒ RakeTask
constructor
A new instance of RakeTask.
Methods included from DaptivChefCI::RakeTaskHelpers
#execute, #exit_on_failure, #exit_on_failure=
Constructor Details
#initialize(name = 'vagrant', desc = 'Vagrant up, halt, destroy, package task') {|_self| ... } ⇒ RakeTask
Returns a new instance of RakeTask.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 40 def initialize(name = 'vagrant', desc = 'Vagrant up, halt, destroy, package task') @name, @desc = name, desc @provider = :virtualbox @create_box = false @vagrantfile_dir = Dir.pwd @box_name = nil @up_timeout_in_seconds = 7200 @halt_timeout_in_seconds = 180 @destroy_timeout_in_seconds = 180 @destroy_retry_attempts = 2 @halt_retry_attempts = 2 @environment = {} yield self if block_given? define_task end |
Instance Attribute Details
#box_name ⇒ Object
Returns the value of attribute box_name.
29 30 31 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 29 def box_name @box_name end |
#create_box ⇒ Object
Returns the value of attribute create_box.
27 28 29 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 27 def create_box @create_box end |
#destroy_retry_attempts ⇒ Object
Returns the value of attribute destroy_retry_attempts.
33 34 35 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 33 def destroy_retry_attempts @destroy_retry_attempts end |
#destroy_timeout_in_seconds ⇒ Object
Returns the value of attribute destroy_timeout_in_seconds.
32 33 34 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 32 def destroy_timeout_in_seconds @destroy_timeout_in_seconds end |
#environment ⇒ Object
Returns the value of attribute environment.
35 36 37 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 35 def environment @environment end |
#halt_retry_attempts ⇒ Object
Returns the value of attribute halt_retry_attempts.
34 35 36 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 34 def halt_retry_attempts @halt_retry_attempts end |
#halt_timeout_in_seconds ⇒ Object
Returns the value of attribute halt_timeout_in_seconds.
31 32 33 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 31 def halt_timeout_in_seconds @halt_timeout_in_seconds end |
#provider ⇒ Object
Returns the value of attribute provider.
26 27 28 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 26 def provider @provider end |
#up_timeout_in_seconds ⇒ Object
Returns the value of attribute up_timeout_in_seconds.
30 31 32 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 30 def up_timeout_in_seconds @up_timeout_in_seconds end |
#vagrant_driver=(value) ⇒ Object
Sets the attribute vagrant_driver
25 26 27 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 25 def vagrant_driver=(value) @vagrant_driver = value end |
#vagrantfile_dir ⇒ Object
Returns the value of attribute vagrantfile_dir.
28 29 30 |
# File 'lib/daptiv-chef-ci/vagrant_task.rb', line 28 def vagrantfile_dir @vagrantfile_dir end |