<commit_before>//
//  Project.swift
//  Carthage
//
//  Created by <NAME> on 12/10/2014.
//  Copyright (c) 2014 Carthage. All rights reserved.
//

import Foundation
import LlamaKit
import ReactiveCocoa

let dependenciesPath = "~/.carthage/dependencies".stringByExpandingTildeInPath

/// Represents a Project that is using Carthage.
public struct Project {
	/// Path to the root folder
	public var path: String

	/// The project's cart file
	public let cartfile: Cartfile?

	public init(path: String) {
		self.path = path

		if let cartfileURL = NSURL.fileURLWithPath(self.path)?.URLByAppendingPathComponent("Cartfile") {
			if let cartfile = NSString(contentsOfURL: cartfileURL, encoding: NSUTF8StringEncoding, error: nil) {
				self.cartfile = Cartfile.fromString(cartfile).value()
			}
		}
	}

	public func checkoutDependencies() -> ColdSignal<()> {
		if let dependencies = cartfile?.dependencies {
			return ColdSignal.fromValues(dependencies)
				.map({ dependency -> ColdSignal<String> in
					let destinationPath = dependenciesPath.stringByAppendingPathComponent("\(dependency.repository.name)")
					println(destinationPath)
//					return cloneRepository(dependency.repository.cloneURL.absoluteString!, destinationPath)
//						.catch( {error in
//							println(error.localizedDescription)
//							if error.code == CarthageError.RepositoryAlreadyCloned(location: destinationPath).error.code {
                                return fetchRepository(destinationPath).catch { _ in return .empty() }
//							}
//							return ColdSignal.empty()
//						})
//						.on(error: { println("Errored \($0)") }, completed: { println("Completed") })
				})
				.concat(identity)
				.then(.empty())
		}
		return ColdSignal.empty()
	}
}<commit_msg>Re-enable this stuff.<commit_after>//
//  Project.swift
//  Carthage
//
//  Created by <NAME> on 12/10/2014.
//  Copyright (c) 2014 Carthage. All rights reserved.
//

import Foundation
import LlamaKit
import ReactiveCocoa

let dependenciesPath = "~/.carthage/dependencies".stringByExpandingTildeInPath

/// Represents a Project that is using Carthage.
public struct Project {
	/// Path to the root folder
	public var path: String

	/// The project's cart file
	public let cartfile: Cartfile?

	public init(path: String) {
		self.path = path

		if let cartfileURL = NSURL.fileURLWithPath(self.path)?.URLByAppendingPathComponent("Cartfile") {
			if let cartfile = NSString(contentsOfURL: cartfileURL, encoding: NSUTF8StringEncoding, error: nil) {
				self.cartfile = Cartfile.fromString(cartfile).value()
			}
		}
	}

	public func checkoutDependencies() -> ColdSignal<()> {
		if let dependencies = cartfile?.dependencies {
			return ColdSignal.fromValues(dependencies)
				.map({ dependency -> ColdSignal<String> in
					let destinationPath = dependenciesPath.stringByAppendingPathComponent("\(dependency.repository.name)")
					return cloneRepository(dependency.repository.cloneURL.absoluteString!, destinationPath)
						.catch( {error in
							println(error.localizedDescription)
							if error.code == CarthageError.RepositoryAlreadyCloned(location: destinationPath).error.code {
                                return fetchRepository(destinationPath).catch { _ in return .empty() }
							}
							return ColdSignal.empty()
						})
				})
				.concat(identity)
				.then(.empty())
		}
		return ColdSignal.empty()
	}
}
{'fraction_non_alphanumeric': 0.1169833729216152, 'fraction_numerical': 0.008016627078384799, 'mean_word_length': 3.4681697612732094, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5291857', 'n_tokens_mistral': 1166, 'n_tokens_neox': 962, 'n_words': 228}