Sha256: 9c990bbc1a8371bf7c2f08c0ea1719e4737fb0655d79c911fbe2aa1cb9f61de5
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
require 'capistrano' require 'capistrano/cli' module SimpleDeploy class Deployment def initialize(args) @config = args[:config] @instances = args[:instances] @environment = args[:environment] @attributes = args[:attributes] @region = @config.region(@environment) @deploy_script = @config.deploy_script create_deployment set_deploy_command end def execute @deployment.simpledeploy end private def set_deploy_command cmd = get_artifact_endpoints.any? ? "env " : "" get_artifact_endpoints.each_pair do |k,v| cmd += "#{k}=#{v} " end cmd += @deploy_script @deployment.load :string => "task :simpledeploy do sudo '#{cmd}' end" end def get_artifact_endpoints h = {} @config.artifacts.each do |a| name = a['name'] endpoint = a['endpoint'] variable = a['variable'] bucket_prefix = a['bucket_prefix'] artifact = Artifact.new :name => name, :id => @attributes[name], :region => @region, :config => @config, :bucket_prefix => bucket_prefix h[variable] = artifact.endpoints[endpoint] end h end def ssh_options { :keys => @config.keys, :paranoid => false } end def create_deployment @deployment = Capistrano::Configuration.new @deployment.set :user, @config.user @deployment.variables[:ssh_options] = ssh_options @instances.each { |i| @deployment.server i, :instances } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_deploy-0.2.1 | lib/simple_deploy/deployment.rb |
simple_deploy-0.2.0 | lib/simple_deploy/deployment.rb |