示例#1
0
 /**
  * @test installing plugins
  */
 public function testInstaller()
 {
     $this->__cleanSystem();
     $this->assertTrue(App::import('lib', 'Installer.Installer'), 'Could not import the insatller lib');
     $this->assertTrue(App::import('Lib', 'Installer.ReleaseVersion'), 'Could not import Versions lib');
     $Installer = new InstallerLib();
     $Version = new ReleaseVersion(array('connection' => 'test_suite'));
     $connectionDetails = $Installer->cleanConnectionDetails(array('connection' => $this->db->config));
     $this->assertTrue($Installer->installPlugin($Version, $connectionDetails));
     $expected = array('0' => 'acos', '1' => 'aros', '2' => 'aros_acos', '3' => 'schema_migrations', '4' => 'sessions');
     $this->assertEqual($expected, $this->db->listSources());
     $this->assertTrue($Installer->installPlugin($Version, $connectionDetails, 'Installer'));
     $expected = array('0' => 'acos', '1' => 'aros', '2' => 'aros_acos', '3' => 'core_plugins', '4' => 'schema_migrations', '5' => 'sessions');
     $this->assertEqual($expected, $this->db->listSources());
     $pluginsToInstall = App::objects('plugin');
     natsort($pluginsToInstall);
     foreach ($pluginsToInstall as $k => $pluginToInstall) {
         if (in_array($pluginToInstall, array('Migrations'))) {
             continue;
         }
         $this->assertTrue($Installer->installPlugin($Version, $connectionDetails, $pluginToInstall), sprintf('%s could not be installed', $pluginToInstall));
     }
     foreach ($pluginsToInstall as $pluginToInstall) {
         $this->__checkVersionCount($pluginToInstall);
     }
 }
示例#2
0
 public static function themes($type = 'installed')
 {
     switch ($type) {
         case 'installed':
             return ClassRegistry::init('Themes.Theme')->installed();
             break;
         case 'notInstalled':
             return array_intersect(self::themes('all'), self::themes('installed'));
             break;
         default:
         case 'all':
             $return = array();
             foreach (InfinitasPlugin::listPlugins('loaded') as $plugin) {
                 foreach (InstallerLib::findThemes($plugin) as $theme) {
                     $return[$plugin . '.' . $theme] = Inflector::humanize(Inflector::underscore($plugin . Inflector::camelize($theme)));
                 }
             }
             foreach (InstallerLib::findThemes() as $theme) {
                 $return[$theme] = Inflector::humanize(Inflector::underscore($theme));
             }
             return $return;
             break;
     }
 }
示例#3
0
 public function processInstall($data)
 {
     if (empty($data['Plugin']['file']['name'])) {
         unset($data['Plugin']['file']);
     }
     if (empty($data['Theme']['file']['name'])) {
         unset($data['Theme']['file']);
     }
     $data = array_filter(Set::flatten($data));
     if (!$data) {
         throw new Exception(__d('installer', 'Nothing selected to install'));
     }
     switch (current(array_keys($data))) {
         case 'Theme.local':
             return InstallerLib::localTheme(current($data));
             break;
     }
     throw new Exception(__d('installer', 'Could not complete installation'));
 }
示例#4
0
 /**
  * @brief get a list of themes that are not yet installed
  * 
  * @access public
  * 
  * @return array list of themes that are not installed
  */
 public function notInstalled()
 {
     App::uses('InstallerLib', 'Installer.Lib');
     $installed = $this->installed();
     $notInstalled = array();
     foreach (InfinitasPlugin::listPlugins('loaded') as $plugin) {
         foreach (InstallerLib::findThemes($plugin) as $theme) {
             if (!array_key_exists($theme, $installed)) {
                 $notInstalled[$plugin . '.' . $theme] = Inflector::humanize(Inflector::underscore($plugin . Inflector::camelize($theme)));
             }
         }
     }
     foreach (InstallerLib::findThemes() as $theme) {
         if (!linkinfo(InstallerLib::themePath(null, $theme)) && !array_key_exists($theme, $installed)) {
             $notInstalled[$theme] = Inflector::humanize(Inflector::underscore($theme));
         }
     }
     return $notInstalled;
 }