Sha256: f5af5e0446d1b9d8b2f4bf538a949d646fc5e25689fba880293d58627f304a65

Contents?: true

Size: 891 Bytes

Versions: 3

Compression:

Stored size: 891 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_class(config)
      case config[:type]
      when 'rsync_with_versions'
        transfer_class = Fulmar::Infrastructure::Model::Transfer::RsyncWithVersions
      when 'rsync'
        transfer_class = Fulmar::Infrastructure::Model::Transfer::Rsync
      when 'tar'
        transfer_class = Fulmar::Infrastructure::Model::Transfer::Tar
      else
        help = config[:type] == '' ? 'Add a "type: " field to your deployment yaml file. ' : ''
        raise "Transfer type '#{config[:type]}' is not valid. #{help}Valid values are: rsync, rsync_with_versions."
      end

      transfer_class
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fulmar-2.2.6 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.2.5 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.2.4 lib/fulmar/domain/service/file_sync_service.rb