Skip to content

Commit

Permalink
Merge pull request #84 from mono0926/fix-latest_result.txt
Browse files Browse the repository at this point in the history
Sort each license before creating summary
  • Loading branch information
mono0926 authored Jan 28, 2018
2 parents a5eb529 + 6daf8a5 commit 087cecb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Sources/LicensePlistCore/Entity/HasName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ public protocol HasName {
var name: String { get }
var nameSpecified: String? { get }
}

extension Collection where Iterator.Element: HasName {
func sorted() -> [Iterator.Element] {
return sorted { $0.name.lowercased() < $1.name.lowercased() }
}
}
6 changes: 3 additions & 3 deletions Sources/LicensePlistCore/Entity/PlistInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ struct PlistInfo {

let config = options.config

let contents = (cocoaPodsLicenses.map { String(describing: $0) } +
githubLibraries.map { String(describing: $0) } +
manualLicenses.map { String(describing: $0) } +
let contents = (cocoaPodsLicenses.sorted().map { String(describing: $0) } +
githubLibraries.sorted().map { String(describing: $0) } +
manualLicenses.sorted().map { String(describing: $0) } +
["add-version-numbers: \(options.config.addVersionNumbers)", "LicensePlist Version: \(Consts.version)"])
.joined(separator: "\n\n")
let savePath = options.outputPath.appendingPathComponent("\(Consts.prefix).latest_result.txt")
Expand Down

0 comments on commit 087cecb

Please sign in to comment.