Sha256: 0385c44e0f6d52c1158e647b489d54038746dfaecb1537abe14beeeccab4b76e

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

module VagrantPlugins
  module Invade
    module Builder
      module Provision

        require 'erubis'

        class Shell

          attr_reader :result
          attr_accessor :machine_name, :shell_data

          def initialize(machine_name, shell_data, result: nil)
            @machine_name = machine_name
            @shell_data  = shell_data
            @result   = result
          end

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

            begin

              # Get machine name
              machine_name = @machine_name

              # Values for shell provision section
              name = @shell_data['name']
              path = @shell_data['path']
              binary = @shell_data['binary']
              privileged = @shell_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.rb
vagrant-invade-0.4.3 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.4.2 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.4.1 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.4.0 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.4.0.pre.alpha lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.3.4 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.3.3 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.3.2 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.3.0 lib/vagrant-invade/builder/provision/shell.rb
vagrant-invade-0.2.0 lib/vagrant-invade/builder/provision/shell.rb