コード例 #1
0
    /**
     * Just dump welcome text on how to install eZ Platform.
     *
     * @param $event CommandEvent A instance
     */
    public static function installWelcomeText(CommandEvent $event)
    {
        $event->getIO()->write(<<<'EOT'

________________/\\\\\\\\\\\\\\\____________/\\\\\\\\\\\\\____/\\\\\\________________________________________/\\\\\_________________________________________________
 ________________\////////////\\\____________\/\\\/////////\\\_\////\\\______________________________________/\\\///__________________________________________________
  __________________________/\\\/_____________\/\\\_______\/\\\____\/\\\_______________________/\\\__________/\\\______________________________________________________
   _____/\\\\\\\\__________/\\\/_______________\/\\\\\\\\\\\\\/_____\/\\\_____/\\\\\\\\\_____/\\\\\\\\\\\__/\\\\\\\\\_______/\\\\\_____/\\/\\\\\\\_____/\\\\\__/\\\\\___
    ___/\\\/////\\\_______/\\\/_________________\/\\\/////////_______\/\\\____\////////\\\___\////\\\////__\////\\\//______/\\\///\\\__\/\\\/////\\\__/\\\///\\\\\///\\\_
     __/\\\\\\\\\\\______/\\\/___________________\/\\\________________\/\\\______/\\\\\\\\\\_____\/\\\_________\/\\\_______/\\\__\//\\\_\/\\\___\///__\/\\\_\//\\\__\/\\\_
      _\//\\///////_____/\\\/_____________________\/\\\________________\/\\\_____/\\\/////\\\_____\/\\\_/\\_____\/\\\______\//\\\__/\\\__\/\\\_________\/\\\__\/\\\__\/\\\_
       __\//\\\\\\\\\\__/\\\\\\\\\\\\\\\___________\/\\\______________/\\\\\\\\\_\//\\\\\\\\/\\____\//\\\\\______\/\\\_______\///\\\\\/___\/\\\_________\/\\\__\/\\\__\/\\\_
        ___\//////////__\///////////////____________\///______________\/////////___\////////\//______\/////_______\///__________\/////_____\///__________\///___\///___\///__


<fg=cyan>Welcome to eZ Platform!</fg=cyan>

<options=bold>You may now complete the eZ Platform installation with ezplatform:install command, example of use:</options=bold>
<comment>    $ php ezpublish/console ezplatform:install --env prod demo</comment>

<options=bold>After executing this, you can launch your browser* and get started.</options=bold>


* Assuming you have setup directory permissions and configured your web server (Apache/Nginx) correctly (see Install.md and doc/ folder in eZ Platform <root-directory>).
EOT
);
    }
コード例 #2
0
 protected function __construct(CommandEvent $event)
 {
     $this->composerEvent = $event;
     $this->io = $this->composerEvent->getIO();
     $this->extras = $this->composerEvent->getComposer()->getPackage()->getExtra();
     $this->fs = new Filesystem();
 }
コード例 #3
0
ファイル: ScriptHandler.php プロジェクト: CampaignChain/core
 public static function enableInstallMode(CommandEvent $event)
 {
     if (!file_exists(SystemUtil::getInstallDoneFilePath())) {
         SystemUtil::enableInstallMode();
     }
     $event->getIO()->write('CampaignChain: Enabled install mode.');
 }
コード例 #4
0
 /**
  * Checks for the twitter/bootstrap package and copys all necessary files into the specified directory.
  *
  * Where the files are copied into must be specified in the extra section in the project's `composer.json`.
  *
  * 		"extra": {
  * 			"bootstrap-public-dir": "src/Acme/MyBundle/Resources/public",
  * 			...
  * 		}
  *
  * @param CommandEvent $event
  */
 public static function copyBootstrapFiles(CommandEvent $event)
 {
     /** @var RootPackage $package */
     $package = $event->getComposer()->getPackage();
     /** @var Link[] $requires */
     $requires = $package->getRequires();
     // Show error if package was not found
     if (!in_array(self::$bootstrapPackageKey, array_keys($requires))) {
         echo PHP_EOL . "\tError: Could not find the Twitter Bootstrap package \"twitter/bootstrap\"." . PHP_EOL . PHP_EOL;
         return;
     }
     $fs = new Filesystem();
     // Check for package path
     $packagePath = static::_getPackagePath($event->getComposer());
     if (is_null($packagePath) or !$fs->exists($packagePath)) {
         echo PHP_EOL . "\tError: The twitter bootstrap package doesn't seem to be installed." . PHP_EOL . PHP_EOL;
         return;
     }
     $bootstrapPath = $packagePath . '/dist/';
     // Check the public path where it should be copied to
     $extra = $package->getExtra();
     if (!isset($extra['bootstrap-public-dir']) or !$fs->exists($extra['bootstrap-public-dir'])) {
         echo PHP_EOL . "\tError: Given bootstrap public directory doesn't exist: " . $extra['bootstrap-public-dir'] . PHP_EOL . PHP_EOL;
         return;
     }
     $bootstrapPublicPath = $extra['bootstrap-public-dir'];
     echo sprintf('Installing twitter bootstrap files into %s%s', $bootstrapPublicPath, PHP_EOL);
     $files = array('js/bootstrap.js', 'js/bootstrap.min.js', 'fonts/glyphicons-halflings-regular.eot', 'fonts/glyphicons-halflings-regular.svg', 'fonts/glyphicons-halflings-regular.ttf', 'fonts/glyphicons-halflings-regular.woff');
     foreach ($files as $file) {
         $fs->copy($bootstrapPath . $file, $bootstrapPublicPath . '/' . $file, true);
     }
 }
コード例 #5
0
ファイル: ScriptHandler.php プロジェクト: jmsteinmetz/Dime
 protected static function getOptions(CommandEvent $event)
 {
     $options = array_merge(array('symfony-app-dir' => 'app', 'symfony-web-dir' => 'web', 'symfony-assets-install' => 'hard'), $event->getComposer()->getPackage()->getExtra());
     $options['symfony-assets-install'] = getenv('SYMFONY_ASSETS_INSTALL') ?: $options['symfony-assets-install'];
     $options['process-timeout'] = $event->getComposer()->getConfig()->get('process-timeout');
     return $options;
 }
コード例 #6
0
ファイル: Clean.php プロジェクト: enygma/composerclean
 public static function exec(CommandEvent $event)
 {
     $composer = $event->getComposer();
     $installManager = $composer->getInstallationManager();
     $repoManager = $composer->getRepositoryManager();
     $packages = $repoManager->getLocalRepository()->getPackages();
     foreach ($packages as $package) {
         $path = $installManager->getInstallPath($package);
         $extra = $package->getExtra();
         if (array_key_exists('clean', $extra)) {
             // we have things to remove, try to take them out
             foreach ($extra['clean'] as $remove) {
                 $resolvePath = realpath($path . '/' . $remove);
                 if ($resolvePath !== false) {
                     if (is_dir($resolvePath)) {
                         self::unlinkDirectory($resolvePath);
                         // rmdir($resolvePath);
                     } elseif (is_file($resolvePath)) {
                         // unlink($resolvePath);
                         self::unlinkFile($resolvePath);
                     }
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: Installer.php プロジェクト: solve/admin
 public static function deployAssets(CommandEvent $event)
 {
     $io = $event->getIO();
     if (!$io->askConfirmation('Would you like to update assets? (Y/n) ', true)) {
         return false;
     }
 }
コード例 #8
0
    /**
     * Just dump welcome text on how to install eZ Platform.
     *
     * @param $event CommandEvent A instance
     */
    public static function installWelcomeText(CommandEvent $event)
    {
        $event->getIO()->write(<<<'EOT'

________________/\\\\\\\\\\\\\\\____________/\\\\\\\\\\\\\____/\\\\\\________________________________________/\\\\\_________________________________________________
 ________________\////////////\\\____________\/\\\/////////\\\_\////\\\______________________________________/\\\///__________________________________________________
  __________________________/\\\/_____________\/\\\_______\/\\\____\/\\\_______________________/\\\__________/\\\______________________________________________________
   _____/\\\\\\\\__________/\\\/_______________\/\\\\\\\\\\\\\/_____\/\\\_____/\\\\\\\\\_____/\\\\\\\\\\\__/\\\\\\\\\_______/\\\\\_____/\\/\\\\\\\_____/\\\\\__/\\\\\___
    ___/\\\/////\\\_______/\\\/_________________\/\\\/////////_______\/\\\____\////////\\\___\////\\\////__\////\\\//______/\\\///\\\__\/\\\/////\\\__/\\\///\\\\\///\\\_
     __/\\\\\\\\\\\______/\\\/___________________\/\\\________________\/\\\______/\\\\\\\\\\_____\/\\\_________\/\\\_______/\\\__\//\\\_\/\\\___\///__\/\\\_\//\\\__\/\\\_
      _\//\\///////_____/\\\/_____________________\/\\\________________\/\\\_____/\\\/////\\\_____\/\\\_/\\_____\/\\\______\//\\\__/\\\__\/\\\_________\/\\\__\/\\\__\/\\\_
       __\//\\\\\\\\\\__/\\\\\\\\\\\\\\\___________\/\\\______________/\\\\\\\\\_\//\\\\\\\\/\\____\//\\\\\______\/\\\_______\///\\\\\/___\/\\\_________\/\\\__\/\\\__\/\\\_
        ___\//////////__\///////////////____________\///______________\/////////___\////////\//______\/////_______\///__________\/////_____\///__________\///___\///___\///__


<fg=cyan>Welcome to eZ Platform!</fg=cyan>

<options=bold>Please read the INSTALL.md file to complete the installation.</options>

<options=bold>Assuming that your database information were correctly entered, you may install a clean database by running the install command:</options>
<comment>    $ php app/console --env=prod ezplatform:install clean</comment>

EOT
);
    }
コード例 #9
0
 /**
  * Listener to the POST_INSTALL_CMD, POST_UPDATE_CMD and POST_CREATE_PROJECT_CMD events
  * It contains the code that launch the execution of the finalize precedures
  *
  * @param  \Composer\Script\CommandEvent $event Event to handle
  *
  */
 public function onPostInstallCMD(CommandEvent $event)
 {
     $packages = $event->getComposer()->getRepositoryManager()->getLocalRepository()->getPackages();
     foreach ($packages as $package) {
         $this->onEventHandler($package, "finalize");
     }
     $this->doRetry();
 }
コード例 #10
0
ファイル: ScriptHandler.php プロジェクト: hkmshb/OpitHrm
 protected static function getConfigs(CommandEvent $event)
 {
     $extras = array_merge(array('app-version-key' => 'version_number'), $event->getComposer()->getPackage()->getExtra());
     if (!isset($extras['incenteev-parameters'])) {
         throw new \InvalidArgumentException('The parameter handler needs to be configured through the extra.incenteev-parameters setting.');
     }
     $configs = $extras['incenteev-parameters'];
     return $configs;
 }
コード例 #11
0
 /**
  * Called from composer
  *
  * @param CommandEvent $event
  * @return void
  */
 public static function postUpdateAndInstall(CommandEvent $event)
 {
     $scriptName = self::isWindowsOs() ? 'typo3cms.bat' : 'typo3cms';
     $success = self::safeCopy($scriptName, './');
     if (!$success) {
         $event->getIO()->write(sprintf(self::COPY_FAILED_MESSAGE_TITLE, $scriptName));
         $event->getIO()->write(sprintf(self::COPY_FAILED_MESSAGE, $scriptName));
     }
 }
コード例 #12
0
ファイル: InstallerScripts.php プロジェクト: nos3/aimeos-flow
 /**
  * Post composer install or update tasks
  *
  * @param \Composer\Script\CommandEvent $event
  */
 public static function postUpdateAndInstall(CommandEvent $event)
 {
     $options = array();
     if ($event->isDevMode()) {
         $options['options'] = 'setup/default/demo:1';
     }
     \TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:setup', array(), true, $options);
     \TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:cache', array());
 }
コード例 #13
0
 /**
  * Build a directory path starting on the project base
  *
  * @param CommandEvent $event
  * @param string       $directory
  */
 private static function buildPathFromBase(CommandEvent $event, $directory)
 {
     /** @var Package $package */
     $package = $event->getComposer()->getPackage();
     $extra = $package->getExtra();
     // Generate the complete path.
     $basePath = getcwd();
     $path = array_key_exists($directory, $extra) ? $extra[$directory] : self::$options[$directory];
     $completePath = sprintf('%s/%s', $basePath, $path);
     // Set values.
     self::$options[self::CONSOLE_APPLICATION_BASE_DIR] = $basePath;
     self::$options[$directory] = $completePath;
 }
コード例 #14
0
 protected static function runCommand(CommandEvent $event, Tool $tool, $command)
 {
     if ($event->getIO()->isVerbose()) {
         $event->getIO()->write($command);
     }
     $process = new Process($command, getcwd(), null, null, $tool->getTimeout());
     $process->run(function ($type, $buffer) use($event) {
         if ($event->getIO()->isVerbose()) {
             $event->getIO()->write($buffer, false);
         }
     });
     return $process;
 }
コード例 #15
0
ファイル: Composer.php プロジェクト: TomasJancauskas/HR
 private static function spacingParametersYml(CommandEvent $event)
 {
     if (!file_exists($file = 'vendor/incenteev/composer-parameter-handler/Processor.php')) {
         return;
     }
     $content = file_get_contents($file);
     $matches = 0;
     $content = str_replace('Yaml::dump($actualValues, 99)', 'Yaml::dump($actualValues, 99, 2)', $content, $matches);
     if ($matches) {
         file_put_contents($file, $content, LOCK_EX);
         $event->getIO()->write('Updated spacing for incenteev parameters');
     }
 }
コード例 #16
0
ファイル: InstallationHelper.php プロジェクト: d4rk4ng3l/aom
 public static function removeGitStuff(CommandEvent $event)
 {
     if ($event->getIO()->askConfirmation('Remove the GIT related stuff? [Y/n] ')) {
         $fs = new Filesystem();
         foreach (static::getPath() as $path) {
             $filename = $path . '/.gitkeep';
             if ($fs->exists($filename)) {
                 $fs->remove($filename);
             }
         }
         $fs->remove(static::getPath('root') . '/.git');
     }
 }
コード例 #17
0
 /**
  * @static
  *
  * @param \Composer\Script\CommandEvent $event
  */
 public static function checkAndInstall($event)
 {
     $appDir = getcwd() . '/app';
     $resourcesPath = $appDir . '/Resources';
     if (is_dir($resourcesPath)) {
         $filesystem = new Filesystem();
         $jackrabbitDir = $resourcesPath . '/java/jackrabbit';
         $filesystem->ensureDirectoryExists($jackrabbitDir);
         if (!self::check($jackrabbitDir) && false !== ($file = self::download($event->getIO(), $jackrabbitDir))) {
             self::install($file, $appDir);
         }
     }
 }
コード例 #18
0
ファイル: InstallCommand.php プロジェクト: ulakjira/ojs
 protected static function executeCommand(CommandEvent $event, $appDir, $cmd, $timeout = 300)
 {
     $php = escapeshellarg(self::getPhp());
     $console = escapeshellarg($appDir . '/console');
     if ($event->getIO()->isDecorated()) {
         $console .= ' --ansi';
     }
     $process = new Process($php . ' ' . $console . ' ' . $cmd, null, null, null, $timeout);
     $process->run(function ($type, $buffer) {
         echo $buffer;
     });
     if (!$process->isSuccessful()) {
         throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd)));
     }
 }
コード例 #19
0
 public static function setPermissions(CommandEvent $event)
 {
     $event->getIO()->write('Setting up permissions.');
     try {
         self::setPermissionsSetfacl($event);
         return;
     } catch (ProcessFailedException $setfaclException) {
     }
     try {
         self::setPermissionsChmod($event);
         return;
     } catch (ProcessFailedException $chmodException) {
     }
     throw $setfaclException;
 }
コード例 #20
0
ファイル: Refresher.php プロジェクト: ngydat/CoreBundle
 public static function deleteCache(CommandEvent $event)
 {
     $options = array_merge(array('symfony-app-dir' => 'app'), $event->getComposer()->getPackage()->getExtra());
     $cacheDir = $options['symfony-app-dir'] . '/cache';
     $event->getIO()->write('Clearing the cache...');
     static::removeContentFrom($cacheDir);
 }
コード例 #21
0
 protected static function executeCommand(CommandEvent $event, $consoleDir, $cmd, $timeout = 300)
 {
     $php = escapeshellarg(static::getPhp(false));
     $phpArgs = implode(' ', array_map('escapeshellarg', static::getPhpArguments()));
     $console = escapeshellarg($consoleDir . '/console');
     if ($event->getIO()->isDecorated()) {
         $console .= ' --ansi';
     }
     $process = new Process($php . ($phpArgs ? ' ' . $phpArgs : '') . ' ' . $console . ' ' . $cmd, null, null, null, $timeout);
     $process->run(function ($type, $buffer) use($event) {
         $event->getIO()->write($buffer, false);
     });
     if (!$process->isSuccessful()) {
         throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd)));
     }
 }
コード例 #22
0
 /**
  * Do install.
  *
  * @param CommandEvent $event The command event.
  *
  * @return  void
  */
 public static function install(CommandEvent $event)
 {
     $windPath = getcwd();
     $root = realpath($windPath . '/../..');
     $io = $event->getIO();
     // Create console file.
     $io->write('Writing console file to bin.');
     WindwalkerInstaller::createBinFile($root);
     // Config file
     $io->write('Prepare config file.');
     WindwalkerInstaller::copyConfigFile($root);
     // Bundles dir
     $bundlesDir = dirname($windPath) . '/windwalker-bundles';
     if (WindwalkerInstaller::createBundleDir($root)) {
         $io->write('Create bundle folder: ' . $bundlesDir);
     }
     // Complete
     $io->write('Install complete.');
 }
コード例 #23
0
 /**
  * Do install.
  *
  * @param CommandEvent $event The command event.
  *
  * @return  void
  */
 public static function install(CommandEvent $event)
 {
     $windPath = getcwd();
     $root = realpath($windPath . '/../../..');
     $io = $event->getIO();
     $resourcesPath = $root . '/resources';
     if (!is_dir($resourcesPath)) {
         mkdir($resourcesPath, 0755, true);
         file_put_contents($resourcesPath . '/index.html', '<html></html>');
         $io->write('Create resources folder.');
     }
     $seederPath = $resourcesPath . '/seeders/DatabaseSeeder.php';
     if (!is_file($seederPath)) {
         mkdir(dirname($seederPath), 0755, true);
         copy($windPath . '/Resources/templates/DatabaseSeeder.php', $seederPath);
         $io->write('Create Seeder file.');
     }
     // Complete
     $io->write('Install complete.');
 }
コード例 #24
0
 public static function setPermissions(CommandEvent $event)
 {
     if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
         $event->getIO()->write('<info>No permissions setup is required on Windows.</info>');
         return;
     }
     $event->getIO()->write('Setting up permissions.');
     try {
         self::setPermissionsSetfacl($event);
         return;
     } catch (ProcessFailedException $setfaclException) {
         $event->getIO()->write(sprintf('<error>%s</error>', $setfaclException->getMessage()));
         $event->getIO()->write('<info>Trying chmod...</info>');
     }
     try {
         self::setPermissionsChmod($event);
         return;
     } catch (ProcessFailedException $chmodException) {
         $event->getIO()->write(sprintf('<error>%s</error>', $chmodException->getMessage()));
     }
 }
コード例 #25
0
ファイル: ScriptHandler.php プロジェクト: dongww/silex-base
 protected static function executeCommand(CommandEvent $event, $cmd, $timeout = 300)
 {
     $extra = $event->getComposer()->getPackage()->getExtra();
     $binDir = $extra['sb-bin-dir'];
     if (!is_dir($binDir)) {
         echo 'The sb-bin-dir (' . $binDir . ') specified in composer.json was not found in ' . getcwd() . ', can not clear the cache.' . PHP_EOL;
         return;
     }
     $php = escapeshellarg(self::getPhp());
     $console = escapeshellarg($binDir . '/sb');
     if ($event->getIO()->isDecorated()) {
         $console .= ' --ansi';
     }
     $process = new Process($php . ' ' . $console . ' ' . $cmd, null, null, null, $timeout);
     $process->run(function ($type, $buffer) {
         echo $buffer;
     });
     if (!$process->isSuccessful()) {
         throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd)));
     }
 }
コード例 #26
0
 public static function replaceViews(CommandEvent $event)
 {
     $event->getIO()->write('Copy ReCaptcha views to app/Resource/DS/ReCaptcha/views.');
     $directory = getcwd();
     self::$fileSystem = new Filesystem();
     $directory .= '/app/Resources';
     self::makeDirIfNOtExist($directory);
     $directory .= '/DS';
     self::makeDirIfNOtExist($directory);
     $directory .= '/ReCaptcha';
     self::makeDirIfNOtExist($directory);
     $directory .= '/views';
     self::makeDirIfNOtExist($directory);
     if (self::$fileSystem->exists($directory . '/form_div_layout.html.twig')) {
         if (!$event->getIO()->askConfirmation(sprintf('form_div_layout.html.twig already exist in %s. Would you like to rewrite this file? [y/N]  ', $directory), false)) {
             return;
         }
     }
     self::$fileSystem->copy(__DIR__ . '/../Resources/views/form_div_layout.html.twig', $directory . '/form_div_layout.html.twig', true);
     $event->getIO()->write('Files creation operation completed successfully.');
 }
コード例 #27
0
ファイル: Installer.php プロジェクト: dizews/yii2-qunit
 /**
  * Sets the correct skeleton for the unit tests.
  * @param CommandEvent $event
  */
 public static function initTestsSkeleton($event)
 {
     $options = $event->getComposer()->getPackage()->getExtra();
     if (!isset($options[self::EXTRA_SKELETON], $options[self::EXTRA_SKELETON]['path'])) {
         $path = 'tests/js';
     } else {
         $path = $options[self::EXTRA_SKELETON]['path'];
     }
     $path = getcwd() . DIRECTORY_SEPARATOR . $path;
     echo "Setting init tests skeleton: {$path} ...\n";
     if (!file_exists($path)) {
         if (FileHelper::createDirectory($path)) {
             FileHelper::copyDirectory(self::getSourceSkeletonPath(), $path);
             echo "done\n";
         } else {
             echo "The directory was not found: " . $path . "\n";
         }
     } else {
         echo "{$path} directory is exists\n";
         return;
     }
 }
コード例 #28
0
 /**
  * Deploy a proper settings/override/site.ini using settings/override/site.ini.dist as a template
  * Only main DB parameters (Host,Port,User,Password,Database) are replaced using the Symfony parameters
  *
  * @param $event CommandEvent A instance
  */
 public static function siteIniUpdate(CommandEvent $event)
 {
     $extras = $event->getComposer()->getPackage()->getExtra();
     if (!isset($extras['ezpublish-legacy-utility'])) {
         throw new \InvalidArgumentException('The eZ Publish Utility handler needs to be configured through the extra.ezpublish-legacy-utility setting.');
     }
     $configs = $extras['ezpublish-legacy-utility'];
     $yamlParser = new Parser();
     $parameters = $yamlParser->parse(file_get_contents($configs['parameters-file']));
     file_put_contents($configs['legacy-site_ini'], file_get_contents($configs['legacy-site_ini-dist']));
     $siteIniArray = file($configs['legacy-site_ini']);
     $dbSection = false;
     $siteIniUpdated = array();
     foreach ($siteIniArray as $siteIniRow) {
         $siteIniRow = trim($siteIniRow);
         if (substr($siteIniRow, 0, 1) === '[') {
             if ($siteIniRow === "[DatabaseSettings]") {
                 $dbSection = true;
             } else {
                 $dbSection = false;
             }
         }
         if ($dbSection) {
             if (strstr($siteIniRow, '=', true) != false) {
                 $key = strstr($siteIniRow, '=', true);
                 if (array_key_exists($key, $configs['parameters-map'])) {
                     $siteIniRow = $key . "=" . $parameters['parameters'][$configs['parameters-map'][$key]];
                 }
             }
         }
         $siteIniUpdated[] = $siteIniRow;
     }
     file_put_contents($configs['legacy-site_ini'], "");
     foreach ($siteIniUpdated as $siteIniUpdatedRow) {
         file_put_contents($configs['legacy-site_ini'], $siteIniUpdatedRow . "\n", FILE_APPEND);
     }
 }
コード例 #29
0
ファイル: Installer.php プロジェクト: getherbie/composer
 /**
  * Sets the correct permission for the files and directories listed in the extra section.
  * @param CommandEvent $event
  */
 public static function setPermission($event)
 {
     $options = array_merge([self::EXTRA_WRITABLE => [], self::EXTRA_EXECUTABLE => []], $event->getComposer()->getPackage()->getExtra());
     foreach ((array) $options[self::EXTRA_WRITABLE] as $path) {
         echo "Setting writable: {$path} ...";
         if (is_dir($path)) {
             chmod($path, 0777);
             echo "done\n";
         } else {
             echo "The directory was not found: " . getcwd() . DIRECTORY_SEPARATOR . $path;
             return;
         }
     }
     foreach ((array) $options[self::EXTRA_EXECUTABLE] as $path) {
         echo "Setting executable: {$path} ...";
         if (is_file($path)) {
             chmod($path, 0755);
             echo "done\n";
         } else {
             echo "\n\tThe file was not found: " . getcwd() . DIRECTORY_SEPARATOR . $path . "\n";
             return;
         }
     }
 }
コード例 #30
0
 /**
  * Returns the available options defined in the composer file.
  *
  * @param CommandEvent $event Command event object
  * @return array Associative list of option keys and values
  */
 protected static function getOptions(CommandEvent $event)
 {
     return $event->getComposer()->getPackage()->getExtra();
 }