Skip to content

Commit

Permalink
Merge pull request #29 from moderntribe/fix/scaffold-env-file-path
Browse files Browse the repository at this point in the history
Fix scaffold env file paths
  • Loading branch information
borkweb authored Jul 15, 2020
2 parents a168ad8 + 8dcc7f8 commit a0bb1aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.9] - 2020-07-07
### Changed

- Fix an issue where the `tric init` command would not correctly pick up the existing environment files if not running from the plugin directory.

### Added

- Added the `TRIC_INTERACTIVE`, `TRIC_BUILD_PROMPT` and `TRIC_BUILD_SUBDIR` env var to the `tric info` report.

## [0.4.8] - 2020-07-02
### Added

Expand Down
6 changes: 3 additions & 3 deletions src/scaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
function write_tric_env_file( $plugin_path ) {
$mysql_root_password = getenv( 'MYSQL_ROOT_PASSWORD' );
$wp_http_port = getenv( 'WORDPRESS_HTTP_PORT');

$plugin_env = null;
$candidate_env_files = [
Expand All @@ -23,10 +22,11 @@ function write_tric_env_file( $plugin_path ) {
'.env.dist'
];
foreach ( $candidate_env_files as $candidate ) {
if ( ! file_exists( $candidate ) ) {
$candidate_full_path = rtrim( $plugin_path, '\\/' ) . '/' . ltrim( $candidate, '\\/' );
if ( ! file_exists( $candidate_full_path ) ) {
continue;
}
$plugin_env = file_get_contents( $plugin_path . '/' . $candidate );
$plugin_env = file_get_contents( $candidate_full_path );
break;
}

Expand Down
3 changes: 3 additions & 0 deletions src/tric.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ function tric_info() {
'TRIC_PLUGINS_DIR',
'TRIC_THEMES_DIR',
'TRIC_WP_DIR',
'TRIC_INTERACTIVE',
'TRIC_BUILD_PROMPT',
'TRIC_BUILD_SUBDIR',
'XDK',
'XDE',
'XDH',
Expand Down
2 changes: 1 addition & 1 deletion tric
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $args = args( [
] );

$cli_name = basename( $argv[0] );
const CLI_VERSION = '0.4.8';
const CLI_VERSION = '0.4.9';

$cli_header = implode( ' - ', [
light_cyan( $cli_name ) . ' version ' . light_cyan( CLI_VERSION ),
Expand Down

0 comments on commit a0bb1aa

Please sign in to comment.