Method: RHC::ContextHelpers#find_app_or_domain

Defined in:
lib/rhc/context_helper.rb

#find_app_or_domain(opts = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rhc/context_helper.rb', line 49

def find_app_or_domain(opts={})
  domain, app =
    if options.target.present?
      options.target.split(/\//)
    elsif options.namespace || options.app
      if options.app =~ /\//
        options.app.split(/\//)
      else
        [options.namespace || namespace_context, options.app]
      end
    end
  if app && domain
    rest_client.find_application(domain, app)
  elsif domain
    rest_client.find_domain(domain)
  else
    raise ArgumentError, "You must specify a domain with -n, or an application with -a."
  end
end