require 'aws-sdk' | |
require 'json' | |
class DeployConsumer | |
attr_reader :q , :user, :branch , :repo | |
def initialize(options={}) | |
AWS.config( | |
:access_key_id => ENV['AWS_ACCESS_KEY_ID'], | |
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']) | |
@cluster = options["cluster"] | |
@repo = options["repo"] | |
@env = options["env"] | |
@branch = options["branch"] | |
@user = options["user_name"] | |
@sqs = AWS::SQS.new | |
begin | |
@q = @sqs.queues.named("#{@repo}_deploy_queue") | |
rescue AWS::SQS::Errors::NonExistentQueue | |
raise "Could Not Find Queue: #{@repo}_deploy_queue \n Data Received: #{options.inspect}" | |
end | |
end | |
def deploy | |
cmd = "bundle exec cap #{@cluster}_#{@repo}#{@env} deploy NO_UPDATER_CHECK=1 BRANCH=#{@branch} USER=#{@user} SURE=1 NO_AWS=1" | |
puts "Running: #{cmd}" | |
`#{cmd}` | |
puts "Finished" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment