src/Tasks/Deploy/Package.php
public function createComponentZip()
	{
		$comZip = new \ZipArchive(JPATH_BASE . "/dist", \ZipArchive::CREATE);

		$tmp_path = '/dist/tmp/cbuild';

		if (file_exists(JPATH_BASE . $tmp_path))
		{
			$this->_deleteDir(JPATH_BASE . $tmp_path);
		}

		// Improve, should been a whitelist instead of a hardcoded copy
		$this->_mkdir(JPATH_BASE . $tmp_path);

		$this->_copyDir($this->current . '/administrator', JPATH_BASE . $tmp_path . '/administrator');
		$this->_remove(JPATH_BASE . $tmp_path . '/administrator/manifests');
		$this->_copyDir($this->current . '/language', JPATH_BASE . $tmp_path . '/language');
		$this->_copyDir($this->current . '/components', JPATH_BASE . $tmp_path . '/components');

		if (file_exists($this->current . '/media'))
		{
			$this->_copyDir($this->current . '/media', JPATH_BASE . $tmp_path . '/media');
		}

		$comZip->open(JPATH_BASE . '/dist/zips/com_' . $this->getExtensionName() . '.zip', \ZipArchive::CREATE);

		// Process the files to zip
		$this->addFiles($comZip, JPATH_BASE . $tmp_path);

		$comZip->addFile($this->current . "/" . $this->getExtensionName() . ".xml", $this->getExtensionName() . ".xml");
		$comZip->addFile($this->current . "/administrator/components/com_" . $this->getExtensionName() . "/script.php", "script.php");

		// Close the zip archive
		$comZip->close();
	}
public function createComponentZip()
	{
		$comZip = new \ZipArchive(JPATH_BASE . "/dist", \ZipArchive::CREATE);

		$tmp_path = '/dist/tmp/cbuild';

		if (file_exists(JPATH_BASE . $tmp_path))
		{
			$this->_deleteDir(JPATH_BASE . $tmp_path);
		}

		// Improve, should been a whitelist instead of a hardcoded copy
		$this->_mkdir(JPATH_BASE . $tmp_path);

		$this->_copyDir($this->current . '/administrator', JPATH_BASE . $tmp_path . '/administrator');
		$this->_remove(JPATH_BASE . $tmp_path . '/administrator/manifests');
		$this->_copyDir($this->current . '/language', JPATH_BASE . $tmp_path . '/language');
		$this->_copyDir($this->current . '/components', JPATH_BASE . $tmp_path . '/components');

		if (file_exists($this->current . '/media'))
		{
			$this->_copyDir($this->current . '/media', JPATH_BASE . $tmp_path . '/media');
		}

		$comZip->open(JPATH_BASE . '/dist/zips/com_' . $this->getExtensionName() . '.zip', \ZipArchive::CREATE);

		// Process the files to zip
		$this->addFiles($comZip, JPATH_BASE . $tmp_path);

		$comZip->addFile($this->current . "/" . $this->getExtensionName() . ".xml", $this->getExtensionName() . ".xml");
		$comZip->addFile($this->current . "/administrator/components/com_" . $this->getExtensionName() . "/script.php", "script.php");

		// Close the zip archive
		$comZip->close();
	}
public function createComponentZip ( ) { $ comZip = new \ ZipArchive ( JPATH_BASE . "/dist" , \ ZipArchive :: CREATE ) ; $ tmp_path = '/dist/tmp/cbuild' ; if ( file_exists ( JPATH_BASE . $ tmp_path ) ) { $ this -> _deleteDir ( JPATH_BASE . $ tmp_path ) ; } // Improve, should been a whitelist instead of a hardcoded copy $ this -> _mkdir ( JPATH_BASE . $ tmp_path ) ; $ this -> _copyDir ( $ this -> current . '/administrator' , JPATH_BASE . $ tmp_path . '/administrator' ) ; $ this -> _remove ( JPATH_BASE . $ tmp_path . '/administrator/manifests' ) ; $ this -> _copyDir ( $ this -> current . '/language' , JPATH_BASE . $ tmp_path . '/language' ) ; $ this -> _copyDir ( $ this -> current . '/components' , JPATH_BASE . $ tmp_path . '/components' ) ; if ( file_exists ( $ this -> current . '/media' ) ) { $ this -> _copyDir ( $ this -> current . '/media' , JPATH_BASE . $ tmp_path . '/media' ) ; } $ comZip -> open ( JPATH_BASE . '/dist/zips/com_' . $ this -> getExtensionName ( ) . '.zip' , \ ZipArchive :: CREATE ) ; // Process the files to zip $ this -> addFiles ( $ comZip , JPATH_BASE . $ tmp_path ) ; $ comZip -> addFile ( $ this -> current . "/" . $ this -> getExtensionName ( ) . ".xml" , $ this -> getExtensionName ( ) . ".xml" ) ; $ comZip -> addFile ( $ this -> current . "/administrator/components/com_" . $ this -> getExtensionName ( ) . "/script.php" , "script.php" ) ; // Close the zip archive $ comZip -> close ( ) ; }
Create a installable zip file for a component

@TODO    implement possibility for multiple components (without duplicate content)

@return  void

@since   1.0
Create a installable zip file for a component