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

Add a --skip-install flag to package scaffolding #133

Merged
merged 1 commit into from
Aug 2, 2017
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This package implements the following commands:
Generate the files needed for a basic WP-CLI command.

~~~
wp scaffold package <name> [--description=<description>] [--homepage=<homepage>] [--dir=<dir>] [--license=<license>] [--require_wp_cli=<version>] [--skip-tests] [--skip-readme] [--force]
wp scaffold package <name> [--description=<description>] [--homepage=<homepage>] [--dir=<dir>] [--license=<license>] [--require_wp_cli=<version>] [--skip-tests] [--skip-readme] [--skip-install] [--force]
~~~

Default behavior is to create the following files:
Expand Down Expand Up @@ -61,6 +61,9 @@ WP-CLI `packages/local/` directory.
[--skip-readme]
Don't generate a README.md for the package.

[--skip-install]
Don't install the package after scaffolding.

[--force]
Overwrite files that already exist.

Expand Down
13 changes: 13 additions & 0 deletions features/scaffold-package.feature
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,16 @@ Feature: Scaffold WP-CLI commands
Success: Package installed.
"""
And the /tmp/wp-cli-home/foo directory should exist

Scenario: Scaffold a package but skip installation
Given an empty directory

When I run `wp scaffold package wp-cli/foo --skip-install`
Then STDOUT should contain:
"""
Success: Created package files
"""
And STDOUT should not contain:
"""
Installing package
"""
7 changes: 6 additions & 1 deletion src/ScaffoldPackageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class ScaffoldPackageCommand {
* [--skip-readme]
* : Don't generate a README.md for the package.
*
* [--skip-install]
* : Don't install the package after scaffolding.
*
* [--force]
* : Overwrite files that already exist.
*
Expand Down Expand Up @@ -121,7 +124,9 @@ public function package( $args, $assoc_args ) {
WP_CLI::runcommand( "scaffold package-readme {$package_dir} {$force_flag}", array( 'launch' => false ) );
}

WP_CLI::runcommand( "package install {$package_dir}", array( 'launch' => false ) );
if ( ! Utils\get_flag_value( $assoc_args, 'skip-install' ) ) {
WP_CLI::runcommand( "package install {$package_dir}", array( 'launch' => false ) );
}
}

/**
Expand Down