Sha256: a04e4b520126fadee0c0fb5ab508e216987025c3013d0934e8fdaa6606664a62

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

require "rake"
require "fileutils"
require "dtc_rake/config"
require "dtc_rake/product"
require "dtc_rake/ui"
require "dtc_rake/util"

include DtcRake::UI
product = DtcRake::Product.instance
config = DtcRake::Config.instance

if config.upload_uucloud_descriptor
  namespace :upload do
    desc <<-DESC.gsub(/^ {4}/, '')
      Uploads uuCloud deployment descriptor to appbox artifact; requires path to password file.

      rake upload:descriptor DTC_RAKE_PASSWD=12-345-6
      ("~/.uu/12-345-6" will be used)

      rake upload:descriptor DTC_RAKE_PASSWD=/path/to/12-345-6
      (password file from the specified path will be used)
    DESC
    task :descriptor do
      error("Specify password file in env variable DTC_RAKE_PASSWD, e.g. rake upload:descriptor DTC_RAKE_PASSWD=12-345-6") unless ENV["DTC_RAKE_PASSWD"]

      the_file = config.uucloud_descriptor_path
      error("File #{the_file} does not exist") unless File.file?(the_file)

      art_uri = product.appbox_uri
      attch_code = product.uucloud_descriptor_attachment_code
      announce "Uploading #{the_file} to #{art_uri}:#{attch_code}..."
      attch_uri = DtcRake.upload_pack(
        file: the_file,
        appbox_uri: art_uri,
        attachment_code: attch_code,
        credentials: ENV["DTC_RAKE_PASSWD"]
      )
      success "File #{the_file} uploaded to #{attch_uri}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dtc_rake-1.2.1 lib/tasks/upload_descriptor.rake
dtc_rake-1.2.0 lib/tasks/upload_descriptor.rake
dtc_rake-1.1.0 lib/tasks/upload_descriptor.rake
dtc_rake-1.0.0 lib/tasks/upload_descriptor.rake
dtc_rake-1.0.0.pre.beta.2 lib/tasks/upload_descriptor.rake
dtc_rake-1.0.0.pre.beta.1 lib/tasks/upload_descriptor.rake