Skip to content

Commit

Permalink
Merge pull request #171 from blg-nb/single-page-with-version-numbers
Browse files Browse the repository at this point in the history
Adds --add-version-numbers option to --single-page option
  • Loading branch information
mono0926 authored Dec 16, 2021
2 parents 41e6649 + 3a12bb0 commit 0e00fee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/LicensePlistCore/Entity/LicensePlistHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ struct LicensePlistHolder {
return LicensePlistHolder(root: root, items: items)
}

static func loadAllToRoot(licenses: [LicenseInfo]) -> LicensePlistHolder {
static func loadAllToRoot(licenses: [LicenseInfo], options: Options) -> LicensePlistHolder {
let rootItem: [[String: String]] = {
guard !licenses.isEmpty else { return [] }
let body = licenses
.compactMap { lincense in
return ["Type": "PSGroupSpecifier",
"Title": lincense.name,
"Title": lincense.name(withVersion: options.config.addVersionNumbers),
"FooterText": lincense.body
]
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/LicensePlistCore/Entity/PlistInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ struct PlistInfo {
Log.info("Directory created: \(outputPath)")

let holder = options.config.singlePage ?
LicensePlistHolder.loadAllToRoot(licenses: licenses) :
LicensePlistHolder.loadAllToRoot(licenses: licenses, options: options) :
LicensePlistHolder.load(licenses: licenses, options: options)
holder.write(to: outputPath.appendingPathComponent("\(options.prefix).plist"), itemsPath: itemsPath)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class LicensePlistHolderTests: XCTestCase {
func testLoad_allToRoot() throws {
let pods = CocoaPods(name: "name", nameSpecified: nil, version: nil)
let podsLicense = CocoaPodsLicense(library: pods, body: "'<body>")
let result = LicensePlistHolder.loadAllToRoot(licenses: [podsLicense])
let result = LicensePlistHolder.loadAllToRoot(licenses: [podsLicense], options: Options.empty)
let (root, items) = result.deserialized()
let rootItems = try XCTUnwrap(root["PreferenceSpecifiers"])
XCTAssertEqual(rootItems.count, 1)
Expand Down

0 comments on commit 0e00fee

Please sign in to comment.