Skip to content

Commit

Permalink
Merge pull request #1285 from DavidHayden87/assembly-title
Browse files Browse the repository at this point in the history
Use AssemblyTitle if no title is specified in a project template
  • Loading branch information
forki committed Dec 3, 2015
2 parents b1bb957 + 15bab27 commit 28170a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
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

0 comments on commit 28170a6

Please sign in to comment.