Sha256: df4eb42f27e94f5ae4e0a5f35f25bd7870862e49105a1bba24f1678c01c213ec

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

module VagrantPlugins
  module Invade
    module Validator
      module Provision

        class Shell

          attr_accessor :env
          attr_accessor :shell

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

          def initialize(env, shell)
            @env = env
            @shell = Provision.validate_base(env, shell)
          end

          def validate
            return nil unless @shell

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

            # PATH (path to shell script or remote address to script file)
            @shell['path'] = Validator.validate_string(
              @shell['path'], 'path', DEFAULT['path']
            )

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

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

            @shell
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-invade-0.4.0.pre.alpha lib/vagrant-invade/validator/provision/shell.rb
vagrant-invade-0.3.4 lib/vagrant-invade/validator/provision/shell.rb
vagrant-invade-0.3.3 lib/vagrant-invade/validator/provision/shell.rb
vagrant-invade-0.3.2 lib/vagrant-invade/validator/provision/shell.rb
vagrant-invade-0.3.0 lib/vagrant-invade/validator/provision/shell.rb
vagrant-invade-0.2.0 lib/vagrant-invade/validator/provision/shell.rb