Class: Fulmar::FileSync

Inherits:
Object
  • Object
show all
Defined in:
lib/fulmar/domain/service/file_sync_service.rb

Overview

Creates the required transfer model from the configuration

Class Method Summary collapse

Class Method Details

.create_transfer(config) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fulmar/domain/service/file_sync_service.rb', line 8

def self.create_transfer(config)
  case config[:type]
  when 'rsync_with_versions'
    transfer_model = Fulmar::Infrastructure::Service::Transfer::RsyncWithVersions.new(config)
  when 'rsync'
    transfer_model = Fulmar::Infrastructure::Service::Transfer::Rsync.new(config)
  else
    help = config[:type] == '' ? 'Add a "type: " field to your deployment yaml file. ' : ''
    transfer_model = nil
    fail "Transfer type '#{config[:type]}' is not valid. #{help}Valid values are: rsync, rsync_with_versions."
  end

  transfer_model
end