def initialize
@options ||= Options.new
@shell = Thor::Shell::Basic.new
@connection = StudioApi::Connection.new(
@options.username,
@options.api_key,
@options.api_path,
:proxy => @options.proxy,
:timeout => (@options.timeout || 60)
)
@connection.api_version
StudioApi::Util.configure_studio_connection @connection
if @options.app_name.nil?
@options.app_name = APP_ROOT.split(/(\/|\\)/).last
end
true
rescue ActiveResource::UnauthorizedAccess
puts 'A connection to SUSE Studio could not be established.'
keep_trying = @shell.yes?(
'Would you like to re-enter your credentials and try again? (y/n)'
)
if keep_trying
update_credentials
retry
else
abort('Exiting dister.')
end
end