Skip to content

Commit

Permalink
Reduce header depth and remove colon for release notes
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Jones <simonjones@vmware.com>
  • Loading branch information
simonjjones authored and robdimsdale committed Nov 22, 2024
1 parent f9f5eda commit 71948dd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 30 deletions.
21 changes: 14 additions & 7 deletions integration/summarize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ version = "3.4.5"
"",
"**Digest:** `sha256:manifest-sha`",
"",
"#### Included Buildpackages:",
"### Included Buildpackages",
"",
"| Name | ID | Version |",
"|---|---|---|",
"| Some Buildpack | some-buildpack | 1.2.3 |",
Expand All @@ -275,17 +276,20 @@ version = "3.4.5"
"",
"**ID:** `some-buildpack`",
"",
"#### Supported Stacks:",
"### Supported Stacks",
"",
"- `other-stack`",
"- `some-stack`",
"",
"#### Default Dependency Versions:",
"### Default Dependency Versions",
"",
"| ID | Version |",
"|---|---|",
"| other-dependency | 2.3.x |",
"| some-dependency | 1.2.x |",
"",
"#### Dependencies:",
"### Dependencies",
"",
"| Name | Version | Stacks | Checksum |",
"|---|---|---|---|",
"| other-dependency | 2.3.4 | other-stack | sha256:other-sha |",
Expand All @@ -300,17 +304,20 @@ version = "3.4.5"
"",
"**ID:** `other-buildpack`",
"",
"#### Supported Stacks:",
"### Supported Stacks",
"",
"- `first-stack`",
"- `second-stack`",
"",
"#### Default Dependency Versions:",
"### Default Dependency Versions",
"",
"| ID | Version |",
"|---|---|",
"| first-dependency | 4.5.x |",
"| second-dependency | 5.6.x |",
"",
"#### Dependencies:",
"### Dependencies",
"",
"| Name | Version | Stacks | Checksum |",
"|---|---|---|---|",
"| first-dependency | 4.5.6 | first-stack | sha256:first-sha |",
Expand Down
8 changes: 4 additions & 4 deletions internal/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func printImplementation(writer io.Writer, config cargo.Config) {
return config.Stacks[i].ID < config.Stacks[j].ID
})

fmt.Fprintf(writer, "#### Supported Stacks:\n")
fmt.Fprintf(writer, "### Supported Stacks\n\n")
for _, s := range config.Stacks {
fmt.Fprintf(writer, "- `%s`\n", s.ID)
}
fmt.Fprintln(writer)
}

if len(config.Metadata.DefaultVersions) > 0 {
fmt.Fprintf(writer, "#### Default Dependency Versions:\n| ID | Version |\n|---|---|\n")
fmt.Fprintf(writer, "### Default Dependency Versions\n\n| ID | Version |\n|---|---|\n")
var sortedDependencies []string
for key := range config.Metadata.DefaultVersions {
sortedDependencies = append(sortedDependencies, key)
Expand Down Expand Up @@ -104,7 +104,7 @@ func printImplementation(writer io.Writer, config cargo.Config) {
return iVal.ID < jVal.ID
})

fmt.Fprintf(writer, "#### Dependencies:\n| Name | Version | Stacks | Checksum |\n|---|---|---|---|\n")
fmt.Fprintf(writer, "### Dependencies\n\n| Name | Version | Stacks | Checksum |\n|---|---|---|---|\n")
for _, d := range sorted {
fmt.Fprintf(writer, "| %s | %s | %s | %s |\n", d.ID, d.Version, strings.Join(d.Stacks, " "), d.SHA256)
}
Expand All @@ -128,7 +128,7 @@ func (f Formatter) Markdown(entries []BuildpackMetadata) {
//Header section
fmt.Fprintf(f.writer, "## %s %s\n\n**ID:** `%s`\n\n", familyMetadata.Config.Buildpack.Name, familyMetadata.Config.Buildpack.Version, familyMetadata.Config.Buildpack.ID)
fmt.Fprintf(f.writer, "**Digest:** `%s`\n\n", familyMetadata.SHA256)
fmt.Fprintf(f.writer, "#### Included Buildpackages:\n")
fmt.Fprintf(f.writer, "### Included Buildpackages\n\n")
fmt.Fprintf(f.writer, "| Name | ID | Version |\n|---|---|---|\n")
for _, entry := range entries {
fmt.Fprintf(f.writer, "| %s | %s | %s |\n", entry.Config.Buildpack.Name, entry.Config.Buildpack.ID, entry.Config.Buildpack.Version)
Expand Down
32 changes: 13 additions & 19 deletions internal/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,20 @@ func testFormatter(t *testing.T, context spec.G, it spec.S) {
"",
"**Digest:** `sha256:some-buildpack-sha`",
"",
"#### Supported Stacks:",
"### Supported Stacks",
"",
"- `other-stack`",
"- `some-stack`",
"",
"#### Default Dependency Versions:",
"### Default Dependency Versions",
"",
"| ID | Version |",
"|---|---|",
"| other-dependency | 2.3.x |",
"| some-dependency | 1.2.x |",
"",
"#### Dependencies:",
"### Dependencies",
"",
"| Name | Version | Stacks | Checksum |",
"|---|---|---|---|",
"| other-dependency | 2.3.5 | other-stack | sha512:some-sha |",
Expand Down Expand Up @@ -123,12 +126,9 @@ func testFormatter(t *testing.T, context spec.G, it spec.S) {
},
})
Expect(buffer.String()).To(Equal(`## Some Buildpack some-version` +

"\n\n**ID:** `some-buildpack`\n\n" +

"**Digest:** `sha256:some-buildpack-sha`\n\n" +

"#### Supported Stacks:\n" +
"### Supported Stacks\n\n" +
"- `other-stack`\n" +
"- `some-stack`\n\n",
))
Expand Down Expand Up @@ -188,13 +188,15 @@ func testFormatter(t *testing.T, context spec.G, it spec.S) {
"",
"**Digest:** `sha256:some-buildpack-sha`",
"",
"#### Default Dependency Versions:",
"### Default Dependency Versions",
"",
"| ID | Version |",
"|---|---|",
"| other-dependency | 2.3.x |",
"| some-dependency | 1.2.x |",
"",
"#### Dependencies:",
"### Dependencies",
"",
"| Name | Version | Stacks | Checksum |",
"|---|---|---|---|",
"| other-dependency | 2.3.5 | other-stack | sha512:some-sha |",
Expand Down Expand Up @@ -274,14 +276,12 @@ func testFormatter(t *testing.T, context spec.G, it spec.S) {
},
})
Expect(buffer.String()).To(Equal(`## Order Buildpack order-version` +

"\n\n**ID:** `order-buildpack`\n\n" +

"**Digest:** `sha256:order-buildpack-sha`" +

`
#### Included Buildpackages:
### Included Buildpackages
| Name | ID | Version |
|---|---|---|
| Some Buildpack | some-buildpack | 1.2.3 |
Expand All @@ -307,27 +307,21 @@ func testFormatter(t *testing.T, context spec.G, it spec.S) {
<details>
<summary>Some Buildpack 1.2.3</summary>` +

"\n\n**ID:** `some-buildpack`\n\n" +

`---
</details>
<details>
<summary>Optional Buildpack 2.3.4</summary>` +

"\n\n**ID:** `optional-buildpack`\n\n" +

`---
</details>
<details>
<summary>Other Buildpack 3.4.5</summary>` +

"\n\n**ID:** `other-buildpack`\n\n" +

`---
</details>
Expand Down

0 comments on commit 71948dd

Please # to comment.