Skip to content

Commit 19b08da

Browse files
Merge pull request #27 from mrrobot47/add/support-for-mac
Updates for admin-tools
2 parents d86ee4d + ba9b01e commit 19b08da

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/Admin_Tools_Command.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ public function enable( $args, $assoc_args ) {
127127
$this->install();
128128
chdir( $this->site_data->site_fs_path );
129129

130-
$this->move_config_file( 'docker-compose-admin.mustache', $this->site_data->site_fs_path . '/docker-compose-admin.yml' );
130+
$docker_compose_data = [
131+
'ee_root_dir' => EE_ROOT_DIR,
132+
'db_path' => DB,
133+
'ee_admin_path' => '/var/www/htdocs/ee-admin',
134+
];
135+
$docker_compose_admin = EE\Utils\mustache_render( ADMIN_TEMPLATE_ROOT . '/docker-compose-admin.mustache', $docker_compose_data );
136+
$this->fs->dumpFile( $this->site_data->site_fs_path . '/docker-compose-admin.yml', $docker_compose_admin );
131137

132138
if ( EE::exec( 'docker-compose -f docker-compose.yml -f docker-compose-admin.yml up -d nginx' ) ) {
133139
EE::success( sprintf( 'admin-tools enabled for %s site.', $this->site_data->site_url ) );

templates/docker-compose-admin.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ services:
44

55
php:
66
volumes:
7-
- "/opt/easyengine/admin-tools:/var/www/htdocs/ee-admin:ro"
8-
- "/opt/easyengine/db/ee.sqlite:/opt/easyengine/db/ee.sqlite:ro"
7+
- "{{ee_root_dir}}/admin-tools:{{ee_admin_path}}:ro"
8+
- "{{db_path}}:{{db_path}}:ro"
99

1010
nginx:
1111
volumes:
12-
- "/opt/easyengine/admin-tools:/var/www/htdocs/ee-admin:ro"
13-
- "/opt/easyengine/db/ee.sqlite:/opt/easyengine/db/ee.sqlite:ro"
12+
- "{{ee_root_dir}}/admin-tools:{{ee_admin_path}}:ro"
13+
- "{{db_path}}:{{db_path}}:ro"

templates/index.mustache

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@ unset( $services['site_url'] );
7373

7474

7575
$scan = scandir( '{{ee_admin_path}}' );
76-
$tools = array_slice( $scan, 2 );
76+
$scan = array_diff( $scan, [ '.', '..', 'index.php' ] );
7777

78-
$tools = array_diff( $tools, [ 'index.php' ] );
78+
$tools = array_merge( $scan, [ 'nginx_status', 'ping', 'status' ] );
79+
if ( $services['mailhog_enabled'] ) {
80+
$tools[] = 'mailhog';
81+
}
82+
sort( $tools );
7983

8084
if ( ! $services['cache_nginx_fullpage'] ) {
8185
$tools = array_diff( $tools, [ 'pra' ] );

0 commit comments

Comments
 (0)