Skip to content

Commit a292f69

Browse files
committed
merge master
2 parents 77ac2eb + 4e3c895 commit a292f69

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ Once you've done so, you can install this package with:
2020
$ wp package install vccw/scaffold-vccw:@stable
2121
```
2222

23+
## Customize your default site.yml
24+
25+
1. [Download default template from GitHub](https://raw.githubusercontent.com/vccw-team/scaffold-vccw/master/templates/site.yml.mustache).
26+
2. Edit it.
27+
3. Place it under the file name of `~/.wp-cli/vccw.yml.mustache`.
28+
2329
## Usage
2430

2531
```

cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function __invoke( $args, $assoc_args )
106106
}
107107

108108
$sitefile = WP_CLI\Utils\mustache_render(
109-
dirname( __FILE__ ) . '/templates/site.yml.mustache',
109+
Scaffold_VCCW::get_yml_template(),
110110
array(
111111
'host' => $assoc_args["host"],
112112
'ip' => $assoc_args["ip"],

lib/functions.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44

55
class Scaffold_VCCW
66
{
7+
/**
8+
* Get path to the mustache template.
9+
*
10+
* @return string Path to the template.
11+
*/
12+
public static function get_yml_template()
13+
{
14+
$home = getenv( 'HOME' );
15+
if ( !$home ) {
16+
// sometime in windows $HOME is not defined
17+
$home = getenv( 'HOMEDRIVE' ) . getenv( 'HOMEPATH' );
18+
}
19+
20+
$config = $home . '/.wp-cli';
21+
22+
if ( is_file( $config . '/vccw.yml.mustache' ) ) {
23+
return $config . '/vccw.yml.mustache';
24+
} else {
25+
return dirname( __FILE__ ) . '/../templates/site.yml.mustache';
26+
}
27+
}
28+
729
/**
830
* Get URL of the latest VCCW.
931
*

0 commit comments

Comments
 (0)