Sha256: 0bbe6a5bb53965263df25d2c83990ff89eada6c45e875e7eda2e07bc6d3cb304

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby

require 'second_shutter'

bucket_name = ENV['UPLOAD_IOS_SNAPSHOT_BUCKET_NAME']

if bucket_name == nil
	abort "error: bucket name must be specified in environment UPLOAD_IOS_SNAPSHOT_BUCKET_NAME variable"
end

aws_key = ENV['AWS_ACCESS_KEY_ID']
aws_secret = ENV['AWS_SECRET_ACCESS_KEY']
if aws_key == nil || aws_secret == nil
	abort "error: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be defined as environment variables"
end

path_prefix = ENV['UPLOAD_IOS_SNAPSHOT_BUCKET_PREFIX'] || '/'
if !path_prefix.end_with?('/')
	path_prefix += '/'
end

s3 = AWS::S3.new
bucket = s3.buckets[bucket_name]
manager = UploadManager.new(bucket, path_prefix)

ARGF.each_line do |line|
	if line.start_with?('ksdiff')
		parts = line.split(/"/)
		if (parts.count >= 4)
			expected_path = parts[1]
			actual_path = parts[3]
			manager.enqueue_upload(expected_path, actual_path)
		end
	end

	# Print the line normally, saving output for the end
	print line
end

now = DateTime.now()
folder_name = now.strftime('%Y-%m-%d--%H-%M')

failures_address = manager.upload(folder_name)
if failures_address
	$stderr.puts "Failures: " + failures_address
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
second_curtain-0.1.0 bin/second_shutter