namespace :opsmgr do

namespace :info do
  desc 'Display the host of the Ops Manager for the given environment'
  task :host, [:environment] do |_, args|
    require 'opsmgr/environments'
    require 'uri'
    uri = URI(Opsmgr::Environments.for(args.environment).settings['ops_manager']['url'])
    puts uri.host
  end
end

end # Copyright © 2014-2015 Pivotal Software, Inc. # All rights reserved. # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE # USE OR OTHER DEALINGS IN THE SOFTWARE.