Class: Automan::Beanstalk::Package

Inherits:
Automan::Base show all
Includes:
Mixins::Utils
Defined in:
lib/automan/beanstalk/package.rb

Constant Summary

Constants included from Mixins::AwsCaller

Mixins::AwsCaller::S3_PROTO

Instance Attribute Summary

Attributes inherited from Automan::Base

#logger, #wait

Attributes included from Mixins::AwsCaller

#as, #cfn, #eb, #ec, #ec2, #elb, #r53, #rds, #s3

Instance Method Summary collapse

Methods included from Mixins::Utils

#region_from_az

Methods inherited from Automan::Base

add_option, #initialize, #log_options, #wait_until

Methods included from Mixins::AwsCaller

#account, #configure_aws, #looks_like_s3_path?, #parse_s3_path, #s3_object_exists?, #s3_read

Constructor Details

This class inherits a constructor from Automan::Base

Instance Method Details

#upload_packageObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/automan/beanstalk/package.rb', line 11

def upload_package
  log_options

  # verify local package exists
  unless File.exists? source
    raise MissingPackageFileError, "package file #{source} does not exist"
  end

  logger.info "Uploading #{source} to #{destination}"

  # upload package file
  bucket, key = parse_s3_path destination
  s3.buckets[bucket].objects[key].write(Pathname.new(source))

  # upload manifest file
  if !manifest.nil?
    logger.info "Uploading manifest file for #{version_label} to #{manifest}"
    contents = {
      "version_label" => version_label,
      "package" => destination
    }.to_json

    bucket, key = parse_s3_path manifest
    s3.buckets[bucket].objects[key].write(contents)
  end

end