Skip to content

Commit

Permalink
Sync generated README and final README (#108)
Browse files Browse the repository at this point in the history
Use generated README with one manual fix.  The manual fix prevents a
line from being too long in an example.

Remove trailing white space from generated README.

Fix README generation instructions

Remove duplicate blank lines

Simplify javadoc for the README

Better id description
  • Loading branch information
MarkEWaite authored Aug 10, 2023
1 parent d85efed commit 8385a24
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The README file samples are created during the maven `prepare-package` phase by
The base template for the generator is `src/test/resources/readme/README.tmpl`.

Update the README with the command:
* `mvn prepare`
* `mvn prepare-package`

## Security Issues

Expand Down
54 changes: 26 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
jenkins-badge-plugin
=========================
# Badge plugin

Jenkins plugin to add badges and build summary entries from a pipeline.

Expand Down Expand Up @@ -31,12 +30,12 @@ addBadge(icon: <icon>, text: <text>)
*
* icon: The icon for this badge
* text: The text for this badge
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
* link: (optional) The link to be added to this badge
*/
addBadge(icon: <icon>, text: <text>, id: <id>, link: <link>)
// addInfoBadge
// ------------------------------------------
Expand All @@ -51,12 +50,12 @@ addInfoBadge(text: <text>)
* all params
*
* text: The info text for this badge
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
* link: (optional) The link to be added to this badge
*/
addInfoBadge(text: <text>, id: <id>, link: <link>)
// addWarningBadge
// ------------------------------------------
Expand All @@ -71,12 +70,12 @@ addWarningBadge(text: <text>)
* all params
*
* text: The text for this warning badge
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
* link: (optional) The link to be added to this badge
*/
addWarningBadge(text: <text>, id: <id>, link: <link>)
// addErrorBadge
// ------------------------------------------
Expand All @@ -91,8 +90,7 @@ addErrorBadge(text: <text>)
* all params
*
* text: The text for this error badge
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
* link: (optional) The link to be added to this badge
*/
addErrorBadge(text: <text>, id: <id>, link: <link>)
Expand All @@ -105,8 +103,9 @@ Removes badges

```groovy
// removes badges. If no id is provided, all are removed.
// removes badges. If no id is provided all are removed.
// If an id is provided, remove badges with the matching id.
// removeBadges
// ------------------------------------------
Expand All @@ -119,8 +118,7 @@ removeBadges()
/**
* all params
*
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
*/
removeBadges(id: <id>)
Expand All @@ -147,8 +145,7 @@ addHtmlBadge(html: <html>)
* all params
*
* html: The html content to be used for this badge
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
*/
addHtmlBadge(html: <html>, id: <id>)
Expand All @@ -159,8 +156,9 @@ Removes html badges

```groovy
// removes html badges. If no id is provided, all are removed.
// If an id is provided, badges with the matching id are removed.
// removes html badges. If no id is provided all are removed.
// If an id is provided, remove badges with the matching id.
// removeHtmlBadges
// ------------------------------------------
Expand All @@ -173,12 +171,10 @@ removeHtmlBadges()
/**
* all params
*
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
*/
removeHtmlBadges(id: <id>)
```
```

## addShortText

Expand Down Expand Up @@ -241,12 +237,12 @@ createSummary(icon: <icon>)
* all params
*
* icon: The icon for this summary
* id: (optional) The id for this badge.
* This id can be used to selectively delete badges.
* id: (optional) Badge identifier. Selectively delete badges by id.
* text: (optional) The title text for this summary
*/
createSummary(icon: <icon>, id: <id>, text: <text>)
def summary = createSummary(icon)
summary.appendText(text, escapeHtml)
summary.appendText(text, escapeHtml, bold, italic, color)
Expand All @@ -258,8 +254,9 @@ Removes summaries

```groovy
// removes summaries. If no id is provided all are removed, otherwise
// only the summaries with a matching id.
// removes summaries. If no id is provided all are removed.
// If an id is provided, remove badges with the matching id.
// removeSummaries
// ------------------------------------------
Expand All @@ -272,13 +269,13 @@ removeSummaries()
/**
* all params
*
* id: (optional) The summary id. This id can be used to selectively delete summaries.
* id: (optional) Badge identifier. Selectively delete badges by id.
*/
removeSummaries(id: <id>)
```

## icons
## Icons

In addition to the default [16x16](https://github.com/jenkinsci/jenkins/tree/master/war/src/main/webapp/images/16x16) icons offered by Jenkins, badge plugin provides the following icons:

Expand All @@ -297,7 +294,7 @@ In addition to the default [16x16](https://github.com/jenkinsci/jenkins/tree/mas
- ![alt text](src/main/webapp/images/warning.gif "warning.gif") warning.gif
- ![alt text](src/main/webapp/images/yellow.gif "yellow.gif") yellow.gif

### other plugin icons
### Other plugin icons

Other plugin icons can be used by setting the path of the icon within the jenkins context. Don't forget the leading '/'.

Expand All @@ -311,3 +308,4 @@ The badge plugin uses by default the OWASP Markup Formatter to sanitize the HTML
Manage Jenkins -> Configure System -> Badge Plugin

![alt text](src/doc/config.png "Config")

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class AbstractStep extends Step {
private String id;

@DataBoundSetter
@OptionalParam(description = "The id for this badge. This id can be used to selectively delete badges.")
@OptionalParam(description = "Badge identifier. Selectively delete badges by id.")
public void setId(String id) {
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public String interpret(TagNode tagNode, JinjavaInterpreter jinjavaInterpreter)
} else {
sb.append(" * params");
}
sb.append("\n * \n");
sb.append("\n *\n");

stream(constructorParams).forEach(sb::append);
sb.append(" */\n");
Expand All @@ -82,7 +82,7 @@ public String interpret(TagNode tagNode, JinjavaInterpreter jinjavaInterpreter)


if (optionalParameterNames.length != 0) {
sb.append("/**\n * all params\n * \n");
sb.append("/**\n * all params\n *\n");
concat(stream(constructorParams), stream(optionalParameterNames)).forEach(sb::append);

sb.append(" */\n");
Expand Down
42 changes: 29 additions & 13 deletions src/test/resources/readme/README.tmpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
jenkins-badge-plugin
=========================
# Badge plugin

Jenkins plugin to add badges and build summary entries from a pipeline.

This plugin was forked from the [Groovy Postbuild Plugin](https://plugins.jenkins.io/groovy-postbuild) which will in future use the API from this plugin.


## addBadge

This method allows to add build badge icons.


![alt text](src/doc/badge.png "Badge")

```groovy
Expand All @@ -26,14 +23,15 @@ This method allows to add build badge icons.
{% describe_step com.jenkinsci.plugins.badge.dsl.AddErrorBadgeStep %}
```


## removeBadges

Removes badges

```groovy

// removes badges. If no id is provided all are removed, otherwise only the badges with a matching id
// removes badges. If no id is provided all are removed.
// If an id is provided, remove badges with the matching id.

{% describe_step com.jenkinsci.plugins.badge.dsl.RemoveBadgesStep %}
```

Expand All @@ -52,9 +50,11 @@ Removes html badges

```groovy

// removes html badges. If no id is provided all are removed, otherwise only the badges with a matching id
{% describe_step com.jenkinsci.plugins.badge.dsl.RemoveHtmlBadgesStep %}
```
// removes html badges. If no id is provided all are removed.
// If an id is provided, remove badges with the matching id.

{% describe_step com.jenkinsci.plugins.badge.dsl.RemoveHtmlBadgesStep
%} ```

## addShortText

Expand All @@ -74,23 +74,39 @@ Puts a badge with a short text

![alt text](src/doc/summary.png "Summary")


```groovy

// creates an entry in the build summary page and returns a summary object corresponding to this entry. The icon must be one of the 48x48 icons offered
// creates an entry in the build summary page and returns a summary
// object corresponding to this entry. The icon must be one of the 48x48
// icons offered.

{% describe_step com.jenkinsci.plugins.badge.dsl.CreateSummaryStep %}

def summary = createSummary(icon)
summary.appendText(text, escapeHtml)
summary.appendText(text, escapeHtml, bold, italic, color)
```
## icons

## removeSummaries

Removes summaries

```groovy

// removes summaries. If no id is provided all are removed.
// If an id is provided, remove badges with the matching id.

{% describe_step com.jenkinsci.plugins.badge.dsl.RemoveSummariesStep %}
```

## Icons

In addition to the default [16x16](https://github.com/jenkinsci/jenkins/tree/master/war/src/main/webapp/images/16x16) icons offered by Jenkins, badge plugin provides the following icons:

{% list_images src/main/webapp/images %}

### other plugin icons
### Other plugin icons

Other plugin icons can be used by setting the path of the icon within the jenkins context. Don't forget the leading '/'.

```groovy
Expand Down

0 comments on commit 8385a24

Please sign in to comment.