Sha256: 46bd6c532013c9b486d475039b7967083bf1712b75d354e8b3cfd3ef463326a0

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require 'virtus'
require 'pathname'
require 'lazily'
require 'multi_sync/attributes/pathname'
require 'multi_sync/resources/local_resource'

module MultiSync
  class Source
    include Virtus.model

    attribute :source_dir, MultiSync::Attributes::Pathname

    attribute :targets, Array, default: []
    attribute :resource_options, Hash, default: {}
    attribute :include, String, default: '**/*'
    attribute :exclude, String, default: ''

    private

    def path_to_local_resource(path, options = {})
      pathname = Pathname.new(path)
      path_options = { path_with_root: pathname, path_without_root: pathname.relative_path_from(source_dir).cleanpath }
      MultiSync::LocalResource.new(path_options.merge(options).merge(resource_options))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_sync-0.0.3 lib/multi_sync/source.rb