Sha256: ab5c5d0278d9b14ce2000a8b6bc7e119ec4caf3b02bbbf2e9bd83e61283a06d4
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
require 'beanstalkify/archive' require 'beanstalkify/beanstalk' require 'aws-sdk' module Beanstalkify class Deploy attr_accessor :beanstalk, :application def initialize(path) @application = Archive.new(path) @beanstalk = Beanstalk.api end def bucket @beanstalk.create_storage_location.data[:s3_bucket] end def upload! client = AWS::S3.new.client bucket = self.bucket puts "Uploading #{@application.filename} to bucket #{bucket}..." client.put_object({ :bucket_name => bucket, :key => @application.filename, :data => File.open(@application.path) }) puts "Creating #{@application.name} - #{@application.version} in beanstalk" @beanstalk.create_application_version({ :application_name => @application.name, :version_label => @application.version, :source_bundle => { :s3_bucket => bucket, :s3_key => @application.filename }, :auto_create_application => true }) end def deployed? @beanstalk.describe_application_versions({ :application_name => @application.name, :version_labels => [@application.version] }).data[:application_versions].count > 0 end def wait! while not self.deployed? puts "Waiting for #{@application.version} to be available..." sleep 10 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
beanstalkify-0.0.2 | lib/beanstalkify/deploy.rb |
beanstalkify-0.0.1 | lib/beanstalkify/deploy.rb |