Sha256: 290fb403dcdd5fd5cb44f077414e6b7137d499f7ae2105930f1625f0aad74855

Contents?: true

Size: 1.41 KB

Versions: 10

Compression:

Stored size: 1.41 KB

Contents

require "vagrant"

module VagrantPlugins
  module Unison
    class Config < Vagrant.plugin("2", :config)
      # The access key ID for accessing AWS.
      #
      # @return [String]
      attr_accessor :host_folder

      # The ID of the AMI to use.
      #
      # @return [String]
      attr_accessor :guest_folder

      def initialize(region_specific=false)
        @host_folder      = UNSET_VALUE
        @remote_folder    = UNSET_VALUE
      end

      #-------------------------------------------------------------------
      # Internal methods.
      #-------------------------------------------------------------------

      # def merge(other)
      #   super.tap do |result|
      #     # TODO - do something sensible; current last config wins
      #     result.local_folder = other.local_folder
      #     result.remote_folder = other.remote_folder
      #   end
      # end

      def finalize!
        # The access keys default to nil
        @host_folder    = nil if @host_folder    == UNSET_VALUE
        @guest_folder   = nil if @guest_folder   == UNSET_VALUE

        # Mark that we finalized
        @__finalized = true
      end

      def validate(machine)
        errors = []

        errors << I18n.t("vagrant_sync.config.host_folder_required") if @host_folder.nil?
        errors << I18n.t("vagrant_sync.config.guest_folder_required") if @guest_folder.nil?

        { "Unison" => errors }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vagrant-unison-0.0.9 lib/vagrant-unison/config.rb
vagrant-unison-0.0.8 lib/vagrant-unison/config.rb
vagrant-unison-0.0.7 lib/vagrant-unison/config.rb
vagrant-unison-0.0.6 lib/vagrant-unison/config.rb
vagrant-unison-0.0.5 lib/vagrant-unison/config.rb
vagrant-unison-0.0.4 lib/vagrant-unison/config.rb
vagrant-unison-0.0.3 lib/vagrant-unison/config.rb
vagrant-unison-0.0.2 lib/vagrant-unison/config.rb
vagrant-unison-0.0.1 lib/vagrant-unison/config.rb
vagrant-unison-0.0.1.dev lib/vagrant-unison/config.rb