@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * This file contains the base package information |
| 16 | 16 | * |
| 17 | 17 | * @param Spec $spec |
| 18 | - * @return \wapmorgan\rpm\Spec |
|
| 18 | + * @return Packager |
|
| 19 | 19 | */ |
| 20 | 20 | public function setSpec(Spec $spec) |
| 21 | 21 | { |
@@ -124,6 +124,9 @@ discard block |
||
| 124 | 124 | return $command; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $dest |
|
| 129 | + */ |
|
| 127 | 130 | private function pathToPath($path, $dest) { |
| 128 | 131 | if (is_dir($path)) { |
| 129 | 132 | $iterator = new DirectoryIterator($path); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $iterator = new DirectoryIterator($this->getOutputPath()); |
| 62 | 62 | foreach ($iterator as $path) { |
| 63 | 63 | if ($path != '.' && $path != '..') { |
| 64 | - echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!" . PHP_EOL; |
|
| 64 | + echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!".PHP_EOL; |
|
| 65 | 65 | exit(); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | $iterator = new DirectoryIterator($path); |
| 130 | 130 | foreach ($iterator as $element) { |
| 131 | 131 | if ($element != '.' && $element != '..') { |
| 132 | - $fullPath = $path . DIRECTORY_SEPARATOR . $element; |
|
| 132 | + $fullPath = $path.DIRECTORY_SEPARATOR.$element; |
|
| 133 | 133 | if (is_dir($fullPath)) { |
| 134 | - $this->pathToPath($fullPath, $dest . DIRECTORY_SEPARATOR . $element); |
|
| 134 | + $this->pathToPath($fullPath, $dest.DIRECTORY_SEPARATOR.$element); |
|
| 135 | 135 | } else { |
| 136 | - $this->copy($fullPath, $dest . DIRECTORY_SEPARATOR . $element); |
|
| 136 | + $this->copy($fullPath, $dest.DIRECTORY_SEPARATOR.$element); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -52,10 +52,12 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function run() { |
| 55 | - if (!is_dir($_SERVER['HOME'].'/rpmbuild/SOURCES')) |
|
| 56 | - mkdir($_SERVER['HOME'].'/rpmbuild/SOURCES', 0777); |
|
| 57 | - if (!is_dir($_SERVER['HOME'].'/rpmbuild/SPECS')) |
|
| 58 | - mkdir($_SERVER['HOME'].'/rpmbuild/SPECS', 0777); |
|
| 55 | + if (!is_dir($_SERVER['HOME'].'/rpmbuild/SOURCES')) { |
|
| 56 | + mkdir($_SERVER['HOME'].'/rpmbuild/SOURCES', 0777); |
|
| 57 | + } |
|
| 58 | + if (!is_dir($_SERVER['HOME'].'/rpmbuild/SPECS')) { |
|
| 59 | + mkdir($_SERVER['HOME'].'/rpmbuild/SPECS', 0777); |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | if (file_exists($this->getOutputPath())) { |
| 61 | 63 | $iterator = new DirectoryIterator($this->getOutputPath()); |
@@ -67,8 +69,9 @@ discard block |
||
| 67 | 69 | } |
| 68 | 70 | } |
| 69 | 71 | |
| 70 | - if (!is_dir($this->getOutputPath())) |
|
| 71 | - mkdir($this->getOutputPath(), 0777); |
|
| 72 | + if (!is_dir($this->getOutputPath())) { |
|
| 73 | + mkdir($this->getOutputPath(), 0777); |
|
| 74 | + } |
|
| 72 | 75 | |
| 73 | 76 | foreach ($this->mountPoints as $path => $dest) { |
| 74 | 77 | $this->pathToPath($path, $this->getOutputPath().DIRECTORY_SEPARATOR.$dest); |
@@ -148,7 +151,8 @@ discard block |
||
| 148 | 151 | mkdir($destFolder, 0777, true); |
| 149 | 152 | } |
| 150 | 153 | copy($source, $dest); |
| 151 | - if (fileperms($source) != fileperms($dest)) |
|
| 152 | - chmod($dest, fileperms($source)); |
|
| 154 | + if (fileperms($source) != fileperms($dest)) { |
|
| 155 | + chmod($dest, fileperms($source)); |
|
| 156 | + } |
|
| 153 | 157 | } |
| 154 | 158 | } |
| 155 | 159 | \ No newline at end of file |
@@ -105,10 +105,11 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function __get($prop) { |
| 108 | - if (array_key_exists($prop, $this->_keys)) |
|
| 109 | - return $this->_keys[$prop]; |
|
| 110 | - else if (array_key_exists($prop, $this->_blocks)) |
|
| 111 | - return $this->_blocks[$prop]; |
|
| 108 | + if (array_key_exists($prop, $this->_keys)) { |
|
| 109 | + return $this->_keys[$prop]; |
|
| 110 | + } else if (array_key_exists($prop, $this->_blocks)) { |
|
| 111 | + return $this->_blocks[$prop]; |
|
| 112 | + } |
|
| 112 | 113 | } |
| 113 | 114 | |
| 114 | 115 | public function setKey($prop, $value) { |
@@ -119,8 +120,9 @@ discard block |
||
| 119 | 120 | public function __toString() { |
| 120 | 121 | $spec = ''; |
| 121 | 122 | foreach ($this->_keys as $key => $value) { |
| 122 | - if ($value === '') |
|
| 123 | - continue; |
|
| 123 | + if ($value === '') { |
|
| 124 | + continue; |
|
| 125 | + } |
|
| 124 | 126 | $spec .= sprintf('%s: %s'."\n", $key, $value); |
| 125 | 127 | } |
| 126 | 128 | |