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

import CarthageKit
import Commandant
import Foundation
import LlamaKit
import ReactiveCocoa


public struct CopyFrameworksCommand: CommandType {
	public let verb = "copy-frameworks"
	public let function = "In a Run Script build phase, copies each framework specified by an SCRIPT_INPUT_FILE environment variable into the built app bundle."

	public func run(mode: CommandMode) -> Result<()> {
		return inputFiles()
			.map { frameworkPath -> ColdSignal<()> in
				let frameworkName = frameworkPath.lastPathComponent

				let source = NSURL(fileURLWithPath: frameworkPath, isDirectory: true)!
				let target = frameworksFolder().map { $0.URLByAppendingPathComponent(frameworkName, isDirectory: true) }

				return ColdSignal.fromResult(target)
					.combineLatestWith(.fromResult(validArchitectures()))
					.mergeMap { (target, validArchitectures) -> ColdSignal<()> in
						return copyFramework(source, target)
							.combineLatestWith(.fromResult(getEnvironmentVariable("EXPANDED_CODE_SIGN_IDENTITY")))
							.mergeMap { stripFramework(target, keepingArchitectures: validArchitectures, codesigningIdentity: $0.1) }
							.then(.empty())
					}
			}
			.concat(identity)
			.wait()
	}
}

private func codeSigningAllowed() -> Bool {
	return getEnvironmentVariable("CODE_SIGNING_ALLOWED")
		.map { $0 == "YES" }
		.value() ?? false
}<commit_msg>Refactor stripping<commit_after>//
//  CopyFramework.swift
//  Carthage
//
//  Created by <NAME> on 10/12/14.
//  Copyright (c) 2014 Carthage. All rights reserved.
//

import CarthageKit
import Commandant
import Foundation
import LlamaKit
import ReactiveCocoa


public struct CopyFrameworksCommand: CommandType {
	public let verb = "copy-frameworks"
	public let function = "In a Run Script build phase, copies each framework specified by an SCRIPT_INPUT_FILE environment variable into the built app bundle."

	public func run(mode: CommandMode) -> Result<()> {
		return inputFiles()
			.map { frameworkPath -> ColdSignal<()> in
				let frameworkName = frameworkPath.lastPathComponent

				let source = NSURL(fileURLWithPath: frameworkPath, isDirectory: true)!
				let target = frameworksFolder().map { $0.URLByAppendingPathComponent(frameworkName, isDirectory: true) }

				return ColdSignal.fromResult(target)
					.combineLatestWith(.fromResult(validArchitectures()))
					.mergeMap { (target, validArchitectures) -> ColdSignal<()> in
						return copyFramework(source, target)
							.combineLatestWith(.fromResult(getEnvironmentVariable("EXPANDED_CODE_SIGN_IDENTITY")))
							.mergeMap { (url, codesigningIdentity) -> ColdSignal<()> in
								return stripFramework(target, keepingArchitectures: validArchitectures, codesigningIdentity: codesigningIdentity)
							}
					}
			}
			.concat(identity)
			.wait()
	}
}

private func codeSigningAllowed() -> Bool {
	return getEnvironmentVariable("CODE_SIGNING_ALLOWED")
		.map { $0 == "YES" }
		.value() ?? false
}
{'fraction_non_alphanumeric': 0.10741103493307215, 'fraction_numerical': 0.008488410055501142, 'mean_word_length': 4.310225303292894, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 21, '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': '790354', 'n_tokens_mistral': 1061, 'n_tokens_neox': 896, 'n_words': 233}