class Fulmar::FileSync

Creates the required transfer model from the configuration

Public Class Methods

get_class(config) click to toggle source
# File lib/fulmar/domain/service/file_sync_service.rb, line 9
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