Sha256: 4a93198e6539f067c1e9d47972fe2efb40436e78c571801976094038af99308c

Contents?: true

Size: 955 Bytes

Versions: 6

Compression:

Stored size: 955 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
        fail "Transfer type '#{config[:type]}' is not valid. #{help}Valid values are: rsync, rsync_with_versions."
      end

      transfer_model
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fulmar-2.1.2 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.1.1 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.1.0 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.0.2 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.0.1 lib/fulmar/domain/service/file_sync_service.rb
fulmar-2.0.0 lib/fulmar/domain/service/file_sync_service.rb