Skip to content

Commit

Permalink
Merge pull request #222 from wp-cli/fix/wpcs-3.0-issues
Browse files Browse the repository at this point in the history
Update to WPCS v3
  • Loading branch information
swissspidy authored Aug 30, 2023
2 parents 5a14450 + 0171284 commit 9752708
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"wp-cli/scaffold-command": "^2"
},
"require-dev": {
"wp-cli/wp-cli-tests": "^3.0.11"
"wp-cli/wp-cli-tests": "^4"
},
"config": {
"process-timeout": 7200,
Expand Down
2 changes: 1 addition & 1 deletion scaffold-package-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
return;
}

$wpcli_scaffold_package_autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
$wpcli_scaffold_package_autoload = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $wpcli_scaffold_package_autoload ) ) {
require_once $wpcli_scaffold_package_autoload;
}
Expand Down
15 changes: 7 additions & 8 deletions src/ScaffoldPackageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function package( $args, $assoc_args ) {

$force = Utils\get_flag_value( $assoc_args, 'force' );

$package_root = dirname( dirname( __FILE__ ) );
$package_root = dirname( __DIR__ );
$template_path = $package_root . '/templates/';
$wp_cli_yml = <<<EOT
require:
Expand Down Expand Up @@ -236,7 +236,7 @@ public function package_readme( $args, $assoc_args ) {
$force = Utils\get_flag_value( $assoc_args, 'force' );
$branch = Utils\get_flag_value( $assoc_args, 'branch', 'master' );

$package_root = dirname( dirname( __FILE__ ) );
$package_root = dirname( __DIR__ );
$template_path = $package_root . '/templates/';

$bits = explode( '/', $composer_obj['name'] );
Expand Down Expand Up @@ -354,10 +354,10 @@ public function package_readme( $args, $assoc_args ) {
$bundled = ! empty( $composer_obj['extra']['bundled'] );
foreach ( [ 'using', 'installing', 'contributing', 'support' ] as $key ) {
if ( isset( $readme_sections[ $key ] ) ) {
$file = dirname( dirname( __FILE__ ) ) . '/templates/readme-' . $key . '.mustache';
$file = dirname( __DIR__ ) . '/templates/readme-' . $key . '.mustache';
if ( $bundled
&& file_exists( dirname( dirname( __FILE__ ) ) . '/templates/readme-' . $key . '-bundled.mustache' ) ) {
$file = dirname( dirname( __FILE__ ) ) . '/templates/readme-' . $key . '-bundled.mustache';
&& file_exists( dirname( __DIR__ ) . '/templates/readme-' . $key . '-bundled.mustache' ) ) {
$file = dirname( __DIR__ ) . '/templates/readme-' . $key . '-bundled.mustache';
}
$readme_sections[ $key ]['body'] = $file;
}
Expand Down Expand Up @@ -459,7 +459,7 @@ public function package_github( $args, $assoc_args ) {
self::check_if_valid_package_dir( $package_dir );

$force = Utils\get_flag_value( $assoc_args, 'force' );
$template_path = dirname( dirname( __FILE__ ) ) . '/templates';
$template_path = dirname( __DIR__ ) . '/templates';

$composer_obj = json_decode( file_get_contents( $package_dir . '/composer.json' ), true );
$settings_vars = [
Expand Down Expand Up @@ -650,7 +650,7 @@ public function package_tests( $args, $assoc_args ) {
Process::create( Utils\esc_cmd( 'mkdir %s', $features_dir ) )->run();
}

$package_root = dirname( dirname( __FILE__ ) );
$package_root = dirname( __DIR__ );

// Only create a sample feature file when none exist
if ( ! glob( $features_dir . '/*.feature' ) ) {
Expand Down Expand Up @@ -798,5 +798,4 @@ private static function check_if_valid_package_dir( $package_dir ) {
WP_CLI::error( 'Invalid package directory. composer.json file must be present.' );
}
}

}

0 comments on commit 9752708

Please sign in to comment.