-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from elliottmangham/feature/db-connect
Database Connect
- Loading branch information
Showing
6 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# credit to: https://moquet.net/blog/distributing-php-cli/ | ||
|
||
box build | ||
|
||
mv cdev.phar /usr/local/bin/cdev-local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
namespace Creode\Cdev\Command\Env; | ||
|
||
use Creode\Cdev\Command\Env\EnvCommand; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class DbConnectEnvCommand extends EnvCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this->setName('env:db:connect'); | ||
$this->setDescription('Connects to database container'); | ||
|
||
$this->addOption( | ||
'path', | ||
'p', | ||
InputOption::VALUE_REQUIRED, | ||
'Path to run commands on. Defaults to the directory the command is run from', | ||
getcwd() | ||
); | ||
|
||
$this->addOption( | ||
'database', | ||
'd', | ||
InputOption::VALUE_REQUIRED, | ||
'The database to connect to', | ||
'website' | ||
); | ||
|
||
$this->addOption( | ||
'user', | ||
'u', | ||
InputOption::VALUE_REQUIRED, | ||
'The user to connect as', | ||
'webuser' | ||
); | ||
|
||
$this->addOption( | ||
'password', | ||
'w', | ||
InputOption::VALUE_REQUIRED, | ||
'The user password', | ||
'webpassword' | ||
); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->_environment->input($input); | ||
|
||
$output->writeln( | ||
$this->_environment->dbConnect() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters