Sha256: 78fe73ea3d5d02478cfe4f31846a69431e515f83a71e48794f6215121f82946c

Contents?: true

Size: 934 Bytes

Versions: 21

Compression:

Stored size: 934 Bytes

Contents

module VagrantPlugins
  module Invade
    module Validator

      class VM

        attr_accessor :env
        attr_accessor :vm

        DEFAULT = {
          'box' => 'invade/default',
          'url' => nil,
          'hostname' => 'invade.vm'
        }

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

        def validate
          return DEFAULT unless @vm

          # BOX NAME (usually repository name of vm on Atlas (http://atlas.hashicorp.com))
          @vm['box'] = Validator.validate_string(
            @vm['box'], 'box', DEFAULT['box']
          )

          # BOX URL
          @vm['url'] = Validator.validate_string(
            @vm['url'], 'url', DEFAULT['url']
          )

          # BOX URL
          @vm['hostname'] = Validator.validate_string(
            @vm['hostname'], 'hostname', DEFAULT['hostname']
          )

          @vm
        end

      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
vagrant-invade-0.2.0 lib/vagrant-invade/validator/vm.rb