 }
 
 // exit if bootstrap is cached
-if bootstrapCommand && cacheAvailable() {
+let hasCachedItems = cacheAvailable()
+if bootstrapCommand && hasCachedItems {
     print("Cache available for bootstrap command, exiting. If you would like to update your Carthage contents, select `update` as Carthage command and re-run your build.")
     exit(0)
 }

// create cache
if bootstrapCommand {
    let cacheFilePath = "\(workingDir)/\(carthageDirName)/\(cacheFileName)"
    guard let cacheContents: String = cacheContents() else {
        print("Failed to create cache content.")
        exit(0)
    }

    if NSFileManager.defaultManager().fileExistsAtPath("\(workingDir)/\(carthageDirName)") {
        do {
            try cacheContents.writeToFile(cacheFilePath, atomically: false, encoding: NSUTF8StringEncoding)
        } catch _ {
            print("Failed to update CacheFile.")
            exit(0)
        }
    } else {
        // create Cachefile
        if NSFileManager.defaultManager().createFileAtPath(cacheFilePath, contents: cacheContents.dataUsingEncoding(NSUTF8StringEncoding), attributes: nil) {
            print("Cachefile created successfully.")
        } else {
            print("Failed to create Cachefile.")

        return false
    }

    guard let newCacheContents = cacheContents() else {
        return false
    }
    
