diff --git a/include/cli/modules/deploy.php b/include/cli/modules/deploy.php index 74a11f02c3b103a106ac495eb225f86f7acad818..d57a27b3cd64c486b2db04c5aab0f9e1ee0d7e62 100644 --- a/include/cli/modules/deploy.php +++ b/include/cli/modules/deploy.php @@ -27,6 +27,9 @@ class Deployment extends Unpacker { 'action'=>'store_true', 'help'=>'Use `git ls-files -s` as files source. Eliminates possibility of deploying untracked files'); + $this->options['force'] = array('-f', '--force', + 'action'=>'store_true', + 'help'=>'Deploy all files, even if they have not changed'); # super(*args); call_user_func_array(array('parent', '__construct'), func_get_args()); } @@ -188,12 +191,13 @@ class Deployment extends Unpacker { $dryrun = $this->getOption('dry-run', false); $verbose = $this->getOption('verbose') || $dryrun; + $force = $this->getOption('force'); while ($line = stream_get_line($pipes[1], 255, "\x00")) { list($mode, $hash, , $path) = preg_split('/\s+/', $line); $src = $source.$local.$path; if ($this->exclude($exclude, $src)) continue; - if (!$this->isChanged($src, $hash)) + if (!$force && false === ($flag = $this->isChanged($src, $hash))) continue; $dst = $destination.$path; if ($verbose) @@ -256,7 +260,8 @@ class Deployment extends Unpacker { "*/.htaccess")); } - $this->writeManifest($this->destination); + if (!$options['dry-run']) + $this->writeManifest($this->destination); } } diff --git a/include/cli/modules/unpack.php b/include/cli/modules/unpack.php index 75b73353deb0f212bed2a65cb420707c5b3eaedd..71973aafe0e978f4b9f29cd7f13af3508152b8b2 100644 --- a/include/cli/modules/unpack.php +++ b/include/cli/modules/unpack.php @@ -156,6 +156,7 @@ class Unpacker extends Module { function unpackage($folder, $destination, $recurse=0, $exclude=false) { $dryrun = $this->getOption('dry-run', false); $verbose = $this->getOption('verbose') || $dryrun; + $force = $this->getOption('force', false); if (substr($destination, -1) !== '/') $destination .= '/'; foreach (glob($folder, GLOB_BRACE|GLOB_NOSORT) as $file) { @@ -164,7 +165,8 @@ class Unpacker extends Module { if (is_file($file)) { $target = $destination . basename($file); $hash = $this->hashFile($file); - if (is_file($target) && !$this->isChanged($file, $hash)) + if (!$force && is_file($target) + && false === ($flag = $this->isChanged($file, $hash))) continue; if ($verbose) $this->stdout->write($target."\n");