public static function changeThemeName(Event $event)
 {
     $installer = new Installer($event->getIo());
     if ($installer->doChangeThemeName()) {
         $installer->getIo()->write('  * Running `composer update`');
         exec('composer update');
     }
 }
 /**
  * On Composer's "post-package-install" event, register the package.
  *
  * @param Event $event
  */
 public function registerPackage(Event $event)
 {
     $output = $event->getIo();
     $installedPackage = $event->getOperation()->getPackage();
     if (!$this->supports($installedPackage)) {
         return;
     }
     try {
         $this->enablePackage($installedPackage);
     } catch (\RuntimeException $e) {
         $output->write(sprintf('Bundle "%s" is already registered', $installedPackage));
     }
 }
Esempio n. 3
0
 private static function setUp(Event $event)
 {
     $dir = dirname(__DIR__);
     $commands = array("chmod -R 777 {$dir}/logs/", "chmod -R 777 {$dir}/tmp/");
     foreach ($commands as $cmd) {
         $event->getIo()->write('<info>' . $cmd . '</info>');
         passthru($cmd, $retval);
     }
     if (!file_exists("{$dir}/htdocs/htaccess.txt")) {
         return;
     }
     $htaccess = "{$dir}/htdocs/.htaccess";
     rename("{$dir}/htdocs/htaccess.txt", $htaccess);
     $contents = file_get_contents($htaccess);
     $contents = str_replace('@APP-DIR@', "{$dir}", $contents);
     file_put_contents($htaccess, $contents);
 }
Esempio n. 4
0
 /**
  * This method will be invoked by composer after a successfull installation and creates
  * the application server configuration file under etc/appserver/appserver.xml.
  *
  * @param \Composer\Script\Event $event The event that invokes this method
  *
  * @return void
  */
 public static function postInstall(Event $event)
 {
     // load the version of this package => the appserver version
     $version = $event->getComposer()->getPackage()->getVersion();
     // prepare the context properties
     $contextProperties = array(SetupKeys::INSTALL_DIR => getcwd(), SetupKeys::VERSION => $version);
     // load the OS signature => sscanf is necessary to detect Windows, e. g. Windows NT for Windows 7
     list($os, ) = sscanf(strtolower(php_uname('s')), '%s %s');
     // check what OS we are running on
     switch ($os) {
         // installation running on Linux
         case SetupKeys::OS_FAMILY_LINUX:
             // get the distribution
             $distribution = Setup::getLinuxDistro();
             if ($distribution == null) {
                 // if we cant find one of the supported systems
                 // set debian as default
                 $distribution = SetupKeys::OS_DEBIAN;
                 // write a message to the console
                 $event->getIo()->write(sprintf('<warning>Unknown Linux distribution found, use Debian default values: ' . 'Please check user/group configuration in etc/appserver/appserver.xml</warning>'));
             }
             // merge the properties for the found Linux distribution
             Setup::prepareProperties($distribution, $contextProperties);
             // process the binaries for the systemd services on Fedora
             if ($distribution === SetupKeys::OS_FEDORA || $distribution === SetupKeys::OS_REDHAT) {
                 Setup::processTemplate('bin/appserver', 0755);
                 Setup::processTemplate('bin/appserver-watcher', 0755);
             }
             break;
             // installation running on Mac OS X
         // installation running on Mac OS X
         case SetupKeys::OS_FAMILY_DARWIN:
             // merge the properties for Mac OS X
             Setup::prepareProperties($os, $contextProperties);
             // process the control files for the launchctl service
             Setup::processOsSpecificTemplate(SetupKeys::OS_DARWIN, 'sbin/appserverctl', 0755);
             Setup::processOsSpecificTemplate(SetupKeys::OS_DARWIN, 'sbin/appserver-watcherctl', 0755);
             Setup::processOsSpecificTemplate(SetupKeys::OS_DARWIN, 'sbin/appserver-php5-fpmctl', 0755);
             Setup::processOsSpecificTemplate(SetupKeys::OS_DARWIN, 'sbin/plist/io.appserver.appserver.plist');
             Setup::processOsSpecificTemplate(SetupKeys::OS_DARWIN, 'sbin/plist/io.appserver.appserver-watcher.plist');
             Setup::processOsSpecificTemplate(SetupKeys::OS_DARWIN, 'sbin/plist/io.appserver.appserver-php5-fpm.plist');
             // process the binaries for the launchctl service
             Setup::processTemplate('bin/appserver', 0755);
             Setup::processTemplate('bin/appserver-watcher', 0755);
             break;
             // installation running on Windows
         // installation running on Windows
         case SetupKeys::OS_FAMILY_WINDOWS:
             // merge the properties for Windows
             Setup::prepareProperties($os, $contextProperties);
             // process the control files for the launchctl service
             Setup::copyOsSpecificResource(SetupKeys::OS_WINDOWS, 'appserver.bat');
             Setup::processOsSpecificTemplate(SetupKeys::OS_WINDOWS, 'appserver-php5-fpm.bat');
             break;
             // all other OS are NOT supported actually
         // all other OS are NOT supported actually
         default:
             break;
     }
     // process and move the configuration files their target directory
     Setup::processTemplate('var/tmp/opcache-blacklist.txt');
     Setup::processTemplate('etc/appserver/appserver.xml');
     // write a message to the console
     $event->getIo()->write(sprintf('%s<info>Successfully invoked appserver.io Composer post-install-cmd script ...</info>', Setup::$logo));
 }