class Race::Run::Domain
Public Instance Methods
create(*args)
click to toggle source
# File lib/system/run/commands/domain.rb, line 70 def create(*args) name = args[0] type = args[1] data = args[2] if data.nil? || type.nil? || data.nil? puts 'Argument Error'.red puts 'Usage'.yellow puts '$ race domain create [DOMAIN_NAME] [TYPE] [IP]'.yellow else result = barge.domain.create_record(name.to_s, { type: name.to_s, data: data.to_s }) if !result.success? puts "#{result.message}".red else puts 'Domain created'.green end end end
destroy(*args)
click to toggle source
# File lib/system/run/commands/domain.rb, line 52 def destroy(*args) domain = args[0] if domain.nil? puts 'Argument Error'.red puts 'Usage'.yellow puts '$ race domain destroy [DOMAIN_NAME]'.yellow else result = barge.domain.destroy(domain.to_s) if !result.success? puts "#{result.message}".red else puts 'Domain destroyed'.green end end end
run()
click to toggle source
# File lib/system/run/commands/domain.rb, line 5 def run result = barge.domain.all if !result.success? puts "#{result.error}".red else puts 'Domains'.yellow rows = [] rows << %w(Name TTL) result.domains.each do |domain| rows << [ domain.name.to_s.red, domain.ttl ] end table = Terminal::Table.new rows: rows puts table end end
show(*args)
click to toggle source
# File lib/system/run/commands/domain.rb, line 26 def show(*args) domain = args[0] if domain.nil? puts 'Argument Error'.red puts 'Usage'.yellow puts '$ race domain show [DOMAIN_NAME]'.yellow else result = barge.domain.show(domain.to_s) if !result.success? puts "#{result.message}".red else puts "Domain Information - #{domain}".yellow rows = [] rows << %w(Name TTL) rows << [ result.domain.name.to_s.red, result.domain.ttl ] table = Terminal::Table.new rows: rows puts table end end end