/** * Install a single package (archived file) * * @param $source * @return $this */ protected function installPackageFile($source, $target) { if (!file_exists($source)) { throw new \RuntimeException('Source library folder does not exists!'); } // first unpack to tmp dir, then install the directory $tmpFolder = $this->getTmpDir() . '/' . pathinfo($source, PATHINFO_FILENAME); $this->fs->mkdir($tmpFolder); $archive = new Archive(); $archive->extract($source, $tmpFolder); // install the extension $installer = new Installer($tmpFolder); $installer->getAdapter()->install($target); // cleanup tmp folder $this->fs->remove($tmpFolder); return $this; }
public function testConstructComponent() { $installer = new Installer($this->extensionPaths['component']); $this->assertInstanceOf('JoomlaCli\\Console\\Joomla\\Extension\\Installer\\Adapter\\Component', $installer->getAdapter()); $this->assertInstanceOf('JoomlaCli\\Console\\Joomla\\Extension\\Installer\\AdapterInterface', $installer->getAdapter()); }