Compare commits
No commits in common. "eed20367b9c7fca0aba60c7e5baf147e68177001" and "d79af06c38b2c30c829100e2a0494e8da7d8b089" have entirely different histories.
eed20367b9
...
d79af06c38
@ -13,7 +13,7 @@
|
||||
- Update plist `UIAppFonts` when generated fonts (use plistBuddy)
|
||||
- New parameter: `infoPlistPaths`
|
||||
- Generate SwiftUI extensions for colors, fonts and images
|
||||
- New parameter: `extensionNameUIKit`
|
||||
- New parameter: `extensionNameSwiftUI`
|
||||
- Adding Makefile to install, unsintall and create man page.
|
||||
|
||||
## Fixes
|
||||
|
@ -1,75 +1,12 @@
|
||||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "collectionconcurrencykit",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
|
||||
"state" : {
|
||||
"revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95",
|
||||
"version" : "0.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "cryptoswift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
|
||||
"state" : {
|
||||
"revision" : "db51c407d3be4a051484a141bf0bff36c43d3b1e",
|
||||
"version" : "1.8.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "sourcekitten",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/jpsim/SourceKitten.git",
|
||||
"state" : {
|
||||
"revision" : "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
|
||||
"version" : "0.34.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-argument-parser",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-argument-parser",
|
||||
"state" : {
|
||||
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
|
||||
"version" : "1.2.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-syntax",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-syntax.git",
|
||||
"state" : {
|
||||
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
|
||||
"version" : "509.0.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swiftlint",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/SwiftLint.git",
|
||||
"state" : {
|
||||
"revision" : "f17a4f9dfb6a6afb0408426354e4180daaf49cee",
|
||||
"version" : "0.54.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swiftytexttable",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/scottrhoyt/SwiftyTextTable.git",
|
||||
"state" : {
|
||||
"revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
|
||||
"version" : "0.9.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swxmlhash",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/drmohundro/SWXMLHash.git",
|
||||
"state" : {
|
||||
"revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f",
|
||||
"version" : "7.0.2"
|
||||
"revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1",
|
||||
"version" : "1.1.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -77,8 +14,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/jpsim/Yams.git",
|
||||
"state" : {
|
||||
"revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
|
||||
"version" : "5.0.6"
|
||||
"revision" : "01835dc202670b5bb90d07f3eae41867e9ed29f6",
|
||||
"version" : "5.0.1"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -9,8 +9,7 @@ let package = Package(
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
|
||||
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.1"),
|
||||
.package(url: "https://github.com/realm/SwiftLint.git", .upToNextMajor(from: "0.54.0")),
|
||||
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.1")
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
@ -21,8 +20,7 @@ let package = Package(
|
||||
"ToolCore",
|
||||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||
"Yams"
|
||||
],
|
||||
plugins: [.plugin(name: "SwiftLintPlugin", package: "SwiftLint")]
|
||||
]
|
||||
),
|
||||
|
||||
// Helper targets
|
||||
|
28
README.md
28
README.md
@ -16,7 +16,7 @@ iOS required to use the **real name** of the font, this name can be different fr
|
||||
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/fonts.txt" \
|
||||
--extension-output-path "./Fonts/Generated" \
|
||||
--extension-name "AppFont" \
|
||||
--extension-name-ui-kit "UIAppFont" \
|
||||
--extension-name-swift-ui "SUIAppFont" \
|
||||
--extension-suffix "GreatApp" \
|
||||
--static-members true \
|
||||
--info-plist-paths "./path/one/to/Info.plist ./path/two/to/Info.plist"
|
||||
@ -27,8 +27,8 @@ swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/fonts.txt" \
|
||||
1. `-f`: force generation
|
||||
2. Font input folder, it will search for every `.ttf` and `.otf` files specified in `fonts.txt`
|
||||
3. `--extension-output-path`: path where to generate generated extension
|
||||
4. `--extension-name` *(optional)* : name of the class to add SwiftUI getters
|
||||
5. `--extension-name-ui-kit` *(optional)* : name of the class to add UIKit getters
|
||||
4. `--extension-name` *(optional)* : name of the class to add UIKit getters
|
||||
5. `--extension-name-swift-ui` *(optional)* : name of the class to add SwiftUI getters
|
||||
6. `--extension-suffix` *(optional)* : additional text which is added to the filename (ex: `AppFont+GreatApp.swift`)
|
||||
7. `--static-members` *(optional)*: generate static properties or not
|
||||
8. `--info-plist-paths` *(optional)*: array of `.plist`, you can specify multiple `Info.plist` for multiple targets
|
||||
@ -44,7 +44,7 @@ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
|
||||
--xcassets-path "./Colors/colors.xcassets" \
|
||||
--extension-output-path "./Colors/Generated/" \
|
||||
--extension-name "AppColor" \
|
||||
--extension-name-ui-kit "UIAppColor" \
|
||||
--extension-name-swift-ui "SUIAppColor" \
|
||||
--extension-suffix "GreatApp" \
|
||||
--static-members true
|
||||
```
|
||||
@ -55,8 +55,8 @@ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
|
||||
2. Input colors file
|
||||
3. `--style` can be `all` or `light`
|
||||
4. `--extension-output-path`: 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
|
||||
5. `--extension-name` *(optional)* : name of the class to add UIKit getters
|
||||
6. `--extension-name-swift-ui` *(optional)* : name of the class to add SwiftUI 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
|
||||
|
||||
@ -207,7 +207,7 @@ swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
|
||||
--xcassets-path "./Images/app.xcassets" \
|
||||
--extension-output-path "./Images/Generated" \
|
||||
--extension-name "AppImage" \
|
||||
--extension-name-ui-kit "UIAppImage" \
|
||||
--extension-name-swift-ui "SUIAppImage" \
|
||||
--extension-suffix "GreatApp" \
|
||||
--static-members true
|
||||
```
|
||||
@ -218,8 +218,8 @@ swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
|
||||
2. Input images definitions file
|
||||
3. `--xcassets-path`: xcasset path where to generate imagesets
|
||||
4. `--extension-output-path`: 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
|
||||
5. `--extension-name` *(optional)* : name of the class to add UIKit getters
|
||||
6. `--extension-name-swift-ui` *(optional)* : name of the class to add SwiftUI 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
|
||||
|
||||
@ -241,7 +241,7 @@ colors:
|
||||
xcassetsPath: String
|
||||
extensionOutputPath: String
|
||||
extensionName: String?
|
||||
extensionNameUIKit: String?
|
||||
extensionNameSwiftUI: String?
|
||||
extensionSuffix: String?
|
||||
staticMembers: Bool?
|
||||
|
||||
@ -250,7 +250,7 @@ fonts:
|
||||
inputFile: String
|
||||
extensionOutputPath: String
|
||||
extensionName: String?
|
||||
extensionNameUIKit: String?
|
||||
extensionNameSwiftUI: String?
|
||||
extensionSuffix: String?
|
||||
staticMembers: Bool?
|
||||
infoPlistPaths: [String]
|
||||
@ -261,7 +261,7 @@ images:
|
||||
xcassetsPath: String
|
||||
extensionOutputPath: String
|
||||
extensionName: String?
|
||||
extensionNameUIKit: String?
|
||||
extensionNameSwiftUI: String?
|
||||
extensionSuffix: String?
|
||||
staticMembers: Bool?
|
||||
|
||||
@ -301,7 +301,7 @@ colors:
|
||||
xcassetsPath: String
|
||||
extensionOutputPath: String
|
||||
extensionName: String?
|
||||
extensionNameUIKit: String?
|
||||
extensionNameSwiftUI: String?
|
||||
extensionSuffix: String?
|
||||
staticMembers: Bool?
|
||||
-
|
||||
@ -310,7 +310,7 @@ colors:
|
||||
xcassetsPath: String
|
||||
extensionOutputPath: String
|
||||
extensionName: String?
|
||||
extensionNameUIKit: String?
|
||||
extensionNameSwiftUI: String?
|
||||
extensionSuffix: String?
|
||||
staticMembers: Bool?
|
||||
...
|
||||
|
@ -81,7 +81,7 @@ class MatomoAnalyticsManager: AnalyticsManagerProtocol {
|
||||
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
||||
func logScreen(name: String, path: String) {
|
||||
var parameters = [
|
||||
AnalyticsParameterScreenName: name as NSObject
|
||||
AnalyticsParameterScreenName: name
|
||||
]
|
||||
|
||||
Analytics.logEvent(
|
||||
@ -96,25 +96,19 @@ class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
||||
category: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
var parameters: [String:NSObject] = [
|
||||
"action": action as NSObject,
|
||||
"category": category as NSObject,
|
||||
var parameters: [String:Any] = [
|
||||
"action": action,
|
||||
"category": category,
|
||||
]
|
||||
|
||||
if let supplementaryParameters = params {
|
||||
for (newKey, newValue) in supplementaryParameters {
|
||||
if parameters.contains(where: { (key: String, value: NSObject) in
|
||||
key == newKey
|
||||
}) {
|
||||
continue
|
||||
}
|
||||
|
||||
parameters[newKey] = newValue as? NSObject
|
||||
parameters.merge(supplementaryParameters) { (origin, new) -> Any in
|
||||
return origin
|
||||
}
|
||||
}
|
||||
|
||||
Analytics.logEvent(
|
||||
name.replacingOccurrences(of: [" "], with: "_"),
|
||||
name,
|
||||
parameters: parameters
|
||||
)
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ FORCE_FLAG="$1"
|
||||
## Font
|
||||
#swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
||||
# --extension-output-path "./Fonts/Generated" \
|
||||
# --extension-name "FontYolo" \
|
||||
# --extension-name-ui-kit "UIFontYolo" \
|
||||
# --extension-name "UIFontYolo" \
|
||||
# --extension-name-swift-ui "FontYolo" \
|
||||
# --extension-suffix "GenAllScript" \
|
||||
# --info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
||||
#
|
||||
@ -17,8 +17,8 @@ FORCE_FLAG="$1"
|
||||
# --style all \
|
||||
# --xcassets-path "./Colors/colors.xcassets" \
|
||||
# --extension-output-path "./Colors/Generated/" \
|
||||
# --extension-name "ColorYolo" \
|
||||
# --extension-name-ui-kit "UIhkjhkColorYolo" \
|
||||
# --extension-name "UIColorYolo" \
|
||||
# --extension-name-swift-ui "ColorYolo" \
|
||||
# --extension-suffix "GenAllScript"
|
||||
#
|
||||
#echo "\n-------------------------\n"
|
||||
@ -49,8 +49,8 @@ FORCE_FLAG="$1"
|
||||
# --extension-output-path "./Tags/Generated" \
|
||||
# --extension-name "Tags" \
|
||||
# --extension-suffix "GenAllScript"
|
||||
|
||||
#echo "\n-------------------------\n"
|
||||
#
|
||||
echo "\n-------------------------\n"
|
||||
|
||||
# Analytics
|
||||
swift run -c release ResgenSwift analytics $FORCE_FLAG "./Tags/sampleTags.yml" \
|
||||
@ -59,12 +59,12 @@ swift run -c release ResgenSwift analytics $FORCE_FLAG "./Tags/sampleTags.yml" \
|
||||
--extension-name "Analytics" \
|
||||
--extension-suffix "GenAllScript"
|
||||
|
||||
#echo "\n-------------------------\n"
|
||||
echo "\n-------------------------\n"
|
||||
#
|
||||
## Images
|
||||
#swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
|
||||
# --xcassets-path "./Images/imagium.xcassets" \
|
||||
# --extension-output-path "./Images/Generated" \
|
||||
# --extension-name "ImageYolo" \
|
||||
# --extension-name-ui-kit "UIImageYolo" \
|
||||
# --extension-name "UIImage" \
|
||||
# --extension-name-swift-ui "ImageYolo" \
|
||||
# --extension-suffix "GenAllScript"
|
||||
|
@ -47,8 +47,8 @@ images:
|
||||
inputFile: ./Images/sampleImages.txt
|
||||
xcassetsPath: ./Images/imagium.xcassets
|
||||
extensionOutputPath: ./Images/Generated
|
||||
extensionName: ImageYolo
|
||||
extensionNameUIKit: UIImageYolo
|
||||
extensionName: UIImage
|
||||
extensionNameSwiftUI: ImageYolo
|
||||
extensionSuffix: GenAllScript
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ colors:
|
||||
style: all
|
||||
xcassetsPath: ./Colors/colors.xcassets
|
||||
extensionOutputPath: ./Colors/Generated/
|
||||
extensionName: ColorYolo
|
||||
extensionNameUIKit: UIColorYolo
|
||||
extensionName: UIColorYolo
|
||||
extensionNameSwiftUI: ColorYolo
|
||||
extensionSuffix: GenAllScript
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ fonts:
|
||||
-
|
||||
inputFile: ./Fonts/sampleFontsAll.txt
|
||||
extensionOutputPath: ./Fonts/Generated
|
||||
extensionName: FontYolo
|
||||
extensionNameUIKit: UIFontYolo
|
||||
extensionName: UIFontYolo
|
||||
extensionNameSwiftUI: FontYolo
|
||||
extensionSuffix: GenAllScript
|
||||
infoPlistPaths: "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
||||
|
@ -18,6 +18,7 @@ struct Analytics: ParsableCommand {
|
||||
version: ResgenSwiftVersion
|
||||
)
|
||||
|
||||
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Analytics"
|
||||
|
@ -32,7 +32,7 @@ class AnalyticsGenerator {
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
do {
|
||||
try extensionFileContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = AnalyticsError.writeFile(extensionFilePath, error.localizedDescription)
|
||||
print(error.description)
|
||||
Analytics.exit(withError: error)
|
||||
|
@ -33,7 +33,7 @@ enum FirebaseGenerator {
|
||||
"""
|
||||
func logScreen(name: String, path: String) {
|
||||
var parameters = [
|
||||
AnalyticsParameterScreenName: name as NSObject
|
||||
AnalyticsParameterScreenName: name
|
||||
]
|
||||
|
||||
Analytics.logEvent(
|
||||
@ -53,25 +53,19 @@ enum FirebaseGenerator {
|
||||
category: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
var parameters: [String:NSObject] = [
|
||||
"action": action as NSObject,
|
||||
"category": category as NSObject,
|
||||
var parameters: [String:Any] = [
|
||||
"action": action,
|
||||
"category": category,
|
||||
]
|
||||
|
||||
if let supplementaryParameters = params {
|
||||
for (newKey, newValue) in supplementaryParameters {
|
||||
if parameters.contains(where: { (key: String, value: NSObject) in
|
||||
key == newKey
|
||||
}) {
|
||||
continue
|
||||
}
|
||||
|
||||
parameters[newKey] = newValue as? NSObject
|
||||
parameters.merge(supplementaryParameters) { (origin, new) -> Any in
|
||||
return origin
|
||||
}
|
||||
}
|
||||
|
||||
Analytics.logEvent(
|
||||
name.replacingOccurrences(of: [" "], with: "_"),
|
||||
name,
|
||||
parameters: parameters
|
||||
)
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class AnalyticsDefinition {
|
||||
// MARK: - Methods
|
||||
|
||||
func hasOneOrMoreMatchingTags(inputTags: [String]) -> Bool {
|
||||
if Set(inputTags).isDisjoint(with: tags) {
|
||||
if Set(inputTags).intersection(Set(self.tags)).isEmpty {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -21,8 +21,8 @@ struct Colors: ParsableCommand {
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Color"
|
||||
static let defaultExtensionName = "Color"
|
||||
static let defaultExtensionNameUIKit = "UIColor"
|
||||
static let defaultExtensionName = "UIColor"
|
||||
static let defaultExtensionNameSUI = "Color"
|
||||
static let assetsColorsFolderName = "Colors"
|
||||
|
||||
// MARK: - Command options
|
||||
@ -57,14 +57,14 @@ struct Colors: ParsableCommand {
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
isSwiftUI: true)
|
||||
isSwiftUI: false)
|
||||
|
||||
// Generate extension
|
||||
ColorExtensionGenerator.writeExtensionFile(colors: parsedColors,
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionNameUIKit,
|
||||
extensionFilePath: options.extensionFilePathUIKit,
|
||||
isSwiftUI: false)
|
||||
extensionName: options.extensionNameSwiftUI,
|
||||
extensionFilePath: options.extensionFilePathSwiftUI,
|
||||
isSwiftUI: true)
|
||||
|
||||
print("[\(Self.toolName)] Colors generated")
|
||||
}
|
||||
@ -89,7 +89,7 @@ struct Colors: ParsableCommand {
|
||||
}
|
||||
|
||||
// Extension for UIKit and SwiftUI should have different name
|
||||
guard options.extensionName != options.extensionNameUIKit else {
|
||||
guard options.extensionName != options.extensionNameSwiftUI else {
|
||||
let error = ColorsToolError.extensionNamesCollision(options.extensionName)
|
||||
print(error.description)
|
||||
Colors.exit(withError: error)
|
||||
|
@ -27,11 +27,11 @@ struct ColorsToolOptions: ParsableArguments {
|
||||
@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 Color extension.")
|
||||
@Option(help: "Extension name. If not specified, it will generate an UIColor extension.")
|
||||
var extensionName: String = Colors.defaultExtensionName
|
||||
|
||||
@Option(help: "SwiftUI Extension name. If not specified, it will generate an UIColor extension.")
|
||||
var extensionNameUIKit: String = Colors.defaultExtensionNameUIKit
|
||||
@Option(help: "SwiftUI Extension name. If not specified, it will generate an Color extension.")
|
||||
var extensionNameSwiftUI: String = Colors.defaultExtensionNameSUI
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
|
||||
var extensionSuffix: String?
|
||||
@ -41,7 +41,7 @@ struct ColorsToolOptions: ParsableArguments {
|
||||
|
||||
extension ColorsToolOptions {
|
||||
|
||||
// MARK: - SwiftUI
|
||||
// MARK: - UIKit
|
||||
|
||||
var extensionFileName: String {
|
||||
if let extensionSuffix = extensionSuffix {
|
||||
@ -54,16 +54,16 @@ extension ColorsToolOptions {
|
||||
"\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
|
||||
// MARK: - UIKit
|
||||
// MARK: - SwiftUI
|
||||
|
||||
var extensionFileNameUIKit: String {
|
||||
var extensionFileNameSwiftUI: String {
|
||||
if let extensionSuffix = extensionSuffix {
|
||||
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionNameUIKit).swift"
|
||||
return "\(extensionNameSwiftUI).swift"
|
||||
}
|
||||
|
||||
var extensionFilePathUIKit: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
var extensionFilePathSwiftUI: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ struct ColorExtensionGenerator {
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
do {
|
||||
try extensionContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = ColorsToolError.writeExtension(extensionFilePath, error.localizedDescription)
|
||||
print(error.description)
|
||||
Colors.exit(withError: error)
|
||||
|
@ -38,7 +38,7 @@ struct ColorXcassetHelper {
|
||||
let contentsJsonPathURL = URL(fileURLWithPath: contentsJsonPath)
|
||||
do {
|
||||
try color.contentsJSON().write(to: contentsJsonPathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = ColorsToolError.writeAsset(error.localizedDescription)
|
||||
print(error.description)
|
||||
Colors.exit(withError: error)
|
||||
|
@ -21,11 +21,11 @@ struct FontsOptions: ParsableArguments {
|
||||
@Option(help: "Tell if it will generate static properties or methods")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an Font extension.")
|
||||
@Option(help: "Extension name. If not specified, it will generate an UIFont 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, it will generate an Font extension.")
|
||||
var extensionNameSwiftUI: String = Fonts.defaultExtensionNameSUI
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+FontsMyApp.swift")
|
||||
var extensionSuffix: String = ""
|
||||
@ -38,7 +38,7 @@ struct FontsOptions: ParsableArguments {
|
||||
|
||||
extension FontsOptions {
|
||||
|
||||
// MARK: - SwiftUI
|
||||
// MARK: - UIKit
|
||||
|
||||
var extensionFileName: String {
|
||||
if extensionSuffix.isEmpty == false {
|
||||
@ -51,17 +51,17 @@ extension FontsOptions {
|
||||
"\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
|
||||
// MARK: - UIKit
|
||||
// MARK: - SwiftUI
|
||||
|
||||
var extensionFileNameUIKit: String {
|
||||
var extensionFileNameSwiftUI: String {
|
||||
if extensionSuffix.isEmpty == false {
|
||||
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionNameUIKit).swift"
|
||||
return "\(extensionNameSwiftUI).swift"
|
||||
}
|
||||
|
||||
var extensionFilePathUIKit: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
var extensionFilePathSwiftUI: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
@ -21,8 +21,8 @@ struct Fonts: ParsableCommand {
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Fonts"
|
||||
static let defaultExtensionName = "Font"
|
||||
static let defaultExtensionNameUIKit = "UIFont"
|
||||
static let defaultExtensionName = "UIFont"
|
||||
static let defaultExtensionNameSUI = "Font"
|
||||
|
||||
// MARK: - Command Options
|
||||
|
||||
@ -52,13 +52,13 @@ struct Fonts: ParsableCommand {
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
isSwiftUI: true)
|
||||
isSwiftUI: false)
|
||||
|
||||
FontExtensionGenerator.writeExtensionFile(fontsNames: fontsNames,
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionNameUIKit,
|
||||
extensionFilePath: options.extensionFilePathUIKit,
|
||||
isSwiftUI: false)
|
||||
extensionName: options.extensionNameSwiftUI,
|
||||
extensionFilePath: options.extensionFilePathSwiftUI,
|
||||
isSwiftUI: true)
|
||||
|
||||
print("Info.plist has been updated with:")
|
||||
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames, infoPlistPaths: options.infoPlistPaths))")
|
||||
@ -79,7 +79,7 @@ struct Fonts: ParsableCommand {
|
||||
}
|
||||
|
||||
// Extension for UIKit and SwiftUI should have different name
|
||||
guard options.extensionName != options.extensionNameUIKit else {
|
||||
guard options.extensionName != options.extensionNameSwiftUI else {
|
||||
let error = FontsToolError.extensionNamesCollision(options.extensionName)
|
||||
print(error.description)
|
||||
Fonts.exit(withError: error)
|
||||
|
@ -36,7 +36,7 @@ class FontExtensionGenerator {
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
do {
|
||||
try extensionContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = FontsToolError.writeExtension(extensionFilePath, error.localizedDescription)
|
||||
print(error.description)
|
||||
Fonts.exit(withError: error)
|
||||
|
@ -5,6 +5,8 @@
|
||||
// Created by Thibaut Schmitt on 30/08/2022.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import Foundation
|
||||
import ArgumentParser
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct ArchitectureGenerator {
|
||||
let architectureFilePathURL = URL(fileURLWithPath: "\(filePath)/\(filename)")
|
||||
do {
|
||||
try architectureContent.write(to: architectureFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = GenerateError.writeFile(filename, error.localizedDescription)
|
||||
print(error.description)
|
||||
Generate.exit(withError: error)
|
||||
|
@ -127,7 +127,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let xcassetsPath: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionNameSwiftUI: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
@ -143,7 +143,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionNameSwiftUI: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?) {
|
||||
self.inputFile = inputFile
|
||||
@ -151,7 +151,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.xcassetsPath = xcassetsPath
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionNameSwiftUI = extensionNameSwiftUI
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
@ -164,7 +164,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Xcassets path: \(xcassetsPath)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
"""
|
||||
}
|
||||
@ -174,7 +174,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let inputFile: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionNameSwiftUI: String?
|
||||
let extensionSuffix: String?
|
||||
let infoPlistPaths: String?
|
||||
private let staticMembers: Bool?
|
||||
@ -189,14 +189,14 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
internal init(inputFile: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionNameSwiftUI: String?,
|
||||
extensionSuffix: String?,
|
||||
infoPlistPaths: String?,
|
||||
staticMembers: Bool?) {
|
||||
self.inputFile = inputFile
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionNameSwiftUI = extensionNameSwiftUI
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.infoPlistPaths = infoPlistPaths
|
||||
self.staticMembers = staticMembers
|
||||
@ -208,7 +208,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Input file: \(inputFile)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- InfoPlistPaths: \(infoPlistPaths ?? "-")
|
||||
"""
|
||||
@ -220,7 +220,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let xcassetsPath: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionNameSwiftUI: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
@ -235,14 +235,14 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionNameSwiftUI: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?) {
|
||||
self.inputFile = inputFile
|
||||
self.xcassetsPath = xcassetsPath
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionNameSwiftUI = extensionNameSwiftUI
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
@ -254,7 +254,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Xcassets path: \(xcassetsPath)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
"""
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ extension ColorsConfiguration: Runnable {
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionNameUIKit = extensionNameUIKit {
|
||||
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
||||
args += [
|
||||
"--extension-name-ui-kit",
|
||||
extensionNameUIKit
|
||||
"--extension-name-swift-ui",
|
||||
extensionNameSwiftUI
|
||||
]
|
||||
}
|
||||
if let extensionSuffix = extensionSuffix {
|
||||
|
@ -34,10 +34,10 @@ extension FontsConfiguration: Runnable {
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionNameUIKit = extensionNameUIKit {
|
||||
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
||||
args += [
|
||||
"--extension-name-ui-kit",
|
||||
extensionNameUIKit
|
||||
"--extension-name-swift-ui",
|
||||
extensionNameSwiftUI
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ extension ImagesConfiguration: Runnable {
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionNameUIKit = extensionNameUIKit {
|
||||
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
||||
args += [
|
||||
"--extension-name-ui-kit",
|
||||
extensionNameUIKit
|
||||
"--extension-name-swift-ui",
|
||||
extensionNameSwiftUI
|
||||
]
|
||||
}
|
||||
if let extensionSuffix = extensionSuffix {
|
||||
|
@ -10,3 +10,4 @@ import Foundation
|
||||
protocol Runnable {
|
||||
func run(projectDirectory: String, force: Bool)
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class ImageExtensionGenerator {
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
do {
|
||||
try extensionContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = ImagesError.writeFile(extensionFilePath, error.localizedDescription)
|
||||
print(error.description)
|
||||
Images.exit(withError: error)
|
||||
|
@ -21,8 +21,8 @@ struct Images: ParsableCommand {
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Images"
|
||||
static let defaultExtensionName = "Image"
|
||||
static let defaultExtensionNameUIKit = "UIImage"
|
||||
static let defaultExtensionName = "UIImage"
|
||||
static let defaultExtensionNameSUI = "Image"
|
||||
|
||||
// MARK: - Command Options
|
||||
|
||||
@ -58,14 +58,14 @@ struct Images: ParsableCommand {
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
isSwiftUI: true)
|
||||
isSwiftUI: false)
|
||||
|
||||
ImageExtensionGenerator.generateExtensionFile(images: imagesToGenerate,
|
||||
staticVar: options.staticMembers,
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: options.extensionNameUIKit,
|
||||
extensionFilePath: options.extensionFilePathUIKit,
|
||||
isSwiftUI: false)
|
||||
extensionName: options.extensionNameSwiftUI,
|
||||
extensionFilePath: options.extensionFilePathSwiftUI,
|
||||
isSwiftUI: true)
|
||||
|
||||
print("[\(Self.toolName)] Images generated")
|
||||
}
|
||||
@ -90,7 +90,7 @@ struct Images: ParsableCommand {
|
||||
_ = Images.getSvgConverterPath()
|
||||
|
||||
// Extension for UIKit and SwiftUI should have different name
|
||||
guard options.extensionName != options.extensionNameUIKit else {
|
||||
guard options.extensionName != options.extensionNameSwiftUI else {
|
||||
let error = ImagesError.extensionNamesCollision(options.extensionName)
|
||||
print(error.description)
|
||||
Images.exit(withError: error)
|
||||
|
@ -27,11 +27,11 @@ struct ImagesOptions: ParsableArguments {
|
||||
@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.")
|
||||
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.")
|
||||
var extensionName: String = Images.defaultExtensionName
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.")
|
||||
var extensionNameUIKit: String = Images.defaultExtensionNameUIKit
|
||||
@Option(help: "Extension name. If not specified, it will generate an Image extension.")
|
||||
var extensionNameSwiftUI: String = Images.defaultExtensionNameSUI
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
|
||||
var extensionSuffix: String?
|
||||
@ -41,7 +41,7 @@ struct ImagesOptions: ParsableArguments {
|
||||
|
||||
extension ImagesOptions {
|
||||
|
||||
// MARK: - SwiftUI
|
||||
// MARK: - UIKit
|
||||
|
||||
var extensionFileName: String {
|
||||
if let extensionSuffix = extensionSuffix {
|
||||
@ -54,17 +54,17 @@ extension ImagesOptions {
|
||||
"\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
|
||||
// MARK: - UIKit
|
||||
// MARK: - SwiftUI
|
||||
|
||||
var extensionFileNameUIKit: String {
|
||||
var extensionFileNameSwiftUI: String {
|
||||
if let extensionSuffix = extensionSuffix {
|
||||
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionNameUIKit).swift"
|
||||
return "\(extensionNameSwiftUI).swift"
|
||||
}
|
||||
|
||||
var extensionFilePathUIKit: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||
var extensionFilePathSwiftUI: String {
|
||||
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
@ -34,7 +34,7 @@ class StringsFileGenerator {
|
||||
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
|
||||
do {
|
||||
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = StringiumError.writeFile(error.localizedDescription, stringsFilePath)
|
||||
print(error.description)
|
||||
Stringium.exit(withError: error)
|
||||
@ -115,7 +115,7 @@ class StringsFileGenerator {
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
do {
|
||||
try extensionFileContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = StringiumError.writeFile(extensionFilePath, error.localizedDescription)
|
||||
print(error.description)
|
||||
Stringium.exit(withError: error)
|
||||
|
@ -22,7 +22,7 @@ class TagsGenerator {
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
do {
|
||||
try extensionFileContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch let error {
|
||||
} catch (let error) {
|
||||
let error = StringiumError.writeFile(extensionFilePath, error.localizedDescription)
|
||||
print(error.description)
|
||||
Stringium.exit(withError: error)
|
||||
|
@ -37,7 +37,7 @@ class Definition {
|
||||
}
|
||||
|
||||
func hasOneOrMoreMatchingTags(inputTags: [String]) -> Bool {
|
||||
if Set(inputTags).isDisjoint(with: tags) {
|
||||
if Set(inputTags).intersection(Set(self.tags)).isEmpty {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -27,3 +27,4 @@ struct Strings: ParsableCommand {
|
||||
}
|
||||
|
||||
//Strings.main()
|
||||
|
||||
|
@ -18,6 +18,7 @@ struct Tags: ParsableCommand {
|
||||
version: ResgenSwiftVersion
|
||||
)
|
||||
|
||||
|
||||
// MARK: - Static
|
||||
|
||||
static let toolName = "Tags"
|
||||
|
@ -21,7 +21,7 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Colors/Generated",
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionNameSwiftUI: nil,
|
||||
extensionSuffix: nil,
|
||||
staticMembers: false)
|
||||
// When
|
||||
@ -50,7 +50,7 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Colors/Generated",
|
||||
extensionName: "AppUIColor",
|
||||
extensionNameUIKit: "AppColor",
|
||||
extensionNameSwiftUI: "AppColor",
|
||||
extensionSuffix: "Testing",
|
||||
staticMembers: false)
|
||||
// When
|
||||
@ -70,7 +70,7 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
"false",
|
||||
"--extension-name",
|
||||
"AppUIColor",
|
||||
"--extension-name-ui-kit",
|
||||
"--extension-name-swift-ui",
|
||||
"AppColor",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
|
@ -19,7 +19,7 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: "Fonts/Generated",
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionNameSwiftUI: nil,
|
||||
extensionSuffix: nil,
|
||||
infoPlistPaths: nil,
|
||||
staticMembers: nil)
|
||||
@ -43,7 +43,7 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: "Fonts/Generated",
|
||||
extensionName: "AppUIFont",
|
||||
extensionNameUIKit: "AppFont",
|
||||
extensionNameSwiftUI: "AppFont",
|
||||
extensionSuffix: "Testing",
|
||||
infoPlistPaths: "path/to/plist1.plist path/to/plist2.plist",
|
||||
staticMembers: true)
|
||||
@ -60,7 +60,7 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
"true",
|
||||
"--extension-name",
|
||||
"AppUIFont",
|
||||
"--extension-name-ui-kit",
|
||||
"--extension-name-swift-ui",
|
||||
"AppFont",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
|
@ -20,7 +20,7 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Images/Generated",
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionNameSwiftUI: nil,
|
||||
extensionSuffix: nil,
|
||||
staticMembers: nil)
|
||||
|
||||
@ -47,7 +47,7 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Images/Generated",
|
||||
extensionName: "AppUIImage",
|
||||
extensionNameUIKit: "AppImage",
|
||||
extensionNameSwiftUI: "AppImage",
|
||||
extensionSuffix: "Testing",
|
||||
staticMembers: true)
|
||||
|
||||
@ -66,7 +66,7 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
"true",
|
||||
"--extension-name",
|
||||
"AppUIImage",
|
||||
"--extension-name-ui-kit",
|
||||
"--extension-name-swift-ui",
|
||||
"AppImage",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
|
@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Go to git repo root level
|
||||
cd $(git rev-parse --show-toplevel)
|
||||
|
||||
if [[ "$BUILD_DIR" == *"IBDesignables"* ]] || [[ "$BUILD_DIR" == *"Previews"* ]] ; then
|
||||
echo "not linting for IBDesignables/SwiftUI Previews builds";
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SWIFT_LINT=$(which swiftlint)
|
||||
|
||||
if [[ -z $SWIFT_LINT ]] ; then
|
||||
echo "warning: SwiftLint not installed, please download it from https://github.com/realm/SwiftLint"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $RUN_CLANG_STATIC_ANALYZER == "YES" ]] ; then
|
||||
time $SWIFT_LINT
|
||||
else
|
||||
COUNT=0
|
||||
|
||||
##### Check for modified git files #####
|
||||
FILES=$(git diff --name-only | grep -iv "^carthage" | grep -iv "^pods" | grep -iv "^vendor" | grep -v "R2" | grep ".swift$")
|
||||
if [ ! -z "$FILES" ]; then
|
||||
while read FILE_PATH; do
|
||||
export SCRIPT_INPUT_FILE_$COUNT=$FILE_PATH
|
||||
COUNT=$((COUNT + 1))
|
||||
done <<< "$FILES"
|
||||
fi
|
||||
|
||||
##### Check for modified files in unstaged/Staged area #####
|
||||
FILES=$(git diff --name-only --cached --diff-filter=d | grep -iv "^carthage" | grep -iv "^pods" | grep -iv "^vendor" | grep -v "R2" | grep ".swift$")
|
||||
if [ ! -z "$FILES" ]; then
|
||||
while read FILE_PATH; do
|
||||
export SCRIPT_INPUT_FILE_$COUNT=$FILE_PATH
|
||||
COUNT=$((COUNT + 1))
|
||||
done <<< "$FILES"
|
||||
fi
|
||||
|
||||
##### Make the count avilable as global variable #####
|
||||
export SCRIPT_INPUT_FILE_COUNT=$COUNT
|
||||
env | grep SCRIPT_INPUT_FILE_
|
||||
|
||||
if [[ COUNT -ne 0 ]] ; then
|
||||
time $SWIFT_LINT --use-script-input-files
|
||||
fi
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user