diff --git a/CHANGELOG-0.0.10.md b/CHANGELOG-0.0.10.md new file mode 100644 index 0000000..f135a1d --- /dev/null +++ b/CHANGELOG-0.0.10.md @@ -0,0 +1,5 @@ +# BC Breaks + +# Deprecations + + * Method `mount` will be replaced by method `addMount` in the future diff --git a/src/wdm/debian/Packager.php b/src/wdm/debian/Packager.php index a76e22d..a515a73 100644 --- a/src/wdm/debian/Packager.php +++ b/src/wdm/debian/Packager.php @@ -78,7 +78,15 @@ class Packager $this->_postRM = $path; } + /** + * @deprecated See addMount instead + */ public function mount($sourcePath, $destinationPath) + { + return $this->addMount($sourcePath, $destinationPath); + } + + public function addMount($sourcePath, $destinationPath) { $this->_mountPoints[$sourcePath] = $destinationPath; return $this; @@ -90,10 +98,15 @@ class Packager return $this; } + public function getOutputPath() + { + return $this->_outputPath; + } + public function run() { - if (file_exists($this->_outputPath)) { - $iterator = new \DirectoryIterator($this->_outputPath); + if (file_exists($this->getOutputPath())) { + $iterator = new \DirectoryIterator($this->getOutputPath()); foreach ($iterator as $path) { if ($path != '.' || $path != '..') { echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!" . PHP_EOL; @@ -102,36 +115,36 @@ class Packager } } - mkdir($this->_outputPath, 0777); + mkdir($this->getOutputPath(), 0777); foreach ($this->_mountPoints as $path => $dest) { - $this->_pathToPath($path, $this->_outputPath . DIRECTORY_SEPARATOR . $dest); + $this->_pathToPath($path, $this->getOutputPath() . DIRECTORY_SEPARATOR . $dest); } - mkdir($this->_outputPath . "/DEBIAN", 0777); + mkdir($this->getOutputPath() . "/DEBIAN", 0777); - file_put_contents($this->_outputPath . "/DEBIAN/control", (string)$this->_control); + file_put_contents($this->getOutputPath() . "/DEBIAN/control", (string)$this->_control); if ($this->_preInst) { - $dest = $this->_outputPath . "/DEBIAN/preinst"; + $dest = $this->getOutputPath() . "/DEBIAN/preinst"; $this->_copy($this->_preInst, $dest); chmod($dest, 0755); } if ($this->_postInst) { - $dest = $this->_outputPath . "/DEBIAN/postinst"; + $dest = $this->getOutputPath() . "/DEBIAN/postinst"; $this->_copy($this->_postInst, $dest); chmod($dest, 0755); } if ($this->_preRM) { - $dest = $this->_outputPath . "/DEBIAN/prerm"; + $dest = $this->getOutputPath() . "/DEBIAN/prerm"; $this->_copy($this->_preRM, $dest); chmod($dest, 0755); } if ($this->_postRM) { - $dest = $this->_outputPath . "/DEBIAN/postrm"; + $dest = $this->getOutputPath() . "/DEBIAN/postrm"; $this->_copy($this->_postRM, $dest); chmod($dest, 0755); } @@ -170,10 +183,10 @@ class Packager public function build($debPackageName = false) { if (!$debPackageName) { - $debPackageName = basename($this->_outputPath . ".deb"); + $debPackageName = basename($this->getOutputPath() . ".deb"); } - $command = "dpkg -b {$this->_outputPath} {$debPackageName}"; + $command = "dpkg -b {$this->getOutputPath()} {$debPackageName}"; return $command; }