Skip to content

Commit

Permalink
Use a dynamic branch name in the README (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored May 2, 2024
1 parent b923d84 commit df25ae1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions features/scaffold-package-readme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Feature: Scaffold a README.md file for an existing package
"""
*This README.md is generated dynamically from the project's codebase
"""
And the {PACKAGE_PATH}/local/wp-cli/default-readme/README.md file should contain:
"""
wp package install wp-cli/default-readme:dev-master
"""
When I run `wp package uninstall wp-cli/default-readme`
Then STDOUT should contain:
"""
Expand Down
1 change: 1 addition & 0 deletions src/ScaffoldPackageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public function package_readme( $args, $assoc_args ) {
'package_short_name' => $bits[1],
'package_name_border' => str_pad( '', strlen( $composer_obj['name'] ), '=' ),
'package_description' => isset( $composer_obj['description'] ) ? $composer_obj['description'] : '',
'branch' => $branch,
'required_wp_cli_version' => ! empty( $composer_obj['require']['wp-cli/wp-cli'] ) ? str_replace( [ '~', '^', '>=' ], 'v', $composer_obj['require']['wp-cli/wp-cli'] ) : 'v1.3.0',
'shields' => '',
'has_commands' => false,
Expand Down
2 changes: 1 addition & 1 deletion templates/readme-installing.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ wp package install {{package_name}}:@stable
To install the latest development version of this package, use the following command instead:

```bash
wp package install {{package_name}}:dev-master
wp package install {{package_name}}:dev-{{branch}}
```

0 comments on commit df25ae1

Please sign in to comment.