Sha256: 79ed9058afbc40f71c3e03a03305620d0862f57d8cd64e2f9ca9e104bdd1e6d2

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

require 'fulmar/infrastructure/model/transfer/rsync'
require 'fulmar/infrastructure/model/transfer/rsync_with_versions'
require 'fulmar/infrastructure/model/transfer/tar'

module Fulmar
  # Creates the required transfer model from the configuration
  class FileSync
    def self.get_model(config)
      case config[:type]
      when 'rsync_with_versions'
        transfer_model = Fulmar::Infrastructure::Model::Transfer::RsyncWithVersions.new(config)
      when 'rsync'
        transfer_model = Fulmar::Infrastructure::Model::Transfer::Rsync.new(config)
      when 'tar'
        transfer_model = Fulmar::Infrastructure::Model::Transfer::Tar.new(config)
      else
        help = config[:type] == '' ? 'Add a "type: " field to your deployment yaml file. ' : ''
        transfer_model = nil
        raise "Transfer type '#{config[:type]}' is not valid. #{help}Valid values are: rsync, rsync_with_versions."
      end

      transfer_model
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fulmar-2.2.3 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.2.2 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.2.1 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.2.0 lib/fulmar/domain/service/file_sync_service.rb