Sha256: 4d688a4c3669b1a35dc530d535b36e4ed7c730eadbfec281dc564e617079fa2a
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
module Rudy module Command class Stage < Rudy::Command::Base def push_to_stage if @user != "root" #puts "This command will be run as root" @user = "root" # We need to be root for this operation! end raise "No EC2 .pem keys provided" unless has_pem_keys? raise "No SSH key provided for #{keypairname}!" unless has_keypair?(keypairname) raise "SSH key provided but cannot be found! (#{keypairpath})" unless File.exists?(keypairpath) raise "The security group #{filter} does not exist" if machine_group && !@ec2.groups.exists?(machine_group) list = @ec2.instances.list(machine_group) raise "Please start an instance in #{machine_group} before releasing! (rudy -e stage instances --start)" if list.empty? puts "Creating release from: #{Dir.pwd}" tag = @scm.create_release_tag machine = list.values.first # NOTE: we're assuming there's only one machine basename = File.basename(@rscripts[keypairname]) puts "Running #{basename}..." scp machine[:dns_name], keypairpath, user, @rscripts[keypairname], "/mnt/" ssh machine[:dns_name], keypairpath, user, "chmod 755 /mnt/#{basename} && /mnt/#{basename} #{tag}" @user = "rudy" basename = File.basename(@rscripts[keypairname]) puts "Running #{basename}..." scp machine[:dns_name], keypairpath, user, @rscripts[keypairname], "~/" ssh machine[:dns_name], keypairpath, user, "chmod 755 ~/#{basename} && ~/#{basename} #{@access_key} #{@secret_key}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rudy-0.3.2 | lib/rudy/command/stage.rb |
rudy-0.3.0 | lib/rudy/command/stage.rb |