exe/conoharant in conoha-0.2.4 vs exe/conoharant in conoha-0.2.5

- old
+ new

@@ -27,32 +27,36 @@ # @params [Hash] status def dump_conoharant_status(status) File.open('.conoharant/status.yml', 'w').print(YAML.dump(status)) end -require 'conoha' require 'conoha/version' +arg = ARGV.first +case arg +when 'version', '--version', '-v' + puts ConohaVersion::ITSELF + exit 0 +end + +require 'conoha' Conoha.init! begin Conoha.vps_list rescue => e - puts "Auth token is invalid." - puts "Reauthenticating..." + puts "# Auth token is invalid." + puts "# Reauthenticating..." begin Conoha.authenticate! rescue => e STDERR.puts "Failed to authenticate again." STDERR.puts "Retry after modifying \"~/.conoha-config.json\"." exit 1 end end -puts "Authentication OK." +puts "# Authentication OK." -arg = ARGV.first case arg -when 'version', '--version', '-v' - puts ConohaVersion::ITSELF when 'status' puts status['status'] when 'up' begin server_id = Conoha.create config['os'], config['ram'] @@ -152,10 +156,10 @@ end status['images'] = status['images'][-2..-1] status['image-tags'] = status['image-tags'][-2..-1] dump_conoharant_status status else - puts "Nothing to do." + puts "# Nothing to do." end when 'browse' server_id = status['id'] ipaddress = ipv4(Conoha.ip_address_of(server_id)) port = ARGV[1].nil? ? '' : ":#{ARGV[1]}"