diff --git a/Command/DeploymentCommand.php b/Command/DeploymentCommand.php
index 27c734a..49c52a8 100644
--- a/Command/DeploymentCommand.php
+++ b/Command/DeploymentCommand.php
@@ -111,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
*/
public function write($message, $style = 'comment')
{
- $this->output->writeln('<%s>%s%s>', $style, $message, $style);
+ $this->output->writeln(sprintf('<%s>%s%s>', $style, $message, $style));
}
/**
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 704039e..ed27bda 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -68,9 +68,14 @@ protected function addRulesSection(ArrayNodeDefinition $node)
$node->children()
->arrayNode('rules')
->useAttributeAsKey('name')
- ->prototype('array')->children()
- ->arrayNode('ignore')->defaultValue(array())->ignoreExtraKeys()->end()
- ->arrayNode('force')->defaultValue(array())->ignoreExtraKeys()->end()
+ ->prototype('array')
+ ->children()
+ ->arrayNode('ignore')
+ ->useAttributeAsKey('ignore')->prototype('scalar')->end()
+ ->end()
+ ->arrayNode('force')
+ ->useAttributeAsKey('force')->prototype('scalar')->end()
+ ->end()
->end()
->end()
;
@@ -112,8 +117,12 @@ protected function addServersSection(ArrayNodeDefinition $node)
->scalarNode('username')->defaultNull()->end()
->scalarNode('password')->defaultNull()->end()
->scalarNode('path')->isRequired()->cannotBeEmpty()->end()
- ->arrayNode('rules')->defaultValue(array())->ignoreExtraKeys()->end()
- ->arrayNode('commands')->defaultValue(array())->ignoreExtraKeys()->end()
+ ->arrayNode('rules')
+ ->useAttributeAsKey('rules')->prototype('scalar')->end()
+ ->end()
+ ->arrayNode('commands')
+ ->useAttributeAsKey('commands')->prototype('scalar')->end()
+ ->end()
->end()
->end()
;
diff --git a/Deployer/Config.php b/Deployer/Config.php
index 671ecd1..8b6e50c 100755
--- a/Deployer/Config.php
+++ b/Deployer/Config.php
@@ -87,8 +87,8 @@ protected function getConnectionConfig($server)
protected function getRulesConfig($server)
{
$config = array(
- 'ignore' => array(),
- 'force' => array()
+ 'ignore' => array(),
+ 'force' => array()
);
$parameters = array_keys($config);
diff --git a/Deployer/Deployer.php b/Deployer/Deployer.php
index c8daec5..e3a8be8 100755
--- a/Deployer/Deployer.php
+++ b/Deployer/Deployer.php
@@ -80,7 +80,9 @@ protected function deploy($server = null, $real = false)
$config = $this->config->getServerConfig($server);
$this->rsync->run($config['connection'], $config['rules'], $real);
- $this->ssh->run($config['connection'], $config['commands'], $real);
+ if(false === empty($config['commands'])){
+ $this->ssh->run($config['connection'], $config['commands'], $real);
+ }
$this->dispatcher->dispatch(Events::onDeploymentSuccess, new DeployerEvent($server, $real));
}
diff --git a/Deployer/Rsync.php b/Deployer/Rsync.php
index fd25693..11df8ea 100644
--- a/Deployer/Rsync.php
+++ b/Deployer/Rsync.php
@@ -155,17 +155,17 @@ protected function buildCommand(array $connection, array $rules, $real = false)
}
if (count($rules)) {
- $options[] = "--filter='+ *'";
-
foreach ($rules['ignore'] as $mask) {
- $options[] = sprintf('-f -%s', $mask);
+ $options[] = sprintf('--exclude="%s"', $mask);
}
foreach ($rules['force'] as $mask) {
- $options[] = sprintf('-f +%s', $mask);
+ $options[] = sprintf('--include="%s"', $mask);
}
}
- return sprintf('%s -e ssh %s %s %s', $this->config['command'], implode(' ', $options), $source, $destination);
+ $strReal = $real ? '' : '--dry-run';
+
+ return sprintf('%s -e ssh %s %s %s %s', $this->config['command'], $strReal, implode(' ', $options), $source, $destination);
}
}
diff --git a/Resources/config/deployment.xml b/Resources/config/deployment.xml
index bf0be61..26dbd9b 100755
--- a/Resources/config/deployment.xml
+++ b/Resources/config/deployment.xml
@@ -5,16 +5,16 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
- BeSimple\DeploymentBundle\Deployer\Rsync
- BeSimple\DeploymentBundle\Deployer\Ssh
- BeSimple\DeploymentBundle\Deployer\Config
+ BeSimple\DeploymentBundle\Deployer\Rsync
+ BeSimple\DeploymentBundle\Deployer\Ssh
+ BeSimple\DeploymentBundle\Deployer\Config
BeSimple\DeploymentBundle\Deployer\Logger
- BeSimple\DeploymentBundle\Deployer\Deployer
+ BeSimple\DeploymentBundle\Deployer\Deployer
-
+
-
+
%be_simple_deployment.config.rsync%
@@ -26,22 +26,22 @@
%be_simple_deployment.config.ssh%
-
+
%be_simple_deployment.config.rules%
%be_simple_deployment.config.commands%
%be_simple_deployment.config.servers%
-
+
-
-
-
+
+
+
-
+
-
+