This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func validateABTests(file: String) { | |
let declaredVariantFile = findPath(file) | |
let variantContents = contents(atPath: declaredVariantFile) | |
let variantTests = regexFor("(.*//\\s*AB_TEST.*)", content: variantContents) | |
variantTests.forEach { | |
guard let expirationDateSerialized = regexFor("((0|1)\\d{1})/((0|1|2)\\d{1})/((19|20)\\d{2})", content: $0).first, | |
let expirationDate = dateFormatter.date(from: expirationDateSerialized) else { | |
fatalError("Incorrect expiration date format: MM/dd/yyyy") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/xcrun --sdk macosx swift | |
import Foundation | |
let fileManager = FileManager.default | |
let currentPath = fileManager.currentDirectoryPath | |
/// List of files in currentPath - recursive | |
var pathFiles: [String] = { | |
guard let enumerator = fileManager.enumerator(atPath: currentPath), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Throws error if ALL localizable files does not have matching keys | |
/// | |
/// - Parameter files: list of localizable files to validate | |
func validateMatchKeys(_ files: [LocalizationStringsFile]) { | |
print("------------ Validating keys match in all localizable files ------------") | |
guard let base = files.first, files.count > 1 else { return } | |
let files = Array(files.dropFirst()) | |
files.forEach { | |
guard let extraKey = Set(base.keys).symmetricDifference($0.keys).first else { return } | |
let incorrectFile = $0.keys.contains(extraKey) ? $0 : base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |