Skip to content

Commit 2c1a14a

Browse files
author
Artem Novichkov
committed
Add optional for script body
Close #14
1 parent c7e47f7 commit 2c1a14a

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Sources/CartingCore/Carting.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ public final class Carting {
9696
}
9797
}
9898

99-
try projectService.update(project)
100-
if !projectHasBeenUpdated {
99+
if projectHasBeenUpdated {
100+
try projectService.update(project)
101+
}
102+
else {
101103
print("🤷‍♂️ Nothing to update.")
102104
}
103105
}

Sources/CartingCore/Models/ScriptBody.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Foundation
77
final class ScriptBody: BaseScriptBody {
88

99
var inputPaths: String
10-
let name: String
10+
let name: String?
1111
var outputPaths: String
1212
var shellPath: String
1313
var shellScript: String
@@ -22,7 +22,9 @@ final class ScriptBody: BaseScriptBody {
2222
}
2323
components.append(.tripleTab + ");")
2424
components.append(.tripleTab + "inputPaths = \(inputPaths);")
25-
components.append(.tripleTab + "name = \(name);")
25+
if let name = name {
26+
components.append(.tripleTab + "name = \(name);")
27+
}
2628
components.append(.tripleTab + "outputPaths = \(outputPaths);")
2729
components.append(.tripleTab + "runOnlyForDeploymentPostprocessing = \(runOnlyForDeploymentPostprocessing);")
2830
components.append(.tripleTab + "shellPath = \(shellPath);")
@@ -40,7 +42,7 @@ final class ScriptBody: BaseScriptBody {
4042
buildActionMask: String = "2147483647",
4143
files: [File] = [],
4244
inputPaths: String = "(\n\t\t\t)",
43-
name: String,
45+
name: String?,
4446
outputPaths: String = "(\n\t\t\t)",
4547
runOnlyForDeploymentPostprocessing: String = "0",
4648
shellPath: String = "/bin/sh",

Sources/CartingCore/Services/ShellScriptsService.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ final class ShellScriptsService {
9292
let isa = body["isa"],
9393
let buildActionMask = body["buildActionMask"],
9494
let inputPaths = body["inputPaths"],
95-
let name = body["name"],
9695
let outputPaths = body["outputPaths"],
9796
let runOnlyForDeploymentPostprocessing = body["runOnlyForDeploymentPostprocessing"],
9897
let shellPath = body["shellPath"],
@@ -108,7 +107,7 @@ final class ShellScriptsService {
108107
buildActionMask: buildActionMask,
109108
files: files,
110109
inputPaths: inputPaths,
111-
name: name,
110+
name: body["name"],
112111
outputPaths: outputPaths,
113112
runOnlyForDeploymentPostprocessing: runOnlyForDeploymentPostprocessing,
114113
shellPath: shellPath,

0 commit comments

Comments
 (0)