module Cabal::CLI::Authenticated
Public Instance Methods
with_authentication(config, &block)
click to toggle source
# File lib/cabal/cli/authenticated.rb, line 7 def with_authentication(config, &block) begin unless config[:access_key] && config[:secret_key] raise Cabal::CLI::NoPrivateConfig end block.call rescue Cabal::CLI::NoPrivateConfig stderr.puts "You must have an access key and a secret key" rescue Cabal::Client::UnauthorizedError stderr.puts "You are not authorized to use the private API." kernel.exit(1) rescue Cabal::Client::NotFoundError stderr.puts "The cluster '#{option(:cluster_name)}' does not exist." kernel.exit(1) end end