Skip to content

Commit

Permalink
Improve feedback during the begin command
Browse files Browse the repository at this point in the history
  • Loading branch information
Keoghan committed Sep 11, 2018
1 parent 8436a3e commit f33f4ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ getenv('HOST_MACHINE_NAME')

## Commands:

- `porter begin` - Migrate and seed the sqlite database, and publish config files to `~/.porter/config`. It will set Porter home to the working directory when you run the command. It will also download the required docker images.
- `porter begin {--home?} {--force?}` - Migrate and seed the sqlite database, and publish config files to `~/.porter/config`. It will set Porter home to the working directory when you run the command (or you can specify with the `--home` option). It will also download the required docker images.
- `porter start`
- `porter status` - show the status of containers
- `porter stop`
Expand Down
24 changes: 19 additions & 5 deletions app/Commands/Begin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,36 @@ class Begin extends BaseCommand
public function handle(): void
{
$force = $this->option('force');
$home = realpath($this->argument('home') ?: getcwd());
$home = realpath($this->argument('home') ?: $this->cli->currentWorkingDirectory());

if (! $force && Database::exists()) {
$this->error('Already began. If you definitely want to continue, you can force with the --force flag.');

$this->error("Already began, so we've stopped to avoid wiping your settings.");
$this->error("If you definitely want to continue, you can force with the --force flag.");
return;
}

$this->line("================");
$this->line("PREPARING PORTER");
$this->line("================");
$this->line("");

mkdir(config('porter.library_path'));

$this->call('vendor:publish', ['--provider' => AppServiceProvider::class]);
$this->callSilent('vendor:publish', ['--provider' => AppServiceProvider::class]);

Database::ensureExists($force);

$this->call('home', ['path' => $home]);
$this->info("Your Porter settings are stored in ".config('porter.library_path'));
$this->info("");

$this->callSilent('home', ['path' => $home]);

$this->info("Setting home to {$home}.");
$this->comment("This is the used as the root directory for your sites.");
$this->comment("If this is incorrect, you can change it using the 'porter home' command.");
$this->comment("");

$this->info("Retrieving docker images");
$this->porter->pullImages();
}
}

0 comments on commit f33f4ae

Please sign in to comment.