lib/vmc/cli.rb in af-0.5.0.beta.9 vs lib/vmc/cli.rb in af-0.5.0.beta.10
- old
+ new
@@ -63,12 +63,16 @@
else
super
end
end
+ def target_exists
+ File.exists? target_file
+ end
+
def check_target
- unless File.exists? target_file
+ unless target_exists
fail "Please select a target with 'af target'."
end
end
def check_logged_in
@@ -392,10 +396,10 @@
@@client = nil
client
end
def client(target = client_target)
- return @@client if defined?(@@client) && @@client
+ return @@client if defined?(@@client) && @@client && @@client.target == target
return unless target
info = target_info(target)
token = info[:token] && CFoundry::AuthToken.from_hash(info)