Sha256: 46ed2d5e9fbaab59ab2bb5265a4474f1f3d553f2e7d4d0643c6e02fa3f3b9b31

Contents?: true

Size: 852 Bytes

Versions: 1

Compression:

Stored size: 852 Bytes

Contents

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

module MultiSync
  class Source
    include Virtus.model
    include MultiSync::Mixins::LogHelper

    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.2 lib/multi_sync/source.rb