Sha256: 5fbb021465c865439dc26a84f57b6d86f28056f06f6c9720e5f83f87b14d5f86

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 KB

Contents

module VagrantPlugins
  module Invade
    module Builder
      module Provision

        require 'erubis'

        class Shell

          attr_reader :result
          attr_accessor :machine_name, :shell_inline_data

          def initialize(machine_name, shell_inline_data, result: nil)
            @machine_name = machine_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_data['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

11 entries across 11 versions & 1 rubygems

Version Path
vagrant-invade-0.4.4 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.3 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.2 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.1 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.0 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.4.0.pre.alpha lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.3.4 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.3.3 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.3.2 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.3.0 lib/vagrant-invade/builder/provision/shell_inline.rb
vagrant-invade-0.2.0 lib/vagrant-invade/builder/provision/shell_inline.rb