diff --git a/.gitignore b/.gitignore index 3f5ddd0..f2c828e 100644 --- a/.gitignore +++ b/.gitignore @@ -31,9 +31,7 @@ Pods/ # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build +Carthage/ # Apous bin/ diff --git a/apous.xcodeproj/project.pbxproj b/apous.xcodeproj/project.pbxproj index a319471..e580277 100644 --- a/apous.xcodeproj/project.pbxproj +++ b/apous.xcodeproj/project.pbxproj @@ -156,6 +156,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 0.1.0; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -199,6 +200,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 0.1.0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/samples/carthage/Cartfile b/samples/carthage/Cartfile new file mode 100644 index 0000000..a74fee1 --- /dev/null +++ b/samples/carthage/Cartfile @@ -0,0 +1 @@ +github "thoughtbot/Argo" "td-swift-2" \ No newline at end of file diff --git a/samples/carthage/Cartfile.resolved b/samples/carthage/Cartfile.resolved new file mode 100644 index 0000000..febe3ab --- /dev/null +++ b/samples/carthage/Cartfile.resolved @@ -0,0 +1,2 @@ +github "thoughtbot/Runes" "3a46bd92d78061c76c08a0b2baf6ee214dba77e9" +github "thoughtbot/Argo" "5b18ce0da13e3e6d8a3a5188cbf00bd8d5c86a0c" diff --git a/samples/carthage/main.swift b/samples/carthage/main.swift new file mode 100644 index 0000000..073312b --- /dev/null +++ b/samples/carthage/main.swift @@ -0,0 +1,4 @@ +import Argo +import Runes + +print("dependencies import properly") \ No newline at end of file diff --git a/src/main.swift b/src/main.swift index 02f9024..51d8e5a 100644 --- a/src/main.swift +++ b/src/main.swift @@ -62,9 +62,21 @@ func filesAtPath(path: String) -> [String] { return items .filter() { $0 != ".apous.swift" } + .filter() { $0.pathExtension == "swift" } .map() { path.stringByAppendingPathComponent($0) } } +func runTask(task: String, _ args: String...) { + + let t = NSTask() + t.launchPath = task + t.arguments = args + t.standardOutput = NSFileHandle.fileHandleWithStandardOutput() + t.standardError = NSFileHandle.fileHandleWithStandardError() + t.launch() + t.waitUntilExit() +} + let arguments = NSProcessInfo.processInfo().arguments if arguments.count != 2 { @@ -74,6 +86,13 @@ if arguments.count != 2 { let p = try path(arguments[1]) +NSFileManager.defaultManager().changeCurrentDirectoryPath(p) + +if NSFileManager.defaultManager().fileExistsAtPath(p.stringByAppendingPathComponent("Cartfile")) { + runTask("/usr/local/bin/carthage", "update") +} + + let files = filesAtPath(p) var script = "" @@ -85,11 +104,4 @@ for f in files { let scriptPath = p.stringByAppendingPathComponent(".apous.swift") try script.writeToFile(scriptPath, atomically: true, encoding: NSUTF8StringEncoding) - -var swift = NSTask() -swift.launchPath = "/usr/bin/swift" -swift.arguments = [scriptPath] -swift.standardOutput = NSFileHandle.fileHandleWithStandardOutput() -swift.standardError = NSFileHandle.fileHandleWithStandardError() -swift.launch() -swift.waitUntilExit() +runTask("/usr/bin/swift", "-F", "Carthage/Build/Mac", scriptPath)