From a40a171762a3beb17dfce14d35c20b7517d241df Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Mon, 22 May 2017 10:30:21 -0300 Subject: [PATCH] Fix build task in the robo file to ignore some files --- RoboFile.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 42f657df2..d93f445c1 100755 --- a/RoboFile.php +++ b/RoboFile.php @@ -15,7 +15,7 @@ class RoboFile extends \Robo\Tasks const PACKAGE_PATH = 'packages'; const PLUGIN_SLUG = 'publishpress'; - + const PROPERTIES_FILE_PATH = __DIR__ . '/.properties.ini'; protected $options = array(); @@ -72,17 +72,31 @@ public function packBuild($destination = null) $packPath = self::PACKAGE_PATH . '/'. $filename; $pack = $this->taskPack($packPath); + // Remove existent package + if (file_exists($packPath)) { + unlink($packPath); + } + $srcContent = scandir(self::SOURCE_PATH); foreach ($srcContent as $content) { - if (! in_array($content, array('.', '..'))) { + $ignore = array( + '.', + '..', + 'build', + 'tests', + '.git', + '.gitignore', + 'README', + '.DS_Store', + ); + + if (! in_array($content, $ignore)) { $path = self::SOURCE_PATH . '/' . $content; - if ($content !== 'node_modules') { - if (is_file($path)) { - $pack->addFile($content, $path); - } else { - $pack->addDir($content, $path); - } + if (is_file($path)) { + $pack->addFile($content, $path); + } else { + $pack->addDir($content, $path); } } } @@ -252,7 +266,7 @@ public function syncSrc() public function syncSvnTag($tag) { $properties = $this->getProperties(); - + $this->_exec('cd ' . $properties['svn_path'] . ' && svn update'); $this->_exec('cd ' . $properties['svn_path'] . ' && cp -r ' . realpath(__DIR__) . '/' . self::SOURCE_PATH . '/* ' . $properties['svn_path'] . '/trunk'); $this->_exec('cd ' . $properties['svn_path'] . ' && svn cp trunk tags/' . $tag);