Sha256: 83fb4844bc40184a1b95e38c43797dc8477631336f6184691767c2f4b022c5aa
Contents?: true
Size: 970 Bytes
Versions: 8
Compression:
Stored size: 970 Bytes
Contents
module Stastic::Command class Domains < Base attr_accessor :domain_name def initialize(args = []) case args.size when 1 self.domain_name = args.first raise(Stastic::Command::InvalidOptions) unless validate_domain(domain_name) else raise(Stastic::Command::InvalidOptions) end end def index end def add print "Adding domain #{domain_name}... " with_valid_site do Stastic::Client.add_domain(Stastic::Config.site_id, domain_name) end puts "Success\n" end def remove print "Removing domain #{domain_name}... " with_valid_site do Stastic::Client.remove_domain(Stastic::Config.site_id, domain_name) end puts "Success\n" end private def validate_domain(domain_name) domain_name =~ /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.){1,3}([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/ end end end
Version data entries
8 entries across 8 versions & 1 rubygems