Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Nov 16, 2016
2 parents 77ac2eb + 4e3c895 commit a292f69
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Once you've done so, you can install this package with:
$ wp package install vccw/scaffold-vccw:@stable
```

## Customize your default site.yml

1. [Download default template from GitHub](https://raw.githubusercontent.com/vccw-team/scaffold-vccw/master/templates/site.yml.mustache).
2. Edit it.
3. Place it under the file name of `~/.wp-cli/vccw.yml.mustache`.

## Usage

```
Expand Down
2 changes: 1 addition & 1 deletion cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function __invoke( $args, $assoc_args )
}

$sitefile = WP_CLI\Utils\mustache_render(
dirname( __FILE__ ) . '/templates/site.yml.mustache',
Scaffold_VCCW::get_yml_template(),
array(
'host' => $assoc_args["host"],
'ip' => $assoc_args["ip"],
Expand Down
22 changes: 22 additions & 0 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@

class Scaffold_VCCW
{
/**
* Get path to the mustache template.
*
* @return string Path to the template.
*/
public static function get_yml_template()
{
$home = getenv( 'HOME' );
if ( !$home ) {
// sometime in windows $HOME is not defined
$home = getenv( 'HOMEDRIVE' ) . getenv( 'HOMEPATH' );
}

$config = $home . '/.wp-cli';

if ( is_file( $config . '/vccw.yml.mustache' ) ) {
return $config . '/vccw.yml.mustache';
} else {
return dirname( __FILE__ ) . '/../templates/site.yml.mustache';
}
}

/**
* Get URL of the latest VCCW.
*
Expand Down

0 comments on commit a292f69

Please sign in to comment.