gitリポジトリのurlを貼り付けるだけでアプリケーションのビルドを実行するアプリ。 macOS用
リビジョン | 24154346da19c368b15fe19b456d1004d43a6e57 (tree) |
---|---|
日時 | 2018-04-08 13:15:11 |
作者 | masakih <masakih@user...> |
コミッター | masakih |
無用な出力を削除
@@ -10,26 +10,37 @@ import Foundation | ||
10 | 10 | |
11 | 11 | func existCommand(_ commandName: String) -> Bool { |
12 | 12 | |
13 | - return Process() <<< "/usr/bin/which" <<< [commandName] | |
14 | - >>> { output in output.lines.count == 2 } | |
13 | + let which = Process() <<< "/usr/bin/which" <<< [commandName] | |
14 | + | |
15 | + if let currentPath = which.environment?["PATH"] { | |
16 | + | |
17 | + which.environment!["PATH"] = "/usr/local/bin/:" + currentPath | |
18 | + | |
19 | + } else { | |
20 | + | |
21 | + which.environment = ["PATH": "/bin:/sbin:/local/bin:/local/sbin:/usr/local/bin"] | |
22 | + } | |
23 | + | |
24 | + return which >>> { output in output.lines.count == 2 } | |
15 | 25 | } |
16 | 26 | |
17 | 27 | func commandPath(_ commandName: String) -> URL? { |
18 | 28 | |
19 | 29 | let which = Process() <<< "/usr/bin/which" <<< [commandName] |
30 | + | |
20 | 31 | if let currentPath = which.environment?["PATH"] { |
21 | 32 | |
22 | - print(currentPath) | |
23 | 33 | which.environment!["PATH"] = "/usr/local/bin/:" + currentPath |
34 | + | |
24 | 35 | } else { |
36 | + | |
25 | 37 | which.environment = ["PATH": "/bin:/sbin:/local/bin:/local/sbin:/usr/local/bin"] |
26 | 38 | } |
39 | + | |
27 | 40 | return which >>> { (output: Output) -> URL? in |
28 | 41 | |
29 | 42 | let lines = output.lines |
30 | - | |
31 | - print(lines) | |
32 | - | |
43 | + | |
33 | 44 | guard let path = lines.first else { |
34 | 45 | return nil |
35 | 46 | } |