Method: Typingpool::Project::Remote.from_config

Defined in:
lib/typingpool/project/remote.rb

.from_config(config) ⇒ Object

Constructor. Takes a Config instance. Returns a Project::Remote::S3 or Project::Remote::SFTP instance, depending on the particulars of the Config. If there are sufficient config params to return EITHER an S3 or SFTP subclass, it will prefer the SFTP subclass.



29
30
31
32
33
34
35
36
37
# File 'lib/typingpool/project/remote.rb', line 29

def self.from_config(config)
  if config.sftp
    SFTP.from_config(config.sftp)
  elsif config.amazon && config.amazon.bucket
    S3.from_config(config.amazon)
  else
    raise Error, "No valid upload params found in config file (SFTP or Amazon info)"
  end
end