Sha256: 09119b9600d398ac344d162ed1fac3a86e325d497f70618ed8f9150dfadc4c0f

Contents?: true

Size: 1.19 KB

Versions: 10

Compression:

Stored size: 1.19 KB

Contents

module VagrantPlugins
  module Invade
    module Builder
      module Provision

        require 'erubis'

        class ShellInline

          attr_reader :result
          attr_accessor :machine_name, :name, :shell_inline_data

          def initialize(machine_name, name, shell_inline_data, result: nil)
            @machine_name = machine_name
            @shell_inline_name = name
            @shell_inline_data = shell_inline_data
            @result = result
          end

          def build
            b = binding
            template_file = "#{TEMPLATE_PATH}/provision/shell_inline.erb"

            begin

              # Get machine name
              machine_name = @machine_name

              # Values for shell provision section
              name = @shell_inline_name
              inline = @shell_inline_data['inline']
              binary = @shell_inline_data['binary']
              privileged = @shell_inline_data['privileged']

              eruby = Erubis::Eruby.new(File.read(template_file))
              @result = eruby.result b
            rescue TypeError, SyntaxError, SystemCallError => e
              raise(e)
            end
          end
        end

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vagrant-invade-0.5.5 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.5.4 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.5.3 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.5.2 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.5.1 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.5.0 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.8 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.7 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.6 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.5 lib/vagrant-invade/builder/provision/shell_inline.rb