Skip to content

Commit

Permalink
Implement bundle.
Browse files Browse the repository at this point in the history
  • Loading branch information
igor committed Oct 18, 2017
1 parent 0cf59cd commit 0cd6fbf
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 0 deletions.
21 changes: 21 additions & 0 deletions DarvinDatabaserBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Darvin\DatabaserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* Databaser bundle
*/
class DarvinDatabaserBundle extends Bundle
{

}
37 changes: 37 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Darvin\DatabaserBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
// $rootNode = $treeBuilder->root('darvin_databaser');

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.

return $treeBuilder;
}
}
36 changes: 36 additions & 0 deletions DependencyInjection/DarvinDatabaserExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Darvin\DatabaserBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
*
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
*/
class DarvinDatabaserExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
// $configuration = new Configuration();
// $config = $this->processConfiguration($configuration, $configs);

$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('command.yml');
}
}
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DarvinDatabaserBundle
=====================
This bundle integrates "darvinstudio/databaser" with Symfony.

## Usage

### Pull database

```shell
$ /usr/bin/env php bin/console databaser:pull [-k|--key [KEY]] [-p|--password] [-P|--port [PORT]] <user@host> <project_path_remote> [<project_path_local>]
```
Examples:
```shell
$ /usr/bin/env php bin/console databaser:pull [email protected] www/example.com
$ /usr/bin/env php bin/console databaser:pull -P 123 [email protected] /var/www/example.com
```
### Push database
```shell
$ /usr/bin/env php bin/console databaser:push [-k|--key [KEY]] [-p|--password] [-P|--port [PORT]] <user@host> <project_path_remote> [<project_path_local>]
```
Examples:
```shell
$ /usr/bin/env php bin/console databaser:push [email protected] www/example.com
$ /usr/bin/env php bin/console databaser:push -P 123 [email protected] /var/www/example.com
```
21 changes: 21 additions & 0 deletions Resources/config/command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
parameters:
darvin_databaser.command.pull.class: Darvin\Databaser\Command\PullCommand
darvin_databaser.command.pull.name: "databaser:pull"

darvin_databaser.command.push.class: Darvin\Databaser\Command\PushCommand
darvin_databaser.command.push.name: "databaser:push"

services:
darvin_databaser.command.pull:
class: "%darvin_databaser.command.pull.class%"
arguments:
- "%darvin_databaser.command.pull.name%"
tags:
- { name: console.command }

darvin_databaser.command.push:
class: "%darvin_databaser.command.push.class%"
arguments:
- "%darvin_databaser.command.push.name%"
tags:
- { name: console.command }
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "darvinstudio/darvin-databaser-bundle",
"description": "This bundle integrates 'darvinstudio/databaser' with Symfony.",
"keywords": ["database"],
"type": "symfony-bundle",
"license": "MIT",
"authors": [
{
"name": "Darvin Studio",
"email": "[email protected]",
"homepage": "https://www.darvin-studio.ru"
}
],
"require": {
"darvinstudio/darvin-databaser": "*"
},
"autoload": {
"psr-4": { "Darvin\\DatabaserBundle\\": "" }
}
}

0 comments on commit 0cd6fbf

Please sign in to comment.