gitリポジトリのurlを貼り付けるだけでアプリケーションのビルドを実行するアプリ。 macOS用
Revision | f7bf2573e3e77fecd0aaa06931b343bf706e9fe2 (tree) |
---|---|
Time | 2018-04-08 13:16:39 |
Author | masakih <masakih@user...> |
Commiter | masakih |
carthageが必要かのチェックメソッドを追加
@@ -15,34 +15,59 @@ final class Carthage { | ||
15 | 15 | init(_ url: URL) { |
16 | 16 | |
17 | 17 | self.baseURL = url |
18 | + } | |
19 | + | |
20 | + private var cartfileURL: URL? { | |
21 | + | |
22 | + return findFile(pattern: "Cartfile$", in: baseURL) | |
23 | + } | |
24 | + | |
25 | + private var carthageURL: URL? { | |
26 | + | |
27 | + return commandPath("carthage") | |
28 | + } | |
29 | + | |
30 | + func checkCarthage() -> Bool { | |
18 | 31 | |
19 | - print("setting base url is", baseURL) | |
32 | + guard cartfileURL != nil else { | |
33 | + | |
34 | + return false | |
35 | + } | |
36 | + | |
37 | + guard carthageURL != nil else { | |
38 | + | |
39 | + return false | |
40 | + } | |
41 | + | |
42 | + return true | |
20 | 43 | } |
21 | 44 | |
22 | 45 | func execute() { |
23 | 46 | |
24 | - guard let cartfile = findFile(pattern: "Cartfile$", in: baseURL) else { | |
47 | + guard let cartfile = cartfileURL else { | |
25 | 48 | |
26 | - print("Cartfile notFound") | |
27 | 49 | return |
28 | 50 | } |
29 | 51 | |
30 | - guard let carthageURL = commandPath("carthage") else { | |
52 | + guard let carthageURL = carthageURL else { | |
31 | 53 | |
32 | - print("carthage not found") | |
33 | 54 | return |
34 | 55 | } |
35 | - print("carthage", carthageURL) | |
56 | + | |
57 | + let log = LogStocker("carthage") | |
36 | 58 | |
37 | 59 | let carthage = Process() <<< carthageURL.path <<< ["update"] |
38 | 60 | carthage.currentDirectoryPath = cartfile.deletingLastPathComponent().path |
39 | 61 | |
40 | - carthage.launch() | |
62 | + carthage >>> { output, error in | |
63 | + log?.write(output.data) | |
64 | + log?.write(error.data) | |
65 | + } | |
41 | 66 | carthage.waitUntilExit() |
42 | 67 | |
43 | 68 | if carthage.terminationStatus != 0 { |
44 | 69 | |
45 | - print("Carthage error") | |
70 | + log?.write("Carthage error exit with status \(carthage.terminationStatus)") | |
46 | 71 | } |
47 | 72 | } |
48 | 73 | } |