Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AssemblyTitle if no title is specified in a project template #1285

Merged
merged 1 commit into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/template-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ them as below:
The other general metadata properties are all optional, and map directly to the field of the same
name in the nupkg.

* title
* title (Inferred as the value of the `AssemblyTitleAttribute` if omitted in a project template)
* owners
* releaseNotes
* summary
Expand Down
5 changes: 5 additions & 0 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ let getAuthors attributes =
|> Array.map (fun s -> s.Trim())
|> List.ofArray)

let getTitle attributes =
attributes |> Seq.tryPick (function
| Title t -> Some t
| _ -> None)

let getDescription attributes =
attributes |> Seq.tryPick (function
| Description d -> Some d
Expand Down
16 changes: 11 additions & 5 deletions src/Paket.Core/PackageProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ let private merge buildConfig buildPlatform version projectFile templateFile =

match withVersion with
| { Contents = ProjectInfo(md, opt) } ->
let assembly,id,assemblyFileName = loadAssemblyId buildConfig buildPlatform projectFile
let attribs = loadAssemblyAttributes assemblyFileName assembly

let mergedOpt =
match opt.Title with
| Some _ -> opt
| None -> { opt with Title = getTitle attribs }

match md with
| Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, opt) }
| Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, mergedOpt) }
| _ ->
let assembly,id,assemblyFileName = loadAssemblyId buildConfig buildPlatform projectFile
let md = { md with Id = md.Id ++ Some id }

match md with
| Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, opt) }
| Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, mergedOpt) }
| _ ->
let attribs = loadAssemblyAttributes assemblyFileName assembly

let merged =
{ Id = md.Id
Expand All @@ -51,7 +57,7 @@ let private merge buildConfig buildPlatform version projectFile templateFile =
Environment.NewLine md
Environment.NewLine missing

| Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, opt) }
| Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, mergedOpt) }
| _ -> templateFile

let private convertToSymbols (projectFile : ProjectFile) templateFile =
Expand Down