Sha256: 94fe8917ba8c03a4b96052f20582321af46f01d4f13b701ab0de415a23f0ffe1

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

module AwsEc2
  class S3
    def initialize(options={})
      @options = options
    end

    def upload(skip_compile=false)
      compiler.compile unless skip_compile
      sync_scripts_to_s3
      compiler.clean unless ENV['AWS_EC2_KEEP'] || skip_compile
    end

    def sync_scripts_to_s3
      puts "Uploading tmp/app to s3..."
      s3_bucket = AwsEc2.config["scripts_s3_bucket"]
      s3_path = AwsEc2.config["scripts_s3_path"] || "ec2/app"
      sh "aws s3 sync tmp/app s3://#{s3_bucket}/#{s3_path}"
    end

    def sh(command)
      puts "=> #{command}"
      system command
    end

    def compiler
      @compiler ||= Compile.new(@options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws-ec2-0.7.0 lib/aws_ec2/s3.rb
aws-ec2-0.6.0 lib/aws_ec2/s3.rb