Class: SpatulaProvisioner

Inherits:
Vagrant::Provisioners::Base
  • Object
show all
Defined in:
lib/vagrant/spatula.rb

Defined Under Namespace

Classes: Config

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#provision!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vagrant/spatula.rb', line 8

def provision!
  @spatula_path = ENV["PATH"].
    split(File::PATH_SEPARATOR).
    map { |x| File.join(x, "spatula") }.
    select { |x| File.executable?(x) }

  @spatula_path = @spatula_path[0] rescue nil

  raise "Cannot find spatula: gem install spatula" unless @spatula_path

  extra_args = %W[--port #{vm.ssh.port} --identity #{config.top.ssh.private_key_path}]

  args = [@spatula_path] + %w[prepare vagrant@localhost] + extra_args
  system(*args)

  args = [@spatula_path] + %W[cook vagrant@localhost #{config.node}] + extra_args
  system(*args)
end