Compare commits
4 Commits
4426091dcb
...
b994e92201
Author | SHA1 | Date | |
---|---|---|---|
b994e92201 | |||
3f7464161c | |||
aaeca93cbc | |||
e22f9ba894 |
12
README.md
12
README.md
@@ -2,13 +2,13 @@
|
||||
|
||||
ResgenSwift is a package, fully written in Swift, to help you automatize ressource update and generation.
|
||||
|
||||
> 🧐 For all commands, see samples files in `SampleFiles`
|
||||
> 🧐 For all commands, see samples files in `SampleFiles` and use `resgen-swift help` and `resgen-swift help <subcommand>` for detailed help.
|
||||
|
||||
## Fonts
|
||||
|
||||
Font generator generates an extension of `UIFont` and `Font` (or custom classes). It also prints content of `UIAppFonts` from your project `.plist`. If project `.plist` is specified, it will update `UIAppFonts` content of all `.plist`.
|
||||
|
||||
iOS required to use the **real name** of the font, this name can be different from its filename. To get the **real name**, it uses `fc-scan`. So, be sure that the `$PATH` contains path of `fc-scan`.
|
||||
iOS required to use the **real name** of the font, this name can be different from its filename. To get the **real name**, it uses `fc-scan`. So, be sure that your `$PATH` variable contains path of `fc-scan`.
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -54,12 +54,13 @@ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
|
||||
1. `-f`: force generation
|
||||
2. Input colors file
|
||||
3. `--style` can be `all` or `light`
|
||||
4. `--extension-output-path`: path where to generate generated extension
|
||||
4. `--extension-output-path` *(optional)* : path where to generate generated extension
|
||||
5. `--extension-name` *(optional)* : name of the class to add SwiftUI getters
|
||||
6. `--extension-name-ui-kit` *(optional)* : name of the class to add UIKit getters
|
||||
7. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppColor+GreatApp.swift`)
|
||||
8. `--static-members` *(optional)*: generate static properties or not
|
||||
|
||||
> ⚠️ Passing a `extensionOutputPath` without any `extensionName` does not generate extension. **But** passing an `extensionName` without `extensionOutputPath` will result in a error.
|
||||
|
||||
## Strings
|
||||
|
||||
@@ -266,7 +267,7 @@ events:
|
||||
|
||||
## Images
|
||||
|
||||
Images generator will generate images assets along with extensions to access those images easily.
|
||||
Images generator will generate images assets along with extensions to access those images easily. If the extension name is not specified, no extension will be generated.
|
||||
|
||||
```sh
|
||||
swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
|
||||
@@ -283,12 +284,13 @@ swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
|
||||
1. `-f`: force generation
|
||||
2. Input images definitions file
|
||||
3. `--xcassets-path`: xcasset path where to generate imagesets
|
||||
4. `--extension-output-path`: path where to generate generated extension
|
||||
4. `--extension-output-path` *(optional)* : path where to generate generated extension
|
||||
5. `--extension-name` *(optional)* : name of the class to add SwiftUI getters
|
||||
6. `--extension-name-ui-kit` *(optional)* : name of the class to add UIKit getters
|
||||
6. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppImage+GreatApp.swift`)
|
||||
7. `--static-members` *(optional)*: generate static properties or not
|
||||
|
||||
> ⚠️ Passing a `extensionOutputPath` without any `extensionName` does not generate extension. **But** passing an `extensionName` without `extensionOutputPath` will result in a error.
|
||||
> ⚠️ Svg images will be copied in the assets and rendered as "Original", however if those images are not rendered correctly you can force the png generation by adding the key word "png" like this: id arrow_back 15 ? png
|
||||
|
||||
## All at once
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Generated by ResgenSwift.Color 1.2
|
||||
// Generated by ResgenSwift.Color 2.1.0
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
150
SampleFiles/Strings/Generated/sampleStrings.xcstrings
Normal file
150
SampleFiles/Strings/Generated/sampleStrings.xcstrings
Normal file
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"sourceLanguage" : "en",
|
||||
"strings" : {
|
||||
"generic_back" : {
|
||||
"comment" : "",
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Back"
|
||||
}
|
||||
},
|
||||
"en-us" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Back"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Retour"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"generic_loading_data" : {
|
||||
"comment" : "",
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Loading data..."
|
||||
}
|
||||
},
|
||||
"en-us" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Loading data..."
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Chargement des données..."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"generic_welcome_firstname_format" : {
|
||||
"comment" : "",
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Welcome \\\"%@\\\" !"
|
||||
}
|
||||
},
|
||||
"en-us" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Welcome \\\"%@\\\" !"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Bienvenue \\\"%@\\\" !"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"param_lang" : {
|
||||
"comment" : "",
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "en"
|
||||
}
|
||||
},
|
||||
"en-us" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "en-us"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "fr"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"placeholders_test_one" : {
|
||||
"comment" : "",
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "You %%: %2$@ %1$@ Age: %3$d"
|
||||
}
|
||||
},
|
||||
"en-us" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "You %%: %2$@ %1$@ Age: %3$d"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Vous %%: %1$@ %2$@ Age: %3$d"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"test_equal_symbol" : {
|
||||
"comment" : "",
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1€ = 1 point !"
|
||||
}
|
||||
},
|
||||
"en-us" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1€ = 1 point !"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1€ = 1 point !"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version" : "1.0"
|
||||
}
|
@@ -110,6 +110,17 @@ struct Colors: ParsableCommand {
|
||||
}
|
||||
}
|
||||
|
||||
// If an extension need to be generated, ensure extensionOutputPath is defined
|
||||
if options.extensionName != nil ||
|
||||
options.extensionNameUIKit != nil {
|
||||
guard let extensionOutputPath = options.extensionOutputPath,
|
||||
extensionOutputPath.isEmpty == false else {
|
||||
let error = ColorsToolError.missingExtensionPath
|
||||
print(error.description)
|
||||
Self.exit(withError: error)
|
||||
}
|
||||
}
|
||||
|
||||
// Check if needed to regenerate
|
||||
let fileToCompareToInput: String = {
|
||||
// If there is no extension file to compare
|
||||
|
@@ -17,11 +17,12 @@ enum ColorsToolError: Error {
|
||||
case fileNotExists(String)
|
||||
case badColorDefinition(String, String)
|
||||
case deleteExistingColors(String)
|
||||
case missingExtensionPath
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .extensionNamesCollision(let extensionName):
|
||||
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||
return "error: [\(Colors.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||
|
||||
case .badFormat(let info):
|
||||
return "error: [\(Colors.toolName)] Bad line format: \(info). Accepted format are: colorName=\"#RGB/#ARGB\"; colorName \"#RGB/#ARGB\"; colorName \"#RGB/#ARGB\" \"#RGB/#ARGB\""
|
||||
@@ -43,6 +44,9 @@ enum ColorsToolError: Error {
|
||||
|
||||
case .deleteExistingColors(let assetsFolder):
|
||||
return "error: [\(Colors.toolName)] An error occured while deleting colors folder `\(assetsFolder)`"
|
||||
|
||||
case .missingExtensionPath:
|
||||
return "error: [\(Colors.toolName)] Extension need to be generated but no `extensionOutputPath` is provided"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,16 +24,16 @@ struct ColorsToolOptions: ParsableArguments {
|
||||
@Option(help: "Path of xcassets where to generate colors", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var xcassetsPath: String
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Extension name. If not specified, no extension will be generated.")
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String?
|
||||
|
||||
@Option(help: "SwiftUI extension name. If not specified, no extension will be generated.")
|
||||
var extensionName: String?
|
||||
|
||||
@Option(help: "SwiftUI Extension name. If not specified, no extension will be generated.")
|
||||
@Option(help: "UIKit extension name. If not specified, no extension will be generated.")
|
||||
var extensionNameUIKit: String?
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
|
||||
@@ -56,7 +56,7 @@ extension ColorsToolOptions {
|
||||
}
|
||||
|
||||
var extensionFilePath: String? {
|
||||
guard let extensionFileName else { return nil }
|
||||
guard let extensionOutputPath, let extensionFileName else { return nil }
|
||||
|
||||
return "\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
@@ -73,7 +73,7 @@ extension ColorsToolOptions {
|
||||
}
|
||||
|
||||
var extensionFilePathUIKit: String? {
|
||||
guard let extensionFileNameUIKit else { return nil }
|
||||
guard let extensionOutputPath, let extensionFileNameUIKit else { return nil }
|
||||
|
||||
return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
}
|
||||
|
@@ -18,20 +18,20 @@ struct FontsOptions: ParsableArguments {
|
||||
@Argument(help: "Input files where fonts ared defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var inputFile: String
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or methods")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an Font extension.")
|
||||
var extensionName: String = Fonts.defaultExtensionName
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an UIFont extension.")
|
||||
var extensionNameUIKit: String = Fonts.defaultExtensionNameUIKit
|
||||
@Option(help: "Extension name. If not specified, no extension will be generated.")
|
||||
var extensionNameUIKit: String?
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+FontsMyApp.swift")
|
||||
var extensionSuffix: String = ""
|
||||
var extensionSuffix: String?
|
||||
|
||||
@Option(name: .customLong("info-plist-paths"), help: "Info.plist paths (array). Will be used to update UIAppFonts content")
|
||||
fileprivate var infoPlistPathsRaw: String = ""
|
||||
@@ -44,7 +44,7 @@ extension FontsOptions {
|
||||
// MARK: - SwiftUI
|
||||
|
||||
var extensionFileName: String {
|
||||
if extensionSuffix.isEmpty == false {
|
||||
if let extensionSuffix {
|
||||
return "\(extensionName)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionName).swift"
|
||||
@@ -56,15 +56,19 @@ extension FontsOptions {
|
||||
|
||||
// MARK: - UIKit
|
||||
|
||||
var extensionFileNameUIKit: String {
|
||||
if extensionSuffix.isEmpty == false {
|
||||
var extensionFileNameUIKit: String? {
|
||||
guard let extensionNameUIKit else { return nil }
|
||||
|
||||
if let extensionSuffix {
|
||||
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionNameUIKit).swift"
|
||||
}
|
||||
|
||||
var extensionFilePathUIKit: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
var extensionFilePathUIKit: String? {
|
||||
guard let extensionFileNameUIKit else { return nil }
|
||||
|
||||
return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
@@ -22,7 +22,6 @@ struct Fonts: ParsableCommand {
|
||||
|
||||
static let toolName = "Fonts"
|
||||
static let defaultExtensionName = "Font"
|
||||
static let defaultExtensionNameUIKit = "UIFont"
|
||||
|
||||
// MARK: - Command Options
|
||||
|
||||
@@ -61,16 +60,25 @@ struct Fonts: ParsableCommand {
|
||||
isSwiftUI: true
|
||||
)
|
||||
|
||||
if let extensionNameUIKit = options.extensionNameUIKit,
|
||||
let extensionFilePathUIKit = options.extensionFilePathUIKit {
|
||||
FontExtensionGenerator.writeExtensionFile(
|
||||
fontsNames: fontsNames,
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionNameUIKit,
|
||||
extensionFilePath: options.extensionFilePathUIKit,
|
||||
extensionName: extensionNameUIKit,
|
||||
extensionFilePath: extensionFilePathUIKit,
|
||||
isSwiftUI: false
|
||||
)
|
||||
}
|
||||
|
||||
if options.infoPlistPaths.isEmpty == false {
|
||||
let plistUpdateFontsData = FontPlistGenerator.generatePlistUIAppsFontContent(
|
||||
for: fontsNames,
|
||||
infoPlistPaths: options.infoPlistPaths
|
||||
)
|
||||
print("Info.plist has been updated with:")
|
||||
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames, infoPlistPaths: options.infoPlistPaths))")
|
||||
print(plistUpdateFontsData)
|
||||
}
|
||||
|
||||
print("[\(Self.toolName)] Fonts generated")
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ enum FontsToolError: Error {
|
||||
case inputFolderNotFound(String)
|
||||
case fileNotExists(String)
|
||||
case writeExtension(String, String)
|
||||
case missingExtensionPath
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
@@ -31,6 +32,9 @@ enum FontsToolError: Error {
|
||||
|
||||
case let .writeExtension(filename, info):
|
||||
return "error: [\(Fonts.toolName)] An error occured while writing extension in \(filename): \(info)"
|
||||
|
||||
case .missingExtensionPath:
|
||||
return "error: [\(Fonts.toolName)] Extension need to be generated but no `extensionOutputPath` is provided"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -131,7 +131,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let inputFile: String
|
||||
let style: String
|
||||
let xcassetsPath: String
|
||||
let extensionOutputPath: String
|
||||
let extensionOutputPath: String?
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
@@ -148,7 +148,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
inputFile: String,
|
||||
style: String,
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionOutputPath: String?,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
@@ -170,7 +170,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Input file: \(inputFile)
|
||||
- Style: \(style)
|
||||
- Xcassets path: \(xcassetsPath)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension output path: \(extensionOutputPath ?? "-")
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
@@ -181,7 +181,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let extensionOutputPath: String
|
||||
let extensionOutputPath: String?
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
@@ -197,7 +197,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
extensionOutputPath: String,
|
||||
extensionOutputPath: String?,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
@@ -217,7 +217,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
"""
|
||||
Fonts configuration:
|
||||
- Input file: \(inputFile)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension output path: \(extensionOutputPath ?? "-")
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
@@ -230,7 +230,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let xcassetsPath: String
|
||||
let extensionOutputPath: String
|
||||
let extensionOutputPath: String?
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
@@ -246,7 +246,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
internal init(
|
||||
inputFile: String,
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionOutputPath: String?,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
@@ -266,7 +266,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
Images configuration:
|
||||
- Input file: \(inputFile)
|
||||
- Xcassets path: \(xcassetsPath)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension output path: \(extensionOutputPath ?? "-")
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
@@ -280,7 +280,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let outputPath: String
|
||||
let langs: String
|
||||
let defaultLang: String
|
||||
let extensionOutputPath: String
|
||||
let extensionOutputPath: String?
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
@@ -305,7 +305,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
outputPath: String,
|
||||
langs: String,
|
||||
defaultLang: String,
|
||||
extensionOutputPath: String,
|
||||
extensionOutputPath: String?,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?,
|
||||
@@ -329,7 +329,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Output path: \(outputPath)
|
||||
- Langs: \(langs)
|
||||
- Default lang: \(defaultLang)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension output path: \(extensionOutputPath ?? "-")
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
"""
|
||||
|
@@ -27,29 +27,23 @@ extension ColorsConfiguration: Runnable {
|
||||
style,
|
||||
"--xcassets-path",
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory),
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
if let extensionNameUIKit {
|
||||
args += [
|
||||
"--extension-name-ui-kit",
|
||||
extensionNameUIKit
|
||||
]
|
||||
}
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
}
|
||||
|
||||
return args
|
||||
|
@@ -23,32 +23,26 @@ extension FontsConfiguration: Runnable {
|
||||
|
||||
args += [
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
if let extensionNameUIKit {
|
||||
args += [
|
||||
"--extension-name-ui-kit",
|
||||
extensionNameUIKit
|
||||
]
|
||||
}
|
||||
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
}
|
||||
|
||||
// Add infoPlist paths
|
||||
if let infoPlistPaths {
|
||||
let adjustedPlistPaths = infoPlistPaths
|
||||
.split(separator: " ")
|
||||
|
@@ -25,31 +25,23 @@ extension ImagesConfiguration: Runnable {
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--xcassets-path",
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory),
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
|
||||
if let extensionNameUIKit {
|
||||
args += [
|
||||
"--extension-name-ui-kit",
|
||||
extensionNameUIKit
|
||||
]
|
||||
}
|
||||
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
}
|
||||
|
||||
return args
|
||||
|
@@ -24,26 +24,24 @@ extension StringsConfiguration: Runnable {
|
||||
langs,
|
||||
"--default-lang",
|
||||
defaultLang,
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)",
|
||||
"--xc-strings",
|
||||
"\(xcStringsOptions)"
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
}
|
||||
|
||||
Stringium.main(args)
|
||||
|
@@ -21,8 +21,6 @@ struct Images: ParsableCommand {
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Images"
|
||||
static let defaultExtensionName = "Image"
|
||||
static let defaultExtensionNameUIKit = "UIImage"
|
||||
|
||||
// MARK: - Command Options
|
||||
|
||||
@@ -55,23 +53,29 @@ struct Images: ParsableCommand {
|
||||
)
|
||||
|
||||
// Generate extension
|
||||
if let extensionName = options.extensionName,
|
||||
let extensionFilePath = options.extensionFilePath {
|
||||
ImageExtensionGenerator.generateExtensionFile(
|
||||
images: imagesToGenerate,
|
||||
staticVar: options.staticMembers,
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
extensionName: extensionName,
|
||||
extensionFilePath: extensionFilePath,
|
||||
isSwiftUI: true
|
||||
)
|
||||
}
|
||||
|
||||
if let extensionNameUIKit = options.extensionNameUIKit,
|
||||
let extensionFilePathUIKit = options.extensionFilePathUIKit {
|
||||
ImageExtensionGenerator.generateExtensionFile(
|
||||
images: imagesToGenerate,
|
||||
staticVar: options.staticMembers,
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: options.extensionNameUIKit,
|
||||
extensionFilePath: options.extensionFilePathUIKit,
|
||||
extensionName: extensionNameUIKit,
|
||||
extensionFilePath: extensionFilePathUIKit,
|
||||
isSwiftUI: false
|
||||
)
|
||||
}
|
||||
|
||||
print("[\(Self.toolName)] Images generated")
|
||||
}
|
||||
@@ -96,17 +100,39 @@ struct Images: ParsableCommand {
|
||||
_ = Self.getSvgConverterPath()
|
||||
|
||||
// Extension for UIKit and SwiftUI should have different name
|
||||
guard options.extensionName != options.extensionNameUIKit else {
|
||||
let error = ImagesError.extensionNamesCollision(options.extensionName)
|
||||
if let extensionName = options.extensionName,
|
||||
let extensionNameUIKit = options.extensionNameUIKit {
|
||||
guard extensionName != extensionNameUIKit else {
|
||||
let error = ImagesError.extensionNamesCollision(extensionName)
|
||||
print(error.description)
|
||||
Self.exit(withError: error)
|
||||
}
|
||||
}
|
||||
|
||||
// If an extension need to be generated, ensure extensionOutputPath is defined
|
||||
if options.extensionName != nil ||
|
||||
options.extensionNameUIKit != nil {
|
||||
guard let extensionOutputPath = options.extensionOutputPath,
|
||||
extensionOutputPath.isEmpty == false else {
|
||||
let error = ImagesError.missingExtensionPath
|
||||
print(error.description)
|
||||
Self.exit(withError: error)
|
||||
}
|
||||
}
|
||||
|
||||
// Check if needed to regenerate
|
||||
let fileToCompareToInput: String = {
|
||||
// If there is no extension file to compare
|
||||
// Then check the xcassets file instead
|
||||
if let extensionFilePath = options.extensionFilePath {
|
||||
return extensionFilePath
|
||||
}
|
||||
return options.xcassetsPath
|
||||
}()
|
||||
guard GeneratorChecker.shouldGenerate(
|
||||
force: options.forceExecution,
|
||||
inputFilePath: options.inputFile,
|
||||
extensionFilePath: options.extensionFilePath
|
||||
extensionFilePath: fileToCompareToInput
|
||||
) else {
|
||||
print("[\(Self.toolName)] Images are already up to date :) ")
|
||||
return false
|
||||
|
@@ -18,12 +18,13 @@ enum ImagesError: Error {
|
||||
case magickConvertNotFound
|
||||
case writeFile(String, String)
|
||||
case createAssetFolder(String)
|
||||
case missingExtensionPath
|
||||
case unknown(String)
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .extensionNamesCollision(let extensionName):
|
||||
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||
return "error: [\(Images.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||
|
||||
case .inputFolderNotFound(let inputFolder):
|
||||
return "error: [\(Images.toolName)] Input folder not found: \(inputFolder)"
|
||||
@@ -47,7 +48,10 @@ enum ImagesError: Error {
|
||||
return "error: [\(Images.toolName)] An error occured while writing content to \(filename): \(subErrorDescription)"
|
||||
|
||||
case .createAssetFolder(let folder):
|
||||
return "error: [\(Colors.toolName)] An error occured while creating folder `\(folder)`"
|
||||
return "error: [\(Images.toolName)] An error occured while creating folder `\(folder)`"
|
||||
|
||||
case .missingExtensionPath:
|
||||
return "error: [\(Images.toolName)] Extension need to be generated but no `extensionOutputPath` is provided"
|
||||
|
||||
case .unknown(let errorDescription):
|
||||
return "error: [\(Images.toolName)] Unknown error: \(errorDescription)"
|
||||
|
@@ -24,17 +24,17 @@ struct ImagesOptions: ParsableArguments {
|
||||
@Option(help: "Xcassets path where to generate images.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var xcassetsPath: String
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an Image extension.")
|
||||
var extensionName: String = Images.defaultExtensionName
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String?
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.")
|
||||
var extensionNameUIKit: String = Images.defaultExtensionNameUIKit
|
||||
@Option(help: "SwiftUI extension name. If not specified, no extension will be generated.")
|
||||
var extensionName: String?
|
||||
|
||||
@Option(help: "UIKit extension name. If not specified, no extension will be generated.")
|
||||
var extensionNameUIKit: String?
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
|
||||
var extensionSuffix: String?
|
||||
@@ -46,28 +46,36 @@ extension ImagesOptions {
|
||||
|
||||
// MARK: - SwiftUI
|
||||
|
||||
var extensionFileName: String {
|
||||
var extensionFileName: String? {
|
||||
guard let extensionName else { return nil }
|
||||
|
||||
if let extensionSuffix {
|
||||
return "\(extensionName)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionName).swift"
|
||||
}
|
||||
|
||||
var extensionFilePath: String {
|
||||
"\(extensionOutputPath)/\(extensionFileName)"
|
||||
var extensionFilePath: String? {
|
||||
guard let extensionOutputPath, let extensionFileName else { return nil }
|
||||
|
||||
return "\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
|
||||
// MARK: - UIKit
|
||||
|
||||
var extensionFileNameUIKit: String {
|
||||
var extensionFileNameUIKit: String? {
|
||||
guard let extensionNameUIKit else { return nil }
|
||||
|
||||
if let extensionSuffix {
|
||||
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionNameUIKit).swift"
|
||||
}
|
||||
|
||||
var extensionFilePathUIKit: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
var extensionFilePathUIKit: String? {
|
||||
guard let extensionOutputPath, let extensionFileNameUIKit else { return nil }
|
||||
|
||||
return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
@@ -19,8 +19,7 @@ enum StringsFileGenerator {
|
||||
langs: [String],
|
||||
defaultLang: String,
|
||||
tags: [String],
|
||||
outputPath: String,
|
||||
inputFilenameWithoutExt: String
|
||||
lprojPathFormat: String
|
||||
) {
|
||||
|
||||
var stringsFilesContent = [String: String]()
|
||||
@@ -37,7 +36,7 @@ enum StringsFileGenerator {
|
||||
langs.forEach { lang in
|
||||
guard let fileContent = stringsFilesContent[lang] else { return }
|
||||
|
||||
let stringsFilePath = "\(outputPath)/\(lang).lproj/\(inputFilenameWithoutExt).strings"
|
||||
let stringsFilePath = String(format: lprojPathFormat, lang)
|
||||
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
|
||||
do {
|
||||
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
|
||||
@@ -54,8 +53,7 @@ enum StringsFileGenerator {
|
||||
langs: [String],
|
||||
defaultLang: String,
|
||||
tags: [String],
|
||||
outputPath: String,
|
||||
inputFilenameWithoutExt: String
|
||||
xcStringsFilePath: String
|
||||
) {
|
||||
|
||||
let fileContent: String = Self.generateXcStringsFileContent(
|
||||
@@ -65,12 +63,11 @@ enum StringsFileGenerator {
|
||||
sections: sections
|
||||
)
|
||||
|
||||
let stringsFilePath = "\(outputPath)/\(inputFilenameWithoutExt).xcstrings"
|
||||
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
|
||||
let stringsFilePathURL = URL(fileURLWithPath: xcStringsFilePath)
|
||||
do {
|
||||
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch {
|
||||
let error = StringiumError.writeFile(error.localizedDescription, stringsFilePath)
|
||||
let error = StringiumError.writeFile(error.localizedDescription, xcStringsFilePath)
|
||||
print(error.description)
|
||||
Stringium.exit(withError: error)
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ struct Stringium: ParsableCommand {
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Stringium"
|
||||
static let defaultExtensionName = "String"
|
||||
static let noTranslationTag: String = "notranslation"
|
||||
|
||||
// MARK: - Command options
|
||||
@@ -49,8 +48,7 @@ struct Stringium: ParsableCommand {
|
||||
langs: options.langs,
|
||||
defaultLang: options.defaultLang,
|
||||
tags: options.tags,
|
||||
outputPath: options.stringsFileOutputPath,
|
||||
inputFilenameWithoutExt: options.inputFilenameWithoutExt
|
||||
lprojPathFormat: options.lprojPathFormat
|
||||
)
|
||||
} else {
|
||||
StringsFileGenerator.writeXcStringsFiles(
|
||||
@@ -58,22 +56,25 @@ struct Stringium: ParsableCommand {
|
||||
langs: options.langs,
|
||||
defaultLang: options.defaultLang,
|
||||
tags: options.tags,
|
||||
outputPath: options.stringsFileOutputPath,
|
||||
inputFilenameWithoutExt: options.inputFilenameWithoutExt
|
||||
xcStringsFilePath: options.xcStringsFilePath
|
||||
)
|
||||
}
|
||||
|
||||
// Generate extension
|
||||
if let extensionName = options.extensionName,
|
||||
let extensionFilePath = options.extensionFilePath {
|
||||
print("Will generate extensions")
|
||||
StringsFileGenerator.writeExtensionFiles(
|
||||
sections: sections,
|
||||
defaultLang: options.defaultLang,
|
||||
tags: options.tags,
|
||||
staticVar: options.staticMembers,
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
extensionSuffix: options.extensionSuffix
|
||||
extensionName: extensionName,
|
||||
extensionFilePath: extensionFilePath,
|
||||
extensionSuffix: options.extensionSuffix ?? ""
|
||||
)
|
||||
}
|
||||
|
||||
print("[\(Self.toolName)] Strings generated")
|
||||
}
|
||||
@@ -104,10 +105,18 @@ struct Stringium: ParsableCommand {
|
||||
}
|
||||
|
||||
// Check if needed to regenerate
|
||||
let fileToCompareToInput: String = {
|
||||
// If there is no extension file to compare
|
||||
// Then check the xcassets file instead
|
||||
if options.xcStrings {
|
||||
return options.xcStringsFilePath
|
||||
}
|
||||
return String(format: options.lprojPathFormat, options.defaultLang)
|
||||
}()
|
||||
guard GeneratorChecker.shouldGenerate(
|
||||
force: options.forceGeneration,
|
||||
inputFilePath: options.inputFile,
|
||||
extensionFilePath: options.extensionFilePath
|
||||
extensionFilePath: fileToCompareToInput
|
||||
) else {
|
||||
print("[\(Self.toolName)] Strings are already up to date :) ")
|
||||
return false
|
||||
|
@@ -15,35 +15,51 @@ struct StringiumOptions: ParsableArguments {
|
||||
@Flag(name: [.customShort("f"), .customShort("F")], help: "Should force generation")
|
||||
var forceGeneration = false
|
||||
|
||||
@Argument(help: "Input files where strings are defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Argument(
|
||||
help: "Input files where strings are defined.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var inputFile: String
|
||||
|
||||
@Option(name: .customLong("output-path"), help: "Path where to strings file.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Option(
|
||||
name: .customLong("output-path"),
|
||||
help: "Path where to strings file.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath()}
|
||||
)
|
||||
fileprivate var outputPathRaw: String
|
||||
|
||||
@Option(name: .customLong("langs"), help: "Langs to generate.")
|
||||
@Option(
|
||||
name: .customLong("langs"),
|
||||
help: "Langs to generate."
|
||||
)
|
||||
fileprivate var langsRaw: String
|
||||
|
||||
@Option(help: "Default langs.")
|
||||
var defaultLang: String
|
||||
|
||||
@Option(name: .customLong("tags"), help: "Tags to generate.")
|
||||
@Option(
|
||||
name: .customLong("tags"),
|
||||
help: "Tags to generate."
|
||||
)
|
||||
fileprivate var tagsRaw: String = "ios iosonly iosOnly notranslation"
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
@Option(help: "Generate static properties. False by default")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Tell if it will generate xcStrings file or not")
|
||||
var xcStrings: Bool = false
|
||||
@Option(help: "Tell if it will generate xcStrings file or lproj file. True by default")
|
||||
var xcStrings: Bool = true
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an String extension.")
|
||||
var extensionName: String = Stringium.defaultExtensionName
|
||||
@Option(
|
||||
help: "Path where to generate the extension.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var extensionOutputPath: String?
|
||||
|
||||
@Option(help: "Extension name. If not specified, no extension will be generated.")
|
||||
var extensionName: String?
|
||||
|
||||
@Option(help: "Extension suffix: {extensionName}+{extensionSuffix}.swift")
|
||||
var extensionSuffix: String
|
||||
var extensionSuffix: String?
|
||||
}
|
||||
|
||||
// MARK: - Private var getter
|
||||
@@ -75,12 +91,21 @@ extension StringiumOptions {
|
||||
|
||||
extension StringiumOptions {
|
||||
|
||||
var extensionFileName: String {
|
||||
"\(extensionName)+\(extensionSuffix).swift"
|
||||
private var extensionFileName: String? {
|
||||
if let extensionName {
|
||||
if let extensionSuffix {
|
||||
return "\(extensionName)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionName).swift"
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var extensionFilePath: String {
|
||||
"\(extensionOutputPath)/\(extensionFileName)"
|
||||
var extensionFilePath: String? {
|
||||
if let extensionOutputPath, let extensionFileName {
|
||||
return "\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var inputFilenameWithoutExt: String {
|
||||
@@ -88,4 +113,12 @@ extension StringiumOptions {
|
||||
.deletingPathExtension()
|
||||
.lastPathComponent
|
||||
}
|
||||
|
||||
var xcStringsFilePath: String {
|
||||
"\(stringsFileOutputPath)/\(inputFilenameWithoutExt).xcstrings"
|
||||
}
|
||||
|
||||
var lprojPathFormat: String {
|
||||
"\(stringsFileOutputPath)/%@.lproj/\(inputFilenameWithoutExt).strings"
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt",
|
||||
style: ColorStyle.all.rawValue,
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Colors/Generated",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
@@ -34,8 +34,6 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
"all",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Colors/Generated",
|
||||
"--static-members",
|
||||
"false"
|
||||
]
|
||||
@@ -64,10 +62,10 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
"all",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Colors/Generated",
|
||||
"--static-members",
|
||||
"false",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Colors/Generated",
|
||||
"--extension-name",
|
||||
"AppUIColor",
|
||||
"--extension-name-ui-kit",
|
||||
|
@@ -17,7 +17,7 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: "Fonts/Generated",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
@@ -29,8 +29,6 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"projectDirectory/path/to/fonts.txt",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Fonts/Generated",
|
||||
"--static-members",
|
||||
"false"
|
||||
]
|
||||
@@ -54,10 +52,10 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
let expectedArguments = [
|
||||
"-f",
|
||||
"projectDirectory/path/to/fonts.txt",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Fonts/Generated",
|
||||
"--static-members",
|
||||
"true",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Fonts/Generated",
|
||||
"--extension-name",
|
||||
"AppUIFont",
|
||||
"--extension-name-ui-kit",
|
||||
|
@@ -18,7 +18,7 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
// Given
|
||||
let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt",
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Images/Generated",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
@@ -32,8 +32,6 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
"projectDirectory/path/to/images.txt",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Images/Generated",
|
||||
"--static-members",
|
||||
"false"
|
||||
]
|
||||
@@ -60,10 +58,10 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
"projectDirectory/path/to/images.txt",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Images/Generated",
|
||||
"--static-members",
|
||||
"true",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Images/Generated",
|
||||
"--extension-name",
|
||||
"AppUIImage",
|
||||
"--extension-name-ui-kit",
|
||||
|
Reference in New Issue
Block a user