Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
f1ca8e92b7 | |||
|
436bc4b2af | ||
e0e561ff7f | |||
ed4e9849e7 | |||
ddf1d2509f |
7
Makefile
7
Makefile
@@ -1,7 +1,6 @@
|
|||||||
SHELL = /bin/zsh
|
SHELL = /bin/zsh
|
||||||
|
|
||||||
#INSTALL_DIR ?= /usr/local/bin
|
INSTALL_DIR = /usr/local/bin
|
||||||
INSTALL_DIR = /tmp/ResgenYolo
|
|
||||||
|
|
||||||
MAN_DIR := /usr/local/share/man
|
MAN_DIR := /usr/local/share/man
|
||||||
MAN_PAGE_NAME = resgen-swift.1
|
MAN_PAGE_NAME = resgen-swift.1
|
||||||
@@ -14,7 +13,7 @@ BUILD_DIR = $(REPO_DIR)/.build
|
|||||||
|
|
||||||
# create-man-files:
|
# create-man-files:
|
||||||
# swift package plugin generate-manual
|
# swift package plugin generate-manual
|
||||||
# cp $(BUILDDIR)/plugins/GenerateManualPlugin/outputs/ResgenSwift/resgen-swift.1 $(REPODIR)/man/resgen-swift.1
|
# cp $(BUILDDIR)/plugins/GenerateManual/outputs/ResgenSwift/resgen-swift.1 $(REPODIR)/man/resgen-swift.1
|
||||||
|
|
||||||
# install-man-files:
|
# install-man-files:
|
||||||
# mkdir -p ${DESTDIR}${mandir}/man1
|
# mkdir -p ${DESTDIR}${mandir}/man1
|
||||||
@@ -23,7 +22,7 @@ BUILD_DIR = $(REPO_DIR)/.build
|
|||||||
create-and-install-man-files:
|
create-and-install-man-files:
|
||||||
swift package plugin generate-manual
|
swift package plugin generate-manual
|
||||||
mkdir -p ${MAN_DIR}/man1
|
mkdir -p ${MAN_DIR}/man1
|
||||||
cp $(BUILD_DIR)/plugins/GenerateManualPlugin/outputs/ResgenSwift/${MAN_PAGE_NAME} ${MAN_DIR}/man1/${MAN_PAGE_NAME}
|
cp $(BUILD_DIR)/plugins/GenerateManual/outputs/ResgenSwift/${MAN_PAGE_NAME} ${MAN_DIR}/man1/${MAN_PAGE_NAME}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build and install
|
# Build and install
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"originHash" : "fae67d9ce14b6664edc4151ad1a55b74d50d7281499f09eeca50b0376d0f837f",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "swift-argument-parser",
|
"identity" : "swift-argument-parser",
|
||||||
@@ -14,8 +15,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/lukepistrol/SwiftLintPlugin",
|
"location" : "https://github.com/lukepistrol/SwiftLintPlugin",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "87454f5c9ff4d644086aec2a0df1ffba678e7f3c",
|
"revision" : "8e785a9801fc7961fef3d41ccb81acb3bd3d9735",
|
||||||
"version" : "0.57.1"
|
"version" : "0.60.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -28,5 +29,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version" : 2
|
"version" : 3
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// swift-tools-version:5.9
|
// swift-tools-version:6.1
|
||||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
@@ -18,7 +18,7 @@ let package = Package(
|
|||||||
),
|
),
|
||||||
.package(
|
.package(
|
||||||
url: "https://github.com/lukepistrol/SwiftLintPlugin",
|
url: "https://github.com/lukepistrol/SwiftLintPlugin",
|
||||||
exact: "0.57.1"
|
exact: "0.60.0"
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
|
@@ -133,7 +133,7 @@ class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
|||||||
category: String,
|
category: String,
|
||||||
params: [String: Any]?
|
params: [String: Any]?
|
||||||
) {
|
) {
|
||||||
var parameters: [String:NSObject] = [
|
var parameters: [String: NSObject] = [
|
||||||
AnalyticsParameterItemName: name.replacingOccurrences(of: " ", with: "_") as NSObject
|
AnalyticsParameterItemName: name.replacingOccurrences(of: " ", with: "_") as NSObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ struct Analytics: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - Command Configuration
|
// MARK: - Command Configuration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Generate analytics extension file.",
|
abstract: "Generate analytics extension file.",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -79,7 +79,7 @@ enum FirebaseGenerator {
|
|||||||
category: String,
|
category: String,
|
||||||
params: [String: Any]?
|
params: [String: Any]?
|
||||||
) {
|
) {
|
||||||
var parameters: [String:NSObject] = [
|
var parameters: [String: NSObject] = [
|
||||||
AnalyticsParameterItemName: name.replacingOccurrences(of: " ", with: "_") as NSObject
|
AnalyticsParameterItemName: name.replacingOccurrences(of: " ", with: "_") as NSObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ struct Fonts: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - CommandConfiguration
|
// MARK: - CommandConfiguration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "A utility to generate an helpful etension to access your custom font from code and also Info.plist UIAppsFont content.",
|
abstract: "A utility to generate an helpful etension to access your custom font from code and also Info.plist UIAppsFont content.",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -13,7 +13,7 @@ struct Generate: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - CommandConfiguration
|
// MARK: - CommandConfiguration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "A utility to generate ressources based on a configuration file",
|
abstract: "A utility to generate ressources based on a configuration file",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -38,8 +38,8 @@ extension StringsConfiguration: Runnable {
|
|||||||
("--extension-suffix", extensionSuffix),
|
("--extension-suffix", extensionSuffix),
|
||||||
("--visibility", visibility),
|
("--visibility", visibility),
|
||||||
("--asset-bundle", assetBundle),
|
("--asset-bundle", assetBundle),
|
||||||
("--xc-strings", staticMembers?.description),
|
("--xc-strings", xcStrings?.description),
|
||||||
("--static-members", xcStrings?.description)
|
("--static-members", staticMembers?.description)
|
||||||
].forEach { argumentName, argumentValue in
|
].forEach { argumentName, argumentValue in
|
||||||
if let argumentValue {
|
if let argumentValue {
|
||||||
args += [
|
args += [
|
||||||
|
@@ -186,8 +186,6 @@ class XcassetsGenerator {
|
|||||||
atomically: false,
|
atomically: false,
|
||||||
encoding: .utf8
|
encoding: .utf8
|
||||||
)
|
)
|
||||||
|
|
||||||
print("\(parsedImage.name) -> Generated")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Success info
|
// Success info
|
||||||
|
@@ -13,7 +13,7 @@ struct Images: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - CommandConfiguration
|
// MARK: - CommandConfiguration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "A utility for generate images and an extension to access them easily.",
|
abstract: "A utility for generate images and an extension to access them easily.",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -175,22 +175,23 @@ enum StringsFileGenerator {
|
|||||||
guard section.hasOneOrMoreMatchingTags(tags: inputTags) else {
|
guard section.hasOneOrMoreMatchingTags(tags: inputTags) else {
|
||||||
return // Go to next section
|
return // Go to next section
|
||||||
}
|
}
|
||||||
|
print("DOUDOU")
|
||||||
|
section
|
||||||
|
.definitions
|
||||||
|
.forEach { definition in // swiftlint:disable:this closure_body_length
|
||||||
|
var skipDefinition = false
|
||||||
|
var isNoTranslation = false
|
||||||
|
|
||||||
section.definitions.forEach { definition in // swiftlint:disable:this closure_body_length
|
var localizationTab: [XCStringLocalization] = []
|
||||||
var skipDefinition = false
|
|
||||||
var isNoTranslation = false
|
|
||||||
|
|
||||||
var localizationTab: [XCStringLocalization] = []
|
guard definition.hasOneOrMoreMatchingTags(inputTags: inputTags) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if definition.hasOneOrMoreMatchingTags(inputTags: inputTags) == false {
|
if definition.tags.contains(Stringium.noTranslationTag) {
|
||||||
skipDefinition = true
|
isNoTranslation = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if definition.tags.contains(Stringium.noTranslationTag) {
|
|
||||||
isNoTranslation = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if !skipDefinition {
|
|
||||||
if isNoTranslation {
|
if isNoTranslation {
|
||||||
// Search for langs in yaml
|
// Search for langs in yaml
|
||||||
for lang in langs {
|
for lang in langs {
|
||||||
@@ -209,7 +210,9 @@ enum StringsFileGenerator {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Search for langs in twine
|
// Search for langs in twine
|
||||||
for (lang, value) in definition.translations where !value.isEmpty {
|
for (lang, value) in definition.translations
|
||||||
|
where langs.contains(lang) && !value.isEmpty {
|
||||||
|
print("DOUDOU-> generate for \(lang)")
|
||||||
let localization = XCStringLocalization(
|
let localization = XCStringLocalization(
|
||||||
lang: lang,
|
lang: lang,
|
||||||
content: XCStringLocalizationLangContent(
|
content: XCStringLocalizationLangContent(
|
||||||
@@ -219,7 +222,6 @@ enum StringsFileGenerator {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print("VALUE: \(value)")
|
|
||||||
localizationTab.append(localization)
|
localizationTab.append(localization)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,7 +239,6 @@ enum StringsFileGenerator {
|
|||||||
|
|
||||||
xcStringDefinitionTab.append(xcStringDefinition)
|
xcStringDefinitionTab.append(xcStringDefinition)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let xcStringContainer = XCStringDefinitionContainer(strings: xcStringDefinitionTab)
|
let xcStringContainer = XCStringDefinitionContainer(strings: xcStringDefinitionTab)
|
||||||
|
@@ -13,7 +13,7 @@ struct Stringium: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - Command Configuration
|
// MARK: - Command Configuration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Generate strings with custom scripts.",
|
abstract: "Generate strings with custom scripts.",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -11,7 +11,7 @@ import ToolCore
|
|||||||
|
|
||||||
struct Strings: ParsableCommand {
|
struct Strings: ParsableCommand {
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "A utility for generate strings.",
|
abstract: "A utility for generate strings.",
|
||||||
version: ResgenSwiftVersion,
|
version: ResgenSwiftVersion,
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ struct Tags: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - Command Configuration
|
// MARK: - Command Configuration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Generate tags extension file.",
|
abstract: "Generate tags extension file.",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -13,7 +13,7 @@ struct Twine: ParsableCommand {
|
|||||||
|
|
||||||
// MARK: - Command Configuration
|
// MARK: - Command Configuration
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Generate strings with twine.",
|
abstract: "Generate strings with twine.",
|
||||||
version: ResgenSwiftVersion
|
version: ResgenSwiftVersion
|
||||||
)
|
)
|
||||||
|
@@ -11,7 +11,7 @@ import ToolCore
|
|||||||
|
|
||||||
struct ResgenSwift: ParsableCommand {
|
struct ResgenSwift: ParsableCommand {
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "A utility for generate ressources.",
|
abstract: "A utility for generate ressources.",
|
||||||
version: ResgenSwiftVersion,
|
version: ResgenSwiftVersion,
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
category: String,
|
category: String,
|
||||||
params: [String: Any]?
|
params: [String: Any]?
|
||||||
) {
|
) {
|
||||||
var parameters: [String:NSObject] = [
|
var parameters: [String: NSObject] = [
|
||||||
AnalyticsParameterItemName: name.replacingOccurrences(of: " ", with: "_") as NSObject
|
AnalyticsParameterItemName: name.replacingOccurrences(of: " ", with: "_") as NSObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user