class DEIS::Destroy

Attributes

cluster[RW]
environment[RW]
options[RW]
output[RW]
path[RW]
proxy[RW]
verbose[RW]

Public Class Methods

new(options) click to toggle source
# File lib/rdeis/destroy.rb, line 7
def initialize(options)
  @options = options
  @repo = DEIS::Git.name
  @verbose = options["verbose"]
  @environment = options["environment"]
  @cluster = options["cluster"]
  # location data that fetch from env as well as options from thor
  @proxy = if ! options["proxy"].nil? then options["proxy"] elsif ! ENV['RDEIS_PROXY'].nil? then ENV['RDEIS_PROXY'] else nil end
  @base_path = if ! options["path"].nil? then options["path"] elsif ! ENV['RDEIS_PATH'].nil? then ENV['RDEIS_PATH'] else ENV['HOME'] end
  # git data
  @ref = DEIS::Git.ref
  @branch = DEIS::Git.branch
  @remote = DEIS::Git.remote

  @name = @repo.gsub("_", "-")+"-"+@environment
  @deploy_to = @base_path.to_s + "/"+ @name + "/"
  @ssh = SSH.new({:host => @proxy, :user => nil}) if ! @proxy.nil?
end

Public Instance Methods

all() click to toggle source

runs everyhing in order

# File lib/rdeis/destroy.rb, line 49
def all
  self.domains
  self.scale
  self.remove
  say "Complete", :blue
end
domains() click to toggle source
# File lib/rdeis/destroy.rb, line 27
def domains
  dom = DEIS::Domains.new(@options)
  list = DEIS::Parse.list_array_to_var_string_array(dom.list(nil, nil))
  dom.unset(list) if ! list.nil? && list.length > 0 
  # now deploy the change
  deploy = DEIS::Deploy.new(@options)
  deploy.domains("rm")
end
remove() click to toggle source
# File lib/rdeis/destroy.rb, line 43
def remove
  base = DEIS::Deploy.new(options)
  base.run("deis destroy -a #{@name} --confirm=#{@name}")
end
scale() click to toggle source
# File lib/rdeis/destroy.rb, line 36
def scale
  procs = []
  DEIS::Parse.procs.each{|name| procs.push("#{name}=0") }
  deploy = DEIS::Deploy.new(@options)
  deploy.scale(procs) if ! procs.nil? && procs.length > 0
end