Sha256: 95e41ed9117ee6f715c93a188d034f9cd57e36c11752505fd40fe3382e3e78aa
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'virtus' require 'pathname' require 'lazily' require 'multi_sync/mixins/log_helper' module MultiSync class Source include Virtus include MultiSync::Mixins::LogHelper attribute :targets, Array, default: [] attribute :source_dir, String attribute :source_options, Hash attribute :include, String attribute :exclude, String # Initialize a new Source object # # @param options [Hash] def initialize(options = {}) fail(ArgumentError, 'source_dir must be a present') unless options[:source_dir] targets.concat([*options.fetch(:targets, [])]) self.source_dir = options.fetch(:source_dir).to_s source_dir << '/' unless source_dir.end_with?('/') self.source_dir = Pathname.new(source_dir) self.include = options.fetch(:include, '**/*') self.exclude = options.fetch(:exclude, nil) end private def path_to_local_resource(path, options = {}) pathname = Pathname.new(path) MultiSync::LocalResource.new({ with_root: pathname, without_root: pathname.relative_path_from(source_dir).cleanpath }.merge(options).merge(source_options)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi_sync-0.0.1 | lib/multi_sync/source.rb |