Class: Builderator::Tasks::Vagrant

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/builderator/tasks/vagrant.rb

Instance Method Summary collapse

Constructor Details

#initialize(*_) ⇒ Vagrant

Returns a new instance of Vagrant.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/builderator/tasks/vagrant.rb', line 12

def initialize(*_)
  unless Gem.loaded_specs.key?('vagrant')
    say '!!! Vagrant is not available in this bundle !!!!', [:red, :bold]
    puts ''
    say 'Please add the following to your Gemfile and update your bundle to use the `vagrant` command:'
    say '  +------------------------------------------------+', :green
    say "  | gem 'vagrant', :github => 'mitchellh/vagrant', |", :green
    say "  |                :tag => 'v1.7.4'                |", :green
    say '  +------------------------------------------------+', :green

    exit 1
  end

  super
end

Instance Method Details

#destroy(*args) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/builderator/tasks/vagrant.rb', line 50

def destroy(*args)
  command = 'ulimit -n 1024;'
  command << ' VAGRANT_I_KNOW_WHAT_IM_DOING_PLEASE_BE_QUIET=true'
  command << " vagrant destroy #{ args.join(' ') }"
  command << ' -f' if options['force']

  run command
end

#provision(*args) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/builderator/tasks/vagrant.rb', line 39

def provision(*args)
  command = 'ulimit -n 1024;'
  command << ' VAGRANT_I_KNOW_WHAT_IM_DOING_PLEASE_BE_QUIET=true'
  command << " vagrant provision #{ args.join(' ') }"

  invoke Tasks::Berks, 'local', [], options
  run command
end

#rebuild(*args) ⇒ Object



60
61
62
63
# File 'lib/builderator/tasks/vagrant.rb', line 60

def rebuild(*args)
  invoke Tasks::Vagrant, 'destroy', args, options.merge('force' => true)
  invoke Tasks::Vagrant, 'up', args, options
end

#up(*args) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/builderator/tasks/vagrant.rb', line 29

def up(*args)
  command = 'ulimit -n 1024;'
  command << ' VAGRANT_I_KNOW_WHAT_IM_DOING_PLEASE_BE_QUIET=true'
  command << " vagrant up #{ args.join(' ') }"

  invoke Tasks::Berks, 'local', [], options
  run command
end