4 Commits

24 changed files with 447 additions and 221 deletions

View File

@@ -2,13 +2,13 @@
ResgenSwift is a package, fully written in Swift, to help you automatize ressource update and generation. 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 ## 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`. 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** **Example**
@@ -54,12 +54,13 @@ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
1. `-f`: force generation 1. `-f`: force generation
2. Input colors file 2. Input colors file
3. `--style` can be `all` or `light` 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 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-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`) 7. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppColor+GreatApp.swift`)
8. `--static-members` *(optional)*: generate static properties or not 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 ## Strings
@@ -266,7 +267,7 @@ events:
## Images ## 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 ```sh
swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \ 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 1. `-f`: force generation
2. Input images definitions file 2. Input images definitions file
3. `--xcassets-path`: xcasset path where to generate imagesets 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 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-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`) 6. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppImage+GreatApp.swift`)
7. `--static-members` *(optional)*: generate static properties or not 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 > ⚠️ 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 ## All at once

View File

@@ -1,4 +1,4 @@
// Generated by ResgenSwift.Color 1.2 // Generated by ResgenSwift.Color 2.1.0
import UIKit import UIKit

View File

@@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View 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"
}

View File

@@ -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 // Check if needed to regenerate
let fileToCompareToInput: String = { let fileToCompareToInput: String = {
// If there is no extension file to compare // If there is no extension file to compare

View File

@@ -17,11 +17,12 @@ enum ColorsToolError: Error {
case fileNotExists(String) case fileNotExists(String)
case badColorDefinition(String, String) case badColorDefinition(String, String)
case deleteExistingColors(String) case deleteExistingColors(String)
case missingExtensionPath
var description: String { var description: String {
switch self { switch self {
case .extensionNamesCollision(let extensionName): 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): 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\"" 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): case .deleteExistingColors(let assetsFolder):
return "error: [\(Colors.toolName)] An error occured while deleting colors folder `\(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"
} }
} }
} }

View File

@@ -24,16 +24,16 @@ struct ColorsToolOptions: ParsableArguments {
@Option(help: "Path of xcassets where to generate colors", transform: { $0.replaceTiltWithHomeDirectoryPath() }) @Option(help: "Path of xcassets where to generate colors", transform: { $0.replaceTiltWithHomeDirectoryPath() })
var xcassetsPath: String 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") @Option(help: "Tell if it will generate static properties or not")
var staticMembers: Bool = false 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? 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? var extensionNameUIKit: String?
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift") @Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
@@ -56,7 +56,7 @@ extension ColorsToolOptions {
} }
var extensionFilePath: String? { var extensionFilePath: String? {
guard let extensionFileName else { return nil } guard let extensionOutputPath, let extensionFileName else { return nil }
return "\(extensionOutputPath)/\(extensionFileName)" return "\(extensionOutputPath)/\(extensionFileName)"
} }
@@ -73,7 +73,7 @@ extension ColorsToolOptions {
} }
var extensionFilePathUIKit: String? { var extensionFilePathUIKit: String? {
guard let extensionFileNameUIKit else { return nil } guard let extensionOutputPath, let extensionFileNameUIKit else { return nil }
return "\(extensionOutputPath)/\(extensionFileNameUIKit)" return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
} }

View File

@@ -18,20 +18,20 @@ struct FontsOptions: ParsableArguments {
@Argument(help: "Input files where fonts ared defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() }) @Argument(help: "Input files where fonts ared defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
var inputFile: String 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") @Option(help: "Tell if it will generate static properties or methods")
var staticMembers: Bool = false 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.") @Option(help: "Extension name. If not specified, it will generate an Font extension.")
var extensionName: String = Fonts.defaultExtensionName var extensionName: String = Fonts.defaultExtensionName
@Option(help: "Extension name. If not specified, it will generate an UIFont extension.") @Option(help: "Extension name. If not specified, no extension will be generated.")
var extensionNameUIKit: String = Fonts.defaultExtensionNameUIKit var extensionNameUIKit: String?
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+FontsMyApp.swift") @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") @Option(name: .customLong("info-plist-paths"), help: "Info.plist paths (array). Will be used to update UIAppFonts content")
fileprivate var infoPlistPathsRaw: String = "" fileprivate var infoPlistPathsRaw: String = ""
@@ -44,7 +44,7 @@ extension FontsOptions {
// MARK: - SwiftUI // MARK: - SwiftUI
var extensionFileName: String { var extensionFileName: String {
if extensionSuffix.isEmpty == false { if let extensionSuffix {
return "\(extensionName)+\(extensionSuffix).swift" return "\(extensionName)+\(extensionSuffix).swift"
} }
return "\(extensionName).swift" return "\(extensionName).swift"
@@ -56,15 +56,19 @@ extension FontsOptions {
// MARK: - UIKit // MARK: - UIKit
var extensionFileNameUIKit: String { var extensionFileNameUIKit: String? {
if extensionSuffix.isEmpty == false { guard let extensionNameUIKit else { return nil }
if let extensionSuffix {
return "\(extensionNameUIKit)+\(extensionSuffix).swift" return "\(extensionNameUIKit)+\(extensionSuffix).swift"
} }
return "\(extensionNameUIKit).swift" return "\(extensionNameUIKit).swift"
} }
var extensionFilePathUIKit: String { var extensionFilePathUIKit: String? {
"\(extensionOutputPath)/\(extensionFileNameUIKit)" guard let extensionFileNameUIKit else { return nil }
return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
} }
// MARK: - // MARK: -

View File

@@ -22,7 +22,6 @@ struct Fonts: ParsableCommand {
static let toolName = "Fonts" static let toolName = "Fonts"
static let defaultExtensionName = "Font" static let defaultExtensionName = "Font"
static let defaultExtensionNameUIKit = "UIFont"
// MARK: - Command Options // MARK: - Command Options
@@ -61,16 +60,25 @@ struct Fonts: ParsableCommand {
isSwiftUI: true isSwiftUI: true
) )
FontExtensionGenerator.writeExtensionFile( if let extensionNameUIKit = options.extensionNameUIKit,
fontsNames: fontsNames, let extensionFilePathUIKit = options.extensionFilePathUIKit {
staticVar: options.staticMembers, FontExtensionGenerator.writeExtensionFile(
extensionName: options.extensionNameUIKit, fontsNames: fontsNames,
extensionFilePath: options.extensionFilePathUIKit, staticVar: options.staticMembers,
isSwiftUI: false extensionName: extensionNameUIKit,
) extensionFilePath: extensionFilePathUIKit,
isSwiftUI: false
)
}
print("Info.plist has been updated with:") if options.infoPlistPaths.isEmpty == false {
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames, infoPlistPaths: options.infoPlistPaths))") let plistUpdateFontsData = FontPlistGenerator.generatePlistUIAppsFontContent(
for: fontsNames,
infoPlistPaths: options.infoPlistPaths
)
print("Info.plist has been updated with:")
print(plistUpdateFontsData)
}
print("[\(Self.toolName)] Fonts generated") print("[\(Self.toolName)] Fonts generated")
} }

View File

@@ -14,6 +14,7 @@ enum FontsToolError: Error {
case inputFolderNotFound(String) case inputFolderNotFound(String)
case fileNotExists(String) case fileNotExists(String)
case writeExtension(String, String) case writeExtension(String, String)
case missingExtensionPath
var description: String { var description: String {
switch self { switch self {
@@ -31,6 +32,9 @@ enum FontsToolError: Error {
case let .writeExtension(filename, info): case let .writeExtension(filename, info):
return "error: [\(Fonts.toolName)] An error occured while writing extension in \(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"
} }
} }
} }

View File

@@ -131,7 +131,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
let inputFile: String let inputFile: String
let style: String let style: String
let xcassetsPath: String let xcassetsPath: String
let extensionOutputPath: String let extensionOutputPath: String?
let extensionName: String? let extensionName: String?
let extensionNameUIKit: String? let extensionNameUIKit: String?
let extensionSuffix: String? let extensionSuffix: String?
@@ -148,7 +148,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
inputFile: String, inputFile: String,
style: String, style: String,
xcassetsPath: String, xcassetsPath: String,
extensionOutputPath: String, extensionOutputPath: String?,
extensionName: String?, extensionName: String?,
extensionNameUIKit: String?, extensionNameUIKit: String?,
extensionSuffix: String?, extensionSuffix: String?,
@@ -170,7 +170,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
- Input file: \(inputFile) - Input file: \(inputFile)
- Style: \(style) - Style: \(style)
- Xcassets path: \(xcassetsPath) - Xcassets path: \(xcassetsPath)
- Extension output path: \(extensionOutputPath) - Extension output path: \(extensionOutputPath ?? "-")
- Extension name: \(extensionName ?? "-") - Extension name: \(extensionName ?? "-")
- Extension name UIKit: \(extensionNameUIKit ?? "-") - Extension name UIKit: \(extensionNameUIKit ?? "-")
- Extension suffix: \(extensionSuffix ?? "-") - Extension suffix: \(extensionSuffix ?? "-")
@@ -181,7 +181,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
struct FontsConfiguration: Codable, CustomDebugStringConvertible { struct FontsConfiguration: Codable, CustomDebugStringConvertible {
let inputFile: String let inputFile: String
let extensionOutputPath: String let extensionOutputPath: String?
let extensionName: String? let extensionName: String?
let extensionNameUIKit: String? let extensionNameUIKit: String?
let extensionSuffix: String? let extensionSuffix: String?
@@ -197,7 +197,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
internal init( internal init(
inputFile: String, inputFile: String,
extensionOutputPath: String, extensionOutputPath: String?,
extensionName: String?, extensionName: String?,
extensionNameUIKit: String?, extensionNameUIKit: String?,
extensionSuffix: String?, extensionSuffix: String?,
@@ -217,7 +217,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
""" """
Fonts configuration: Fonts configuration:
- Input file: \(inputFile) - Input file: \(inputFile)
- Extension output path: \(extensionOutputPath) - Extension output path: \(extensionOutputPath ?? "-")
- Extension name: \(extensionName ?? "-") - Extension name: \(extensionName ?? "-")
- Extension name UIKit: \(extensionNameUIKit ?? "-") - Extension name UIKit: \(extensionNameUIKit ?? "-")
- Extension suffix: \(extensionSuffix ?? "-") - Extension suffix: \(extensionSuffix ?? "-")
@@ -230,7 +230,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
let inputFile: String let inputFile: String
let xcassetsPath: String let xcassetsPath: String
let extensionOutputPath: String let extensionOutputPath: String?
let extensionName: String? let extensionName: String?
let extensionNameUIKit: String? let extensionNameUIKit: String?
let extensionSuffix: String? let extensionSuffix: String?
@@ -246,7 +246,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
internal init( internal init(
inputFile: String, inputFile: String,
xcassetsPath: String, xcassetsPath: String,
extensionOutputPath: String, extensionOutputPath: String?,
extensionName: String?, extensionName: String?,
extensionNameUIKit: String?, extensionNameUIKit: String?,
extensionSuffix: String?, extensionSuffix: String?,
@@ -266,7 +266,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
Images configuration: Images configuration:
- Input file: \(inputFile) - Input file: \(inputFile)
- Xcassets path: \(xcassetsPath) - Xcassets path: \(xcassetsPath)
- Extension output path: \(extensionOutputPath) - Extension output path: \(extensionOutputPath ?? "-")
- Extension name: \(extensionName ?? "-") - Extension name: \(extensionName ?? "-")
- Extension name UIKit: \(extensionNameUIKit ?? "-") - Extension name UIKit: \(extensionNameUIKit ?? "-")
- Extension suffix: \(extensionSuffix ?? "-") - Extension suffix: \(extensionSuffix ?? "-")
@@ -280,7 +280,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
let outputPath: String let outputPath: String
let langs: String let langs: String
let defaultLang: String let defaultLang: String
let extensionOutputPath: String let extensionOutputPath: String?
let extensionName: String? let extensionName: String?
let extensionSuffix: String? let extensionSuffix: String?
private let staticMembers: Bool? private let staticMembers: Bool?
@@ -305,7 +305,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
outputPath: String, outputPath: String,
langs: String, langs: String,
defaultLang: String, defaultLang: String,
extensionOutputPath: String, extensionOutputPath: String?,
extensionName: String?, extensionName: String?,
extensionSuffix: String?, extensionSuffix: String?,
staticMembers: Bool?, staticMembers: Bool?,
@@ -329,7 +329,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
- Output path: \(outputPath) - Output path: \(outputPath)
- Langs: \(langs) - Langs: \(langs)
- Default lang: \(defaultLang) - Default lang: \(defaultLang)
- Extension output path: \(extensionOutputPath) - Extension output path: \(extensionOutputPath ?? "-")
- Extension name: \(extensionName ?? "-") - Extension name: \(extensionName ?? "-")
- Extension suffix: \(extensionSuffix ?? "-") - Extension suffix: \(extensionSuffix ?? "-")
""" """

View File

@@ -27,29 +27,23 @@ extension ColorsConfiguration: Runnable {
style, style,
"--xcassets-path", "--xcassets-path",
xcassetsPath.prependIfRelativePath(projectDirectory), xcassetsPath.prependIfRelativePath(projectDirectory),
"--extension-output-path",
extensionOutputPath.prependIfRelativePath(projectDirectory),
"--static-members", "--static-members",
"\(staticMembersOptions)" "\(staticMembersOptions)"
] ]
if let extensionName { // Add optional parameters
args += [ [
"--extension-name", ("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
extensionName ("--extension-name", extensionName),
] ("--extension-name-ui-kit", extensionNameUIKit),
} ("--extension-suffix", extensionSuffix)
if let extensionNameUIKit { ].forEach { argumentName, argumentValue in
args += [ if let argumentValue {
"--extension-name-ui-kit", args += [
extensionNameUIKit argumentName,
] argumentValue
} ]
if let extensionSuffix { }
args += [
"--extension-suffix",
extensionSuffix
]
} }
return args return args

View File

@@ -23,32 +23,26 @@ extension FontsConfiguration: Runnable {
args += [ args += [
inputFile.prependIfRelativePath(projectDirectory), inputFile.prependIfRelativePath(projectDirectory),
"--extension-output-path",
extensionOutputPath.prependIfRelativePath(projectDirectory),
"--static-members", "--static-members",
"\(staticMembersOptions)" "\(staticMembersOptions)"
] ]
if let extensionName { // Add optional parameters
args += [ [
"--extension-name", ("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
extensionName ("--extension-name", extensionName),
] ("--extension-name-ui-kit", extensionNameUIKit),
} ("--extension-suffix", extensionSuffix)
if let extensionNameUIKit { ].forEach { argumentName, argumentValue in
args += [ if let argumentValue {
"--extension-name-ui-kit", args += [
extensionNameUIKit argumentName,
] argumentValue
} ]
}
if let extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
} }
// Add infoPlist paths
if let infoPlistPaths { if let infoPlistPaths {
let adjustedPlistPaths = infoPlistPaths let adjustedPlistPaths = infoPlistPaths
.split(separator: " ") .split(separator: " ")

View File

@@ -25,31 +25,23 @@ extension ImagesConfiguration: Runnable {
inputFile.prependIfRelativePath(projectDirectory), inputFile.prependIfRelativePath(projectDirectory),
"--xcassets-path", "--xcassets-path",
xcassetsPath.prependIfRelativePath(projectDirectory), xcassetsPath.prependIfRelativePath(projectDirectory),
"--extension-output-path",
extensionOutputPath.prependIfRelativePath(projectDirectory),
"--static-members", "--static-members",
"\(staticMembersOptions)" "\(staticMembersOptions)"
] ]
if let extensionName { // Add optional parameters
args += [ [
"--extension-name", ("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
extensionName ("--extension-name", extensionName),
] ("--extension-name-ui-kit", extensionNameUIKit),
} ("--extension-suffix", extensionSuffix)
].forEach { argumentName, argumentValue in
if let extensionNameUIKit { if let argumentValue {
args += [ args += [
"--extension-name-ui-kit", argumentName,
extensionNameUIKit argumentValue
] ]
} }
if let extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
} }
return args return args

View File

@@ -24,26 +24,24 @@ extension StringsConfiguration: Runnable {
langs, langs,
"--default-lang", "--default-lang",
defaultLang, defaultLang,
"--extension-output-path",
extensionOutputPath.prependIfRelativePath(projectDirectory),
"--static-members", "--static-members",
"\(staticMembersOptions)", "\(staticMembersOptions)",
"--xc-strings", "--xc-strings",
"\(xcStringsOptions)" "\(xcStringsOptions)"
] ]
if let extensionName { // Add optional parameters
args += [ [
"--extension-name", ("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
extensionName ("--extension-name", extensionName),
] ("--extension-suffix", extensionSuffix)
} ].forEach { argumentName, argumentValue in
if let argumentValue {
if let extensionSuffix { args += [
args += [ argumentName,
"--extension-suffix", argumentValue
extensionSuffix ]
] }
} }
Stringium.main(args) Stringium.main(args)

View File

@@ -21,8 +21,6 @@ struct Images: ParsableCommand {
// MARK: - Static // MARK: - Static
static let toolName = "Images" static let toolName = "Images"
static let defaultExtensionName = "Image"
static let defaultExtensionNameUIKit = "UIImage"
// MARK: - Command Options // MARK: - Command Options
@@ -55,23 +53,29 @@ struct Images: ParsableCommand {
) )
// Generate extension // Generate extension
ImageExtensionGenerator.generateExtensionFile( if let extensionName = options.extensionName,
images: imagesToGenerate, let extensionFilePath = options.extensionFilePath {
staticVar: options.staticMembers, ImageExtensionGenerator.generateExtensionFile(
inputFilename: options.inputFilenameWithoutExt, images: imagesToGenerate,
extensionName: options.extensionName, staticVar: options.staticMembers,
extensionFilePath: options.extensionFilePath, inputFilename: options.inputFilenameWithoutExt,
isSwiftUI: true extensionName: extensionName,
) extensionFilePath: extensionFilePath,
isSwiftUI: true
)
}
ImageExtensionGenerator.generateExtensionFile( if let extensionNameUIKit = options.extensionNameUIKit,
images: imagesToGenerate, let extensionFilePathUIKit = options.extensionFilePathUIKit {
staticVar: options.staticMembers, ImageExtensionGenerator.generateExtensionFile(
inputFilename: options.inputFilenameWithoutExt, images: imagesToGenerate,
extensionName: options.extensionNameUIKit, staticVar: options.staticMembers,
extensionFilePath: options.extensionFilePathUIKit, inputFilename: options.inputFilenameWithoutExt,
isSwiftUI: false extensionName: extensionNameUIKit,
) extensionFilePath: extensionFilePathUIKit,
isSwiftUI: false
)
}
print("[\(Self.toolName)] Images generated") print("[\(Self.toolName)] Images generated")
} }
@@ -96,17 +100,39 @@ struct Images: ParsableCommand {
_ = Self.getSvgConverterPath() _ = Self.getSvgConverterPath()
// Extension for UIKit and SwiftUI should have different name // Extension for UIKit and SwiftUI should have different name
guard options.extensionName != options.extensionNameUIKit else { if let extensionName = options.extensionName,
let error = ImagesError.extensionNamesCollision(options.extensionName) let extensionNameUIKit = options.extensionNameUIKit {
print(error.description) guard extensionName != extensionNameUIKit else {
Self.exit(withError: error) 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 // 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( guard GeneratorChecker.shouldGenerate(
force: options.forceExecution, force: options.forceExecution,
inputFilePath: options.inputFile, inputFilePath: options.inputFile,
extensionFilePath: options.extensionFilePath extensionFilePath: fileToCompareToInput
) else { ) else {
print("[\(Self.toolName)] Images are already up to date :) ") print("[\(Self.toolName)] Images are already up to date :) ")
return false return false

View File

@@ -18,12 +18,13 @@ enum ImagesError: Error {
case magickConvertNotFound case magickConvertNotFound
case writeFile(String, String) case writeFile(String, String)
case createAssetFolder(String) case createAssetFolder(String)
case missingExtensionPath
case unknown(String) case unknown(String)
var description: String { var description: String {
switch self { switch self {
case .extensionNamesCollision(let extensionName): 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): case .inputFolderNotFound(let inputFolder):
return "error: [\(Images.toolName)] Input folder not found: \(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)" return "error: [\(Images.toolName)] An error occured while writing content to \(filename): \(subErrorDescription)"
case .createAssetFolder(let folder): 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): case .unknown(let errorDescription):
return "error: [\(Images.toolName)] Unknown error: \(errorDescription)" return "error: [\(Images.toolName)] Unknown error: \(errorDescription)"

View File

@@ -24,17 +24,17 @@ struct ImagesOptions: ParsableArguments {
@Option(help: "Xcassets path where to generate images.", transform: { $0.replaceTiltWithHomeDirectoryPath() }) @Option(help: "Xcassets path where to generate images.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
var xcassetsPath: String 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") @Option(help: "Tell if it will generate static properties or not")
var staticMembers: Bool = false var staticMembers: Bool = false
@Option(help: "Extension name. If not specified, it will generate an Image extension.") @Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
var extensionName: String = Images.defaultExtensionName var extensionOutputPath: String?
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.") @Option(help: "SwiftUI extension name. If not specified, no extension will be generated.")
var extensionNameUIKit: String = Images.defaultExtensionNameUIKit 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") @Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
var extensionSuffix: String? var extensionSuffix: String?
@@ -46,28 +46,36 @@ extension ImagesOptions {
// MARK: - SwiftUI // MARK: - SwiftUI
var extensionFileName: String { var extensionFileName: String? {
guard let extensionName else { return nil }
if let extensionSuffix { if let extensionSuffix {
return "\(extensionName)+\(extensionSuffix).swift" return "\(extensionName)+\(extensionSuffix).swift"
} }
return "\(extensionName).swift" return "\(extensionName).swift"
} }
var extensionFilePath: String { var extensionFilePath: String? {
"\(extensionOutputPath)/\(extensionFileName)" guard let extensionOutputPath, let extensionFileName else { return nil }
return "\(extensionOutputPath)/\(extensionFileName)"
} }
// MARK: - UIKit // MARK: - UIKit
var extensionFileNameUIKit: String { var extensionFileNameUIKit: String? {
guard let extensionNameUIKit else { return nil }
if let extensionSuffix { if let extensionSuffix {
return "\(extensionNameUIKit)+\(extensionSuffix).swift" return "\(extensionNameUIKit)+\(extensionSuffix).swift"
} }
return "\(extensionNameUIKit).swift" return "\(extensionNameUIKit).swift"
} }
var extensionFilePathUIKit: String { var extensionFilePathUIKit: String? {
"\(extensionOutputPath)/\(extensionFileNameUIKit)" guard let extensionOutputPath, let extensionFileNameUIKit else { return nil }
return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
} }
// MARK: - // MARK: -

View File

@@ -19,8 +19,7 @@ enum StringsFileGenerator {
langs: [String], langs: [String],
defaultLang: String, defaultLang: String,
tags: [String], tags: [String],
outputPath: String, lprojPathFormat: String
inputFilenameWithoutExt: String
) { ) {
var stringsFilesContent = [String: String]() var stringsFilesContent = [String: String]()
@@ -37,7 +36,7 @@ enum StringsFileGenerator {
langs.forEach { lang in langs.forEach { lang in
guard let fileContent = stringsFilesContent[lang] else { return } 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) let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
do { do {
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8) try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
@@ -54,8 +53,7 @@ enum StringsFileGenerator {
langs: [String], langs: [String],
defaultLang: String, defaultLang: String,
tags: [String], tags: [String],
outputPath: String, xcStringsFilePath: String
inputFilenameWithoutExt: String
) { ) {
let fileContent: String = Self.generateXcStringsFileContent( let fileContent: String = Self.generateXcStringsFileContent(
@@ -65,12 +63,11 @@ enum StringsFileGenerator {
sections: sections sections: sections
) )
let stringsFilePath = "\(outputPath)/\(inputFilenameWithoutExt).xcstrings" let stringsFilePathURL = URL(fileURLWithPath: xcStringsFilePath)
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
do { do {
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8) try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
} catch { } catch {
let error = StringiumError.writeFile(error.localizedDescription, stringsFilePath) let error = StringiumError.writeFile(error.localizedDescription, xcStringsFilePath)
print(error.description) print(error.description)
Stringium.exit(withError: error) Stringium.exit(withError: error)
} }

View File

@@ -21,7 +21,6 @@ struct Stringium: ParsableCommand {
// MARK: - Static // MARK: - Static
static let toolName = "Stringium" static let toolName = "Stringium"
static let defaultExtensionName = "String"
static let noTranslationTag: String = "notranslation" static let noTranslationTag: String = "notranslation"
// MARK: - Command options // MARK: - Command options
@@ -49,8 +48,7 @@ struct Stringium: ParsableCommand {
langs: options.langs, langs: options.langs,
defaultLang: options.defaultLang, defaultLang: options.defaultLang,
tags: options.tags, tags: options.tags,
outputPath: options.stringsFileOutputPath, lprojPathFormat: options.lprojPathFormat
inputFilenameWithoutExt: options.inputFilenameWithoutExt
) )
} else { } else {
StringsFileGenerator.writeXcStringsFiles( StringsFileGenerator.writeXcStringsFiles(
@@ -58,22 +56,25 @@ struct Stringium: ParsableCommand {
langs: options.langs, langs: options.langs,
defaultLang: options.defaultLang, defaultLang: options.defaultLang,
tags: options.tags, tags: options.tags,
outputPath: options.stringsFileOutputPath, xcStringsFilePath: options.xcStringsFilePath
inputFilenameWithoutExt: options.inputFilenameWithoutExt
) )
} }
// Generate extension // Generate extension
StringsFileGenerator.writeExtensionFiles( if let extensionName = options.extensionName,
sections: sections, let extensionFilePath = options.extensionFilePath {
defaultLang: options.defaultLang, print("Will generate extensions")
tags: options.tags, StringsFileGenerator.writeExtensionFiles(
staticVar: options.staticMembers, sections: sections,
inputFilename: options.inputFilenameWithoutExt, defaultLang: options.defaultLang,
extensionName: options.extensionName, tags: options.tags,
extensionFilePath: options.extensionFilePath, staticVar: options.staticMembers,
extensionSuffix: options.extensionSuffix inputFilename: options.inputFilenameWithoutExt,
) extensionName: extensionName,
extensionFilePath: extensionFilePath,
extensionSuffix: options.extensionSuffix ?? ""
)
}
print("[\(Self.toolName)] Strings generated") print("[\(Self.toolName)] Strings generated")
} }
@@ -104,10 +105,18 @@ struct Stringium: ParsableCommand {
} }
// Check if needed to regenerate // 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( guard GeneratorChecker.shouldGenerate(
force: options.forceGeneration, force: options.forceGeneration,
inputFilePath: options.inputFile, inputFilePath: options.inputFile,
extensionFilePath: options.extensionFilePath extensionFilePath: fileToCompareToInput
) else { ) else {
print("[\(Self.toolName)] Strings are already up to date :) ") print("[\(Self.toolName)] Strings are already up to date :) ")
return false return false

View File

@@ -15,35 +15,51 @@ struct StringiumOptions: ParsableArguments {
@Flag(name: [.customShort("f"), .customShort("F")], help: "Should force generation") @Flag(name: [.customShort("f"), .customShort("F")], help: "Should force generation")
var forceGeneration = false 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 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 fileprivate var outputPathRaw: String
@Option(name: .customLong("langs"), help: "Langs to generate.") @Option(
name: .customLong("langs"),
help: "Langs to generate."
)
fileprivate var langsRaw: String fileprivate var langsRaw: String
@Option(help: "Default langs.") @Option(help: "Default langs.")
var defaultLang: String 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" fileprivate var tagsRaw: String = "ios iosonly iosOnly notranslation"
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() }) @Option(help: "Generate static properties. False by default")
var extensionOutputPath: String
@Option(help: "Tell if it will generate static properties or not")
var staticMembers: Bool = false var staticMembers: Bool = false
@Option(help: "Tell if it will generate xcStrings file or not") @Option(help: "Tell if it will generate xcStrings file or lproj file. True by default")
var xcStrings: Bool = false var xcStrings: Bool = true
@Option(help: "Extension name. If not specified, it will generate an String extension.") @Option(
var extensionName: String = Stringium.defaultExtensionName 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") @Option(help: "Extension suffix: {extensionName}+{extensionSuffix}.swift")
var extensionSuffix: String var extensionSuffix: String?
} }
// MARK: - Private var getter // MARK: - Private var getter
@@ -75,12 +91,21 @@ extension StringiumOptions {
extension StringiumOptions { extension StringiumOptions {
var extensionFileName: String { private var extensionFileName: String? {
"\(extensionName)+\(extensionSuffix).swift" if let extensionName {
if let extensionSuffix {
return "\(extensionName)+\(extensionSuffix).swift"
}
return "\(extensionName).swift"
}
return nil
} }
var extensionFilePath: String { var extensionFilePath: String? {
"\(extensionOutputPath)/\(extensionFileName)" if let extensionOutputPath, let extensionFileName {
return "\(extensionOutputPath)/\(extensionFileName)"
}
return nil
} }
var inputFilenameWithoutExt: String { var inputFilenameWithoutExt: String {
@@ -88,4 +113,12 @@ extension StringiumOptions {
.deletingPathExtension() .deletingPathExtension()
.lastPathComponent .lastPathComponent
} }
var xcStringsFilePath: String {
"\(stringsFileOutputPath)/\(inputFilenameWithoutExt).xcstrings"
}
var lprojPathFormat: String {
"\(stringsFileOutputPath)/%@.lproj/\(inputFilenameWithoutExt).strings"
}
} }

View File

@@ -19,7 +19,7 @@ final class ColorsConfigurationTests: XCTestCase {
let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt", let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue, style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets", xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Colors/Generated", extensionOutputPath: nil,
extensionName: nil, extensionName: nil,
extensionNameUIKit: nil, extensionNameUIKit: nil,
extensionSuffix: nil, extensionSuffix: nil,
@@ -34,8 +34,6 @@ final class ColorsConfigurationTests: XCTestCase {
"all", "all",
"--xcassets-path", "--xcassets-path",
"projectDirectory/path/to/assets.xcassets", "projectDirectory/path/to/assets.xcassets",
"--extension-output-path",
"projectDirectory/Colors/Generated",
"--static-members", "--static-members",
"false" "false"
] ]
@@ -64,10 +62,10 @@ final class ColorsConfigurationTests: XCTestCase {
"all", "all",
"--xcassets-path", "--xcassets-path",
"projectDirectory/path/to/assets.xcassets", "projectDirectory/path/to/assets.xcassets",
"--extension-output-path",
"projectDirectory/Colors/Generated",
"--static-members", "--static-members",
"false", "false",
"--extension-output-path",
"projectDirectory/Colors/Generated",
"--extension-name", "--extension-name",
"AppUIColor", "AppUIColor",
"--extension-name-ui-kit", "--extension-name-ui-kit",

View File

@@ -17,7 +17,7 @@ final class FontsConfigurationTests: XCTestCase {
func test_argsGeneration_requiredArgs() { func test_argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt", let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt",
extensionOutputPath: "Fonts/Generated", extensionOutputPath: nil,
extensionName: nil, extensionName: nil,
extensionNameUIKit: nil, extensionNameUIKit: nil,
extensionSuffix: nil, extensionSuffix: nil,
@@ -29,8 +29,6 @@ final class FontsConfigurationTests: XCTestCase {
// Expect // Expect
let expectedArguments = [ let expectedArguments = [
"projectDirectory/path/to/fonts.txt", "projectDirectory/path/to/fonts.txt",
"--extension-output-path",
"projectDirectory/Fonts/Generated",
"--static-members", "--static-members",
"false" "false"
] ]
@@ -54,10 +52,10 @@ final class FontsConfigurationTests: XCTestCase {
let expectedArguments = [ let expectedArguments = [
"-f", "-f",
"projectDirectory/path/to/fonts.txt", "projectDirectory/path/to/fonts.txt",
"--extension-output-path",
"projectDirectory/Fonts/Generated",
"--static-members", "--static-members",
"true", "true",
"--extension-output-path",
"projectDirectory/Fonts/Generated",
"--extension-name", "--extension-name",
"AppUIFont", "AppUIFont",
"--extension-name-ui-kit", "--extension-name-ui-kit",

View File

@@ -18,7 +18,7 @@ final class ImagesConfigurationTests: XCTestCase {
// Given // Given
let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt", let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets", xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Images/Generated", extensionOutputPath: nil,
extensionName: nil, extensionName: nil,
extensionNameUIKit: nil, extensionNameUIKit: nil,
extensionSuffix: nil, extensionSuffix: nil,
@@ -32,8 +32,6 @@ final class ImagesConfigurationTests: XCTestCase {
"projectDirectory/path/to/images.txt", "projectDirectory/path/to/images.txt",
"--xcassets-path", "--xcassets-path",
"projectDirectory/path/to/assets.xcassets", "projectDirectory/path/to/assets.xcassets",
"--extension-output-path",
"projectDirectory/Images/Generated",
"--static-members", "--static-members",
"false" "false"
] ]
@@ -60,10 +58,10 @@ final class ImagesConfigurationTests: XCTestCase {
"projectDirectory/path/to/images.txt", "projectDirectory/path/to/images.txt",
"--xcassets-path", "--xcassets-path",
"projectDirectory/path/to/assets.xcassets", "projectDirectory/path/to/assets.xcassets",
"--extension-output-path",
"projectDirectory/Images/Generated",
"--static-members", "--static-members",
"true", "true",
"--extension-output-path",
"projectDirectory/Images/Generated",
"--extension-name", "--extension-name",
"AppUIImage", "AppUIImage",
"--extension-name-ui-kit", "--extension-name-ui-kit",