Class: Lexicon::Common::Remote::PackageUploader

Inherits:
RemoteBase
  • Object
show all
Includes:
Mixin::LoggerAware
Defined in:
lib/lexicon/common/remote/package_uploader.rb

Instance Attribute Summary

Attributes included from Mixin::LoggerAware

#logger

Instance Method Summary collapse

Methods included from Mixin::LoggerAware

#log, #log_error

Methods inherited from RemoteBase

#initialize

Constructor Details

This class inherits a constructor from Lexicon::Common::Remote::RemoteBase

Instance Method Details

#upload(package) ⇒ Corindon::Result::Result

Parameters:

Returns:

  • (Corindon::Result::Result)


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/lexicon/common/remote/package_uploader.rb', line 13

def upload(package)
  rescue_failure do
    bucket_name = package.version.to_s

    if s3.bucket_exist?(bucket_name)
      Failure(StandardError.new("The server already has a folder named #{bucket_name}"))
    else
      upload_package(package, bucket_name)
    end
  end
end