lib/spaceship/client.rb in spaceship-0.0.13 vs lib/spaceship/client.rb in spaceship-0.0.14
- old
+ new
@@ -66,11 +66,14 @@
end
# Fetches the latest API Key from the Apple Dev Portal
def api_key
cache_path = "/tmp/spaceship_api_key.txt"
- cached = File.read(cache_path) rescue nil
+ begin
+ cached = File.read(cache_path)
+ rescue Errno::ENOENT
+ end
return cached if cached
landing_url = "https://developer.apple.com/membercenter/index.action"
logger.info("GET: " + landing_url)
headers = @client.get(landing_url).headers
@@ -91,10 +94,9 @@
if $verbose || ENV["VERBOSE"]
@logger = Logger.new(STDOUT)
else
# Log to file by default
path = "/tmp/spaceship.log"
- puts "Logging spaceship web requests to '#{path}'"
@logger = Logger.new(path)
end
@logger.formatter = proc do |severity, datetime, progname, msg|
string = "[#{datetime.strftime('%H:%M:%S')}]: #{msg}\n"