Sha256: 3903afc3ee86faf542293a2c512ac7ebfd8546215a342537355e9d687cecac0f

Contents?: true

Size: 1.47 KB

Versions: 15

Compression:

Stored size: 1.47 KB

Contents

module VagrantPlugins
  module Invade
    module Validator
      module Provision

        # (see: https://docs.vagrantup.com/v2/provisioning/shell.html)
        class ShellInline

          attr_accessor :env
          attr_accessor :shell_inline

          DEFAULT = {
            'name' => 'invade_shell_inline',
            'inline' => nil,
            'binary' => nil, # Vagrant default is true
            'privileged' => nil # Vagrant default is true
          }

          def initialize(env, shell_inline)
            @env = env
            @shell_inline = shell_inline
          end

          def validate
            return nil unless @shell_inline

            # NAME
            @shell_inline['name'] = Validator.validate_string(
              @shell_inline['name'], 'name', DEFAULT['name']
            )

            # INLINE SCRIPT
            @shell_inline['inline'] = Validator.validate_string(
              @shell_inline['inline'], 'inline', DEFAULT['inline']
            )

            # BINARY (replace windows newline endings with unix line endings)
            @shell_inline['binary'] = Validator.validate_boolean(
              @shell_inline['binary'], 'binary', DEFAULT['binary']
            )

            # PRIVILEGED (run with sudo)
            @shell_inline['privileged'] = Validator.validate_boolean(
              @shell_inline['privileged'], 'privileged', DEFAULT['privileged']
            )

            @shell_inline
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vagrant-invade-0.5.5 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.5.4 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.5.3 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.5.2 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.5.1 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.5.0 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.8 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.7 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.6 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.5 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.4 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.3 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.2 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.1 lib/vagrant-invade/validator/provision/shell_inline.rb
vagrant-invade-0.4.0 lib/vagrant-invade/validator/provision/shell_inline.rb