Sha256: 266044916f390b2b09534815d0a09fe378aab4314e1ba4c1d3430fef5e716bac

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

require "vagrant"

module VagrantPlugins
  module Unison
    class Config < Vagrant.plugin("2", :config)
      # Host Folder to Sync
      #
      # @return [String]
      attr_accessor :host_folder

      # Guest Folder to Sync.
      #
      # @return [String]
      attr_accessor :guest_folder

      # Pattern of files to ignore.
      #
      # @return [String]
      attr_accessor :ignore

      # Repeat speed.
      #
      # @return [String]
      attr_accessor :repeat

      def initialize(region_specific=false)
        @host_folder      = UNSET_VALUE
        @remote_folder    = UNSET_VALUE
        @ignore           = UNSET_VALUE
        @repeat           = 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
        @ignore         = nil if @ignore         == UNSET_VALUE
        @repeat         = 1   if @repeat         == 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

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-unison-morroni-0.0.25 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.24 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.23 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.22 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.21 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.20 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.19 lib/vagrant-unison-morroni/config.rb
vagrant-unison-morroni-0.0.18 lib/vagrant-unison-morroni/config.rb