Merge branch 'release/0.0.10'

This commit is contained in:
Walter Dal Mut 2015-04-12 13:13:24 +02:00
commit 29a2ed1d46
3 changed files with 31 additions and 13 deletions

5
CHANGELOG-0.0.10.md Normal file
View file

@ -0,0 +1,5 @@
# BC Breaks
# Deprecations
* Method `mount` will be replaced by method `addMount` in the future

View file

@ -1 +1 @@
0.0.9 0.0.10

View file

@ -78,7 +78,15 @@ class Packager
$this->_postRM = $path; $this->_postRM = $path;
} }
/**
* @deprecated See addMount instead
*/
public function mount($sourcePath, $destinationPath) public function mount($sourcePath, $destinationPath)
{
return $this->addMount($sourcePath, $destinationPath);
}
public function addMount($sourcePath, $destinationPath)
{ {
$this->_mountPoints[$sourcePath] = $destinationPath; $this->_mountPoints[$sourcePath] = $destinationPath;
return $this; return $this;
@ -90,10 +98,15 @@ class Packager
return $this; return $this;
} }
public function getOutputPath()
{
return $this->_outputPath;
}
public function run() public function run()
{ {
if (file_exists($this->_outputPath)) { if (file_exists($this->getOutputPath())) {
$iterator = new \DirectoryIterator($this->_outputPath); $iterator = new \DirectoryIterator($this->getOutputPath());
foreach ($iterator as $path) { foreach ($iterator as $path) {
if ($path != '.' || $path != '..') { if ($path != '.' || $path != '..') {
echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!" . PHP_EOL; 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) { 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) { if ($this->_preInst) {
$dest = $this->_outputPath . "/DEBIAN/preinst"; $dest = $this->getOutputPath() . "/DEBIAN/preinst";
$this->_copy($this->_preInst, $dest); $this->_copy($this->_preInst, $dest);
chmod($dest, 0755); chmod($dest, 0755);
} }
if ($this->_postInst) { if ($this->_postInst) {
$dest = $this->_outputPath . "/DEBIAN/postinst"; $dest = $this->getOutputPath() . "/DEBIAN/postinst";
$this->_copy($this->_postInst, $dest); $this->_copy($this->_postInst, $dest);
chmod($dest, 0755); chmod($dest, 0755);
} }
if ($this->_preRM) { if ($this->_preRM) {
$dest = $this->_outputPath . "/DEBIAN/prerm"; $dest = $this->getOutputPath() . "/DEBIAN/prerm";
$this->_copy($this->_preRM, $dest); $this->_copy($this->_preRM, $dest);
chmod($dest, 0755); chmod($dest, 0755);
} }
if ($this->_postRM) { if ($this->_postRM) {
$dest = $this->_outputPath . "/DEBIAN/postrm"; $dest = $this->getOutputPath() . "/DEBIAN/postrm";
$this->_copy($this->_postRM, $dest); $this->_copy($this->_postRM, $dest);
chmod($dest, 0755); chmod($dest, 0755);
} }
@ -170,10 +183,10 @@ class Packager
public function build($debPackageName = false) public function build($debPackageName = false)
{ {
if (!$debPackageName) { 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; return $command;
} }