gitリポジトリのurlを貼り付けるだけでアプリケーションのビルドを実行するアプリ。 macOS用
Revisión | 81e90367cee925935df142fc7e2f11dfdfbcebdd (tree) |
---|---|
Tiempo | 2018-04-08 11:58:29 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
コマンドが正しく見つけられなかったので修正
暫定版
@@ -13,3 +13,27 @@ func existCommand(_ commandName: String) -> Bool { | ||
13 | 13 | return Process() <<< "/usr/bin/which" <<< [commandName] |
14 | 14 | >>> { output in output.lines.count == 2 } |
15 | 15 | } |
16 | + | |
17 | +func commandPath(_ commandName: String) -> URL? { | |
18 | + | |
19 | + let which = Process() <<< "/usr/bin/which" <<< [commandName] | |
20 | + if let currentPath = which.environment?["PATH"] { | |
21 | + | |
22 | + print(currentPath) | |
23 | + which.environment!["PATH"] = "/usr/local/bin/:" + currentPath | |
24 | + } else { | |
25 | + which.environment = ["PATH": "/bin:/sbin:/local/bin:/local/sbin:/usr/local/bin"] | |
26 | + } | |
27 | + return which >>> { (output: Output) -> URL? in | |
28 | + | |
29 | + let lines = output.lines | |
30 | + | |
31 | + print(lines) | |
32 | + | |
33 | + guard let path = lines.first else { | |
34 | + return nil | |
35 | + } | |
36 | + | |
37 | + return URL(fileURLWithPath: path) | |
38 | + } | |
39 | +} |
@@ -19,6 +19,11 @@ class AppBuilderWithGitTests: XCTestCase { | ||
19 | 19 | XCTAssertFalse(existCommand("skjdlfkjsaldfjalkj")) |
20 | 20 | } |
21 | 21 | |
22 | + func testCommandPath() { | |
23 | + | |
24 | + XCTAssertEqual(commandPath("carthage")?.path, "/usr/local/bin/carthage") | |
25 | + XCTAssertEqual(commandPath("pod")?.path, "/usr/local/bin/pod") | |
26 | + } | |
22 | 27 | |
23 | 28 | func testMatch() { |
24 | 29 |
@@ -45,7 +50,6 @@ class AppBuilderWithGitTests: XCTestCase { | ||
45 | 50 | XCTAssertNotNil(findFile(pattern: "PkgInfo", in: bundleURL, depth: 3)) |
46 | 51 | |
47 | 52 | XCTAssertNil(findFile(pattern: "pkgInfo", in: bundleURL, depth: 3)) |
48 | - | |
49 | 53 | |
50 | 54 | } |
51 | 55 | } |