Sha256: 133c6ce3b20fc626de5616b55b3926cf1bc7b3830a6695c5e9e8eb16a2597a46

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'vagrant-host-ruby-provisioner/info'

module VagrantPlugins
  module HostRubyProvisioner
    class Config < Vagrant.plugin '2', :config
      attr_accessor :clean
      attr_accessor :cwd
      attr_accessor :routine

      def initialize
        @clean   = UNSET_VALUE
        @cwd     = UNSET_VALUE
        @routine = UNSET_VALUE
      end

      def finalize!
        if @clean == UNSET_VALUE
          @clean = lambda {}
        end

        if @cwd == UNSET_VALUE
          @cwd = nil
        end
      end

      def validate machine
        errors  = _detected_errors
        results = {}

        if @routine == UNSET_VALUE
          errors << (I18n.t :'vagrant_host_ruby_provisioner.config.routine.required')
        elsif ! @routine.lambda?
          errors << (I18n.t :'vagrant_host_ruby_provisioner.config.routine.not_lambda')
        end

        if ! @clean.lambda?
          errors << (I18n.t :'vagrant_host_ruby_provisioner.config.clean.not_lambda')
        end

        results[HostRubyProvisioner::INFO[:name]] = errors

        results
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-host-ruby-provisioner-0.1.1 lib/vagrant-host-ruby-provisioner/config.rb
vagrant-host-ruby-provisioner-0.1.0 lib/vagrant-host-ruby-provisioner/config.rb
vagrant-host-ruby-provisioner-0.0.2 lib/vagrant-host-ruby-provisioner/config.rb