From b0e71cb3ad4343996627d8899c8be949b177c62a Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 15 Apr 2018 16:37:07 +0700 Subject: [PATCH] Fixed SVN additional options. Issue #70. --- docs/en/configuring_project.md | 7 ++++++- src/Model/Build/GitBuild.php | 4 ++-- src/Model/Build/SvnBuild.php | 19 ++++++++++--------- src/Plugin/Mysql.php | 1 - 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/en/configuring_project.md b/docs/en/configuring_project.md index 6db62b48..e71ae096 100644 --- a/docs/en/configuring_project.md +++ b/docs/en/configuring_project.md @@ -7,7 +7,8 @@ look something like this: ```yml build_settings: - clone_depth: 1 # depth of 1 is a shallow clone, remove this line to clone entire repo + # WORKS ONLY IN IN-DATABASE PROJECT CONFIG! Clone depth of 1 is a shallow clone, remove this line to clone entire repo (For Git and Svn only). + clone_depth: 1 ignore: - "vendor" - "tests" @@ -15,6 +16,10 @@ build_settings: host: "localhost" user: "root" pass: "" + # WORKS ONLY IN IN-DATABASE PROJECT CONFIG! Svn additional CLI options (For example: --username='username'). + svn: + username: "username" + password: "password" setup: mysql: diff --git a/src/Model/Build/GitBuild.php b/src/Model/Build/GitBuild.php index 1bd76223..2a4300da 100644 --- a/src/Model/Build/GitBuild.php +++ b/src/Model/Build/GitBuild.php @@ -76,7 +76,7 @@ class GitBuild extends Build $cmd = 'cd .. && git clone --recursive '; $buildSettings = $builder->getConfig('build_settings'); - if ($buildSettings && isset($buildSettings['clone_depth'])) { + if ($buildSettings && isset($buildSettings['clone_depth']) && (0 < (integer)$buildSettings['clone_depth'])) { $cmd .= ' --depth ' . intval($buildSettings['clone_depth']) . ' '; } @@ -102,7 +102,7 @@ class GitBuild extends Build $cmd = 'cd .. && git clone --recursive '; $buildSettings = $builder->getConfig('build_settings'); - if ($buildSettings && isset($buildSettings['clone_depth'])) { + if ($buildSettings && isset($buildSettings['clone_depth']) && (0 < (integer)$buildSettings['clone_depth'])) { $cmd .= ' --depth ' . intval($buildSettings['clone_depth']) . ' '; } diff --git a/src/Model/Build/SvnBuild.php b/src/Model/Build/SvnBuild.php index 1cb9f9d7..357000af 100644 --- a/src/Model/Build/SvnBuild.php +++ b/src/Model/Build/SvnBuild.php @@ -47,16 +47,17 @@ class SvnBuild extends Build { $cmd = $this->svnCommand; - $svn = $builder->getConfig('svn'); - if ($svn) { - foreach ($svn as $key => $value) { - $cmd .= " --${key} ${value} "; - } - } - $buildSettings = $builder->getConfig('build_settings'); - if ($buildSettings && isset($buildSettings['clone_depth'])) { - $cmd .= ' --depth ' . intval($buildSettings['clone_depth']) . ' '; + if ($buildSettings) { + if (isset($buildSettings['svn']) && is_array($buildSettings['svn'])) { + foreach ($buildSettings['svn'] as $key => $value) { + $cmd .= " --${key} ${value} "; + } + } + + if (isset($buildSettings['clone_depth']) && 0 < (integer)$buildSettings['clone_depth']) { + $cmd .= ' --depth ' . intval($buildSettings['clone_depth']) . ' '; + } } $this->svnCommand = $cmd; diff --git a/src/Plugin/Mysql.php b/src/Plugin/Mysql.php index 1205aac7..5939b6df 100644 --- a/src/Plugin/Mysql.php +++ b/src/Plugin/Mysql.php @@ -53,7 +53,6 @@ class Mysql extends Plugin $this->pass = $config['pass']; $buildSettings = $this->builder->getConfig('build_settings'); - if (!isset($buildSettings['mysql'])) { return; }