当前位置: 首页>>代码示例>>PHP>>正文


PHP PhingFile::getName方法代码示例

本文整理汇总了PHP中PhingFile::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP PhingFile::getName方法的具体用法?PHP PhingFile::getName怎么用?PHP PhingFile::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhingFile的用法示例。


在下文中一共展示了PhingFile::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: evaluate

 /**
  * Evaluate the selector with the file.
  * @return true if the file is selected by the embedded selector.
  */
 public function evaluate()
 {
     if ($this->file === null) {
         throw new BuildException('file attribute not set');
     }
     $this->validate();
     $myBaseDir = $this->baseDir;
     if ($myBaseDir === null) {
         $myBaseDir = $this->getProject()->getBaseDir();
     }
     /** @var FileSelector $f */
     $file = $this->getSelectors($this->getProject());
     $f = $file[0];
     return $f->isSelected($myBaseDir, $this->file->getName(), $this->file);
 }
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:19,代码来源:IsFileSelected.php

示例2: main

 /**
  * @throws BuildException
  */
 public function main()
 {
     $this->checkPreconditions();
     try {
         $this->log('Building archive: ' . $this->destinationFile->__toString(), Project::MSG_INFO);
         /**
          * Delete old archive, if exists.
          */
         if ($this->destinationFile->exists()) {
             $isDeleted = $this->destinationFile->delete();
             if (!$isDeleted) {
                 $this->log("Could not delete destination file {$this->destinationFile}", Project::MSG_WARN);
             }
         }
         $pharData = new PharData($this->baseDirectory->getPath() . '/' . $this->destinationFile->getName());
         foreach ($this->filesets as $fileset) {
             $this->log('Adding specified files in ' . $fileset->getDir($this->project) . ' to archive', Project::MSG_VERBOSE);
             $pharData->buildFromIterator($fileset->getIterator(), $fileset->getDir($this->project));
         }
         if ($this->compression !== PHAR::NONE && $pharData->canCompress($this->compression)) {
             try {
                 $pharData->compress($this->compression);
             } catch (UnexpectedValueException $uve) {
                 $pharData->compressFiles($this->compression);
             }
             unset($pharData);
         }
     } catch (Exception $e) {
         throw new BuildException('Problem creating archive: ' . $e->getMessage(), $e, $this->getLocation());
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:34,代码来源:PharDataTask.php

示例3: setOptions

 private function setOptions($pkg)
 {
     $options['baseinstalldir'] = 'propel';
     $options['packagedirectory'] = $this->dir->getAbsolutePath();
     if (empty($this->filesets)) {
         throw new BuildException("You must use a <fileset> tag to specify the files to include in the package.xml");
     }
     $options['filelistgenerator'] = 'Fileset';
     // Some PHING-specific options needed by our Fileset reader
     $options['phing_project'] = $this->getProject();
     $options['phing_filesets'] = $this->filesets;
     if ($this->packageFile !== null) {
         // create one w/ full path
         $f = new PhingFile($this->packageFile->getAbsolutePath());
         $options['packagefile'] = $f->getName();
         // must end in trailing slash
         $options['outputdirectory'] = $f->getParent() . DIRECTORY_SEPARATOR;
         $this->log("Creating package file: " . $f->getPath(), Project::MSG_INFO);
     } else {
         $this->log("Creating [default] package.xml file in base directory.", Project::MSG_INFO);
     }
     // add install exceptions
     $options['installexceptions'] = array('pear/pear-propel-gen' => '/', 'pear/pear-propel-gen.bat' => '/', 'pear/pear-build.xml' => '/', 'pear/build.properties' => '/');
     $options['dir_roles'] = array('projects' => 'data', 'test' => 'test', 'templates' => 'data', 'resources' => 'data');
     $options['exceptions'] = array('pear/pear-propel-gen.bat' => 'script', 'pear/pear-propel-gen' => 'script', 'pear/pear-build.xml' => 'data', 'build.xml' => 'data', 'build-propel.xml' => 'data');
     $pkg->setOptions($options);
 }
开发者ID:sensorsix,项目名称:app,代码行数:27,代码来源:BuildPropelGenPEARPackageTask.php

示例4: setOptions

 private function setOptions($pkg)
 {
     $options['baseinstalldir'] = 'phing';
     $options['packagedirectory'] = $this->dir->getAbsolutePath();
     if (empty($this->filesets)) {
         throw new BuildException("You must use a <fileset> tag to specify the files to include in the package.xml");
     }
     $options['filelistgenerator'] = 'Fileset';
     // Some PHING-specific options needed by our Fileset reader
     $options['phing_project'] = $this->getProject();
     $options['phing_filesets'] = $this->filesets;
     if ($this->packageFile !== null) {
         // create one w/ full path
         $f = new PhingFile($this->packageFile->getAbsolutePath());
         $options['packagefile'] = $f->getName();
         // must end in trailing slash
         $options['outputdirectory'] = $f->getParent() . DIRECTORY_SEPARATOR;
         $this->log("Creating package file: " . $f->getPath(), Project::MSG_INFO);
     } else {
         $this->log("Creating [default] package.xml file in base directory.", Project::MSG_INFO);
     }
     if ($this->mode == "docs") {
         $options['dir_roles'] = array('phing_guide' => 'doc', 'api' => 'doc', 'example' => 'doc');
     } else {
         // add install exceptions
         $options['installexceptions'] = array('bin/phing.php' => '/', 'bin/pear-phing' => '/', 'bin/pear-phing.bat' => '/');
         $options['dir_roles'] = array('etc' => 'data');
         $options['exceptions'] = array('bin/pear-phing.bat' => 'script', 'bin/pear-phing' => 'script', 'CREDITS' => 'doc', 'CHANGELOG' => 'doc', 'README' => 'doc', 'UPGRADE' => 'doc', 'TODO' => 'doc');
     }
     $pkg->setOptions($options);
 }
开发者ID:namesco,项目名称:phing,代码行数:31,代码来源:BuildPhingPEARPackageTask.php

示例5: doWork

 /**
  * Copied from 'CopyTask.php'
  */
 protected function doWork()
 {
     // These "slots" allow filters to retrieve information about the currently-being-process files
     $fromSlot = $this->getRegisterSlot("currentFromFile");
     $fromBasenameSlot = $this->getRegisterSlot("currentFromFile.basename");
     $toSlot = $this->getRegisterSlot("currentToFile");
     $toBasenameSlot = $this->getRegisterSlot("currentToFile.basename");
     $mapSize = count($this->fileCopyMap);
     $total = $mapSize;
     if ($mapSize > 0) {
         $this->log("Minifying " . $mapSize . " file" . ($mapSize === 1 ? '' : 's') . " to " . $this->destDir->getAbsolutePath());
         // walks the map and actually copies the files
         $count = 0;
         foreach ($this->fileCopyMap as $from => $to) {
             if ($from === $to) {
                 $this->log("Skipping self-copy of " . $from, $this->verbosity);
                 $total--;
                 continue;
             }
             $this->log("From " . $from . " to " . $to, $this->verbosity);
             try {
                 // try to copy file
                 $fromFile = new PhingFile($from);
                 $toFile = new PhingFile($to);
                 $fromSlot->setValue($fromFile->getPath());
                 $fromBasenameSlot->setValue($fromFile->getName());
                 $toSlot->setValue($toFile->getPath());
                 $toBasenameSlot->setValue($toFile->getName());
                 $this->fileUtils->copyFile($fromFile, $toFile, $this->overwrite, $this->preserveLMT, $this->filterChains, $this->getProject());
                 // perform ''minification'' once all other things are done on it.
                 $this->minify($toFile);
                 $count++;
             } catch (IOException $ioe) {
                 $this->log("Failed to minify " . $from . " to " . $to . ": " . $ioe->getMessage(), Project::MSG_ERR);
             }
         }
     }
     // handle empty dirs if appropriate
     if ($this->includeEmpty) {
         $destdirs = array_values($this->dirCopyMap);
         $count = 0;
         foreach ($destdirs as $destdir) {
             $d = new PhingFile((string) $destdir);
             if (!$d->exists()) {
                 if (!$d->mkdirs()) {
                     $this->log("Unable to create directory " . $d->__toString(), Project::MSG_ERR);
                 } else {
                     $count++;
                 }
             }
         }
         if ($count > 0) {
             $this->log("Copied " . $count . " empty director" . ($count == 1 ? "y" : "ies") . " to " . $this->destDir->getAbsolutePath());
         }
     }
 }
开发者ID:jldupont,项目名称:jldupont.com,代码行数:59,代码来源:JsMinTask.php

示例6: main

 /**
  * do the work
  * @throws BuildException if required attributes are not supplied
  *                        property and attribute are required attributes
  */
 public function main()
 {
     if ($this->property === null) {
         throw new BuildException("property attribute required", $this->getLocation());
     }
     if ($this->file == null) {
         throw new BuildException("file attribute required", $this->getLocation());
     }
     $value = $this->file->getName();
     if ($this->suffix != null && StringHelper::endsWith($this->suffix, $value)) {
         // if the suffix does not starts with a '.' and the
         // char preceding the suffix is a '.', we assume the user
         // wants to remove the '.' as well
         $pos = strlen($value) - strlen($this->suffix) - 1;
         if ($pos > 0 && $this->suffix[0] !== '.' && $value[$pos] === '.') {
             $pos--;
         }
         $value = StringHelper::substring($value, 0, $pos);
     }
     $this->getProject()->setNewProperty($this->property, $value);
 }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:26,代码来源:Basename.php

示例7: initTar

 /**
  * Init a Archive_Tar class with correct compression for the given file.
  *
  * @param PhingFile $tarfile
  * @return Archive_Tar the tar class instance
  */
 private function initTar(PhingFile $tarfile)
 {
     $compression = null;
     $tarfileName = $tarfile->getName();
     $mode = strtolower(substr($tarfileName, strrpos($tarfileName, '.')));
     $compressions = array('gz' => array('.gz', '.tgz'), 'bz2' => array('.bz2'));
     foreach ($compressions as $algo => $ext) {
         if (array_search($mode, $ext) !== false) {
             $compression = $algo;
             break;
         }
     }
     return new Archive_Tar($tarfile->getAbsolutePath(), $compression);
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:20,代码来源:UntarTask.php

示例8: setOptions

 private function setOptions($pkg)
 {
     $options = array();
     $options['baseinstalldir'] = 'spindash';
     $options['packagedirectory'] = $this->dir->getAbsolutePath();
     $options['filelistgenerator'] = 'Fileset';
     $options['phing_project'] = $this->getProject();
     $options['phing_filesets'] = $this->filesets;
     if (!is_null($this->packageFile)) {
         $f = new PhingFile($this->packageFile->getAbsolutePath());
         $options['packagefile'] = $f->getName();
         $options['outputdirectory'] = $f->getParent() . DIRECTORY_SEPARATOR;
         $this->log("Creating package file: " . $f->getPath(), Project::MSG_INFO);
     } else {
         $this->log("Creating [default] package.xml file in base directory.", Project::MSG_INFO);
     }
     $pkg->setOptions($options);
 }
开发者ID:wst,项目名称:spindash,代码行数:18,代码来源:BuildPearPackage.php

示例9: initTar

 /**
  * Init a Archive_Tar class with correct compression for the given file.
  *
  * @param PhingFile $tarfile
  * @return Archive_Tar the tar class instance
  */
 private function initTar(PhingFile $tarfile)
 {
     $compression = null;
     $tarfileName = $tarfile->getName();
     $mode = substr($tarfileName, strrpos($tarfileName, '.'));
     switch ($mode) {
         case '.gz':
             $compression = 'gz';
             break;
         case '.bz2':
             $compression = 'bz2';
             break;
         case '.tar':
             break;
         default:
             $this->log('Ignoring unknown compression mode: ' . $mode, PROJECT_MSG_WARN);
     }
     return new Archive_Tar($tarfile->getAbsolutePath(), $compression);
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:25,代码来源:UntarTask.php

示例10: isSelected

 /**
  * The heart of the matter. This is where the selector gets to decide
  * on the inclusion of a file in a particular fileset.
  *
  * @param PhingFile $basedir the base directory the scan is being done from
  * @param string $filename is the name of the file to check
  * @param PhingFile $file is a java.io.File object the selector can use
  *
  * @return bool whether the file should be selected or not
  *
  * @throws BuildException
  */
 public function isSelected(PhingFile $basedir, $filename, PhingFile $file)
 {
     // throw BuildException on error
     $this->validate();
     // Determine file whose out-of-dateness is to be checked
     $destfiles = $this->map->main($filename);
     // If filename does not match the To attribute of the mapper
     // then filter it out of the files we are considering
     if (empty($destfiles)) {
         return false;
     }
     // Sanity check
     if (count($destfiles) !== 1 || $destfiles[0] === null) {
         throw new BuildException('Invalid destination file results for ' . $this->targetdir->getName() . ' with filename ' . $filename);
     }
     $destname = $destfiles[0];
     $fu = new FileUtils();
     $destfile = $fu->resolveFile($this->targetdir, $destname);
     return $this->selectionTest($file, $destfile);
 }
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:32,代码来源:MappingSelector.php

示例11: setOptions

 private function setOptions($pkg)
 {
     $options['baseinstalldir'] = 'propel';
     $options['packagedirectory'] = $this->dir->getAbsolutePath();
     if (empty($this->filesets)) {
         throw new BuildException("You must use a <fileset> tag to specify the files to include in the package.xml");
     }
     $options['filelistgenerator'] = 'Fileset';
     // Some PHING-specific options needed by our Fileset reader
     $options['phing_project'] = $this->getProject();
     $options['phing_filesets'] = $this->filesets;
     if ($this->packageFile !== null) {
         // create one w/ full path
         $f = new PhingFile($this->packageFile->getAbsolutePath());
         $options['packagefile'] = $f->getName();
         // must end in trailing slash
         $options['outputdirectory'] = $f->getParent() . DIRECTORY_SEPARATOR;
         $this->log("Creating package file: " . $f->getPath(), Project::MSG_INFO);
     } else {
         $this->log("Creating [default] package.xml file in base directory.", Project::MSG_INFO);
     }
     $pkg->setOptions($options);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:23,代码来源:BuildPropelPEARPackageTask.php

示例12: setFile

 public function setFile(PhingFile $file)
 {
     $this->setDir($file->getParentFile());
     $this->createInclude()->setName($file->getName());
 }
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:5,代码来源:AbstractFileSet.php

示例13: main

 /**
  * Main method builds all the targets for a typical propel project.
  */
 public function main()
 {
     // check to make sure task received all correct params
     $this->validate();
     $generatorConfig = $this->getGeneratorConfig();
     // loading model from database
     $this->log('Reading databases structure...');
     $connections = $generatorConfig->getBuildConnections();
     if (!$connections) {
         throw new Exception('You must define database connection settings in a buildtime-conf.xml file to use diff');
     }
     $totalNbTables = 0;
     $ad = new AppData();
     foreach ($connections as $name => $params) {
         $this->log(sprintf('Connecting to database "%s" using DSN "%s"', $name, $params['dsn']), Project::MSG_VERBOSE);
         $pdo = $generatorConfig->getBuildPDO($name);
         $database = new Database($name);
         $platform = $generatorConfig->getConfiguredPlatform($pdo);
         $database->setPlatform($platform);
         $database->setDefaultIdMethod(IDMethod::NATIVE);
         $parser = $generatorConfig->getConfiguredSchemaParser($pdo);
         $nbTables = $parser->parse($database, $this);
         $ad->addDatabase($database);
         $totalNbTables += $nbTables;
         $this->log(sprintf('%d tables imported from database "%s"', $nbTables, $name), Project::MSG_VERBOSE);
     }
     if ($totalNbTables) {
         $this->log(sprintf('%d tables imported from databases.', $totalNbTables));
     } else {
         $this->log('Database is empty');
     }
     // loading model from XML
     $this->packageObjectModel = true;
     $appDatasFromXml = $this->getDataModels();
     $appDataFromXml = array_pop($appDatasFromXml);
     // comparing models
     $this->log('Comparing models...');
     $manager = new PropelMigrationManager();
     $manager->setConnections($connections);
     $manager->setMigrationDir($this->getOutputDirectory());
     $migrationsUp = array();
     $migrationsDown = array();
     foreach ($ad->getDatabases() as $database) {
         $name = $database->getName();
         $this->log(sprintf('Comparing database "%s"', $name), Project::MSG_VERBOSE);
         if (!$appDataFromXml->hasDatabase($name)) {
             // FIXME: tables present in database but not in XML
             continue;
         }
         $databaseDiff = PropelDatabaseComparator::computeDiff($database, $appDataFromXml->getDatabase($name), $this->isCaseInsensitive());
         if (!$databaseDiff) {
             $this->log(sprintf('Same XML and database structures for datasource "%s" - no diff to generate', $name), Project::MSG_VERBOSE);
             continue;
         }
         $this->log(sprintf('Structure of database was modified in datasource "%s": %s', $name, $databaseDiff->getDescription()));
         $platform = $generatorConfig->getConfiguredPlatform(null, $name);
         $migrationsUp[$name] = $platform->getModifyDatabaseDDL($databaseDiff);
         $migrationsDown[$name] = $platform->getModifyDatabaseDDL($databaseDiff->getReverseDiff());
     }
     if (!$migrationsUp) {
         $this->log('Same XML and database structures for all datasource - no diff to generate');
         return;
     }
     $timestamp = time();
     $migrationFileName = $manager->getMigrationFileName($timestamp);
     $migrationClassBody = $manager->getMigrationClassBody($migrationsUp, $migrationsDown, $timestamp);
     $_f = new PhingFile($this->getOutputDirectory(), $migrationFileName);
     file_put_contents($_f->getAbsolutePath(), $migrationClassBody);
     $this->log(sprintf('"%s" file successfully created in %s', $_f->getName(), $_f->getParent()));
     if ($editorCmd = $this->getEditorCmd()) {
         $this->log(sprintf('Using "%s" as text editor', $editorCmd));
         shell_exec($editorCmd . ' ' . escapeshellarg($_f->getAbsolutePath()));
     } else {
         $this->log('  Please review the generated SQL statements, and add data migration code if necessary.');
         $this->log('  Once the migration class is valid, call the "migrate" task to execute it.');
     }
 }
开发者ID:halfer,项目名称:Meshing,代码行数:80,代码来源:PropelSQLDiffTask.php

示例14: main

 /**
  * Executes the task.
  */
 public function main()
 {
     if ($this->property === null) {
         throw new BuildException('The property attribute must be specified');
     }
     if ($this->path === null) {
         throw new BuildException('The path attribute must be specified');
     }
     if ($this->ignoreIfSet && $this->project->getProperty($this->property) !== null) {
         return;
     }
     if (!$this->path->exists()) {
         throw new BuildException('The path ' . $this->path->getAbsolutePath() . ' does not exist');
     }
     $this->path = $this->path->getAbsoluteFile();
     if (!$this->path->isDirectory()) {
         $this->path = $this->path->getParentFile();
     }
     /* Check if the current directory is a project directory. */
     $check = new AgaviModuleFilesystemCheck();
     $check->setConfigDirectory($this->project->getProperty('module.directory.config'));
     $check->setPath($this->path->getAbsolutePath());
     if ($check->check()) {
         /* The current path is the project directory. */
         $this->log('Module base directory: ' . $this->path);
         $this->project->setUserProperty($this->property, $this->path->getName());
         return;
     }
     /* Check if "actions", "views", "templates", or "config" are in the current path. */
     if (preg_match(sprintf('#^(.+?)/(?:%s|%s|%s|%s)(?:/|$)#', $this->project->getProperty('module.directory.actions'), $this->project->getProperty('module.directory.views'), $this->project->getProperty('module.directory.templates'), $this->project->getProperty('module.directory.config')), $this->path->getPath(), $matches)) {
         $directory = new PhingFile($matches[1]);
         $check->setPath($directory->getAbsolutePath());
         if ($check->check()) {
             $this->log('Module base directory: ' . $directory);
             $this->project->setUserProperty($this->property, $directory->getName());
             return;
         }
     }
     /* Last chance: recurse upward and check for a project directory. */
     $directory = $this->path;
     while (($directory = $directory->getParentFile()) !== null) {
         $check->setPath($directory->getAbsolutePath());
         if ($check->check()) {
             $this->log('Module base directory: ' . $directory);
             $this->project->setUserProperty($this->property, $directory->getName());
             return;
         }
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:52,代码来源:AgaviLocatemoduleTask.php

示例15: setPhpDocumentorOptions

 /**
  * Sets the options on the passed-in phpdoc setup object.
  * @param PhingPhpDocumentorSetup $phpdoc
  */
 protected function setPhpDocumentorOptions(PhingPhpDocumentorSetup $phpdoc)
 {
     // Title MUST be set first ... (because it re-initializes the internal state of the PhpDocu renderer)
     if ($this->title) {
         $phpdoc->setTitle($this->title);
     }
     if ($this->parsePrivate) {
         $phpdoc->setParsePrivate();
     }
     if ($this->javadocDesc) {
         $phpdoc->setJavadocDesc();
     }
     if ($this->quiet) {
         $phpdoc->setQuietMode();
     }
     if ($this->destdir) {
         $phpdoc->setTargetDir($this->destdir->getAbsolutePath());
     }
     if ($this->packages) {
         $phpdoc->setPackageOutput($this->packages);
     }
     if ($this->templateBase) {
         $phpdoc->setTemplateBase($this->templateBase->getAbsolutePath());
     }
     if ($this->linksource) {
         $phpdoc->setGenerateSourcecode($this->linksource);
     }
     if ($this->examplesDir) {
         $phpdoc->setExamplesDir($this->examplesDir->getAbsolutePath());
     }
     if ($this->ignoreTags) {
         $phpdoc->setIgnoreTags($this->ignoreTags);
     }
     if ($this->defaultPackageName) {
         $phpdoc->setDefaultPackageName($this->defaultPackageName);
     }
     if ($this->defaultCategoryName) {
         $phpdoc->setDefaultCategoryName($this->defaultCategoryName);
     }
     if ($this->pear) {
         $phpdoc->setPear($this->pear);
     }
     if ($this->ignore) {
         $phpdoc->setIgnore($this->ignore);
     }
     // append any files in filesets
     $filesToParse = array();
     foreach ($this->filesets as $fs) {
         $files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
         foreach ($files as $filename) {
             $f = new PhingFile($fs->getDir($this->project), $filename);
             $filesToParse[] = $f->getAbsolutePath();
         }
     }
     //print_r(implode(",", $filesToParse));
     $phpdoc->setFilesToParse(implode(",", $filesToParse));
     // append any files in filesets
     $ricFiles = array();
     foreach ($this->projDocFilesets as $fs) {
         $files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
         foreach ($files as $filename) {
             $f = new PhingFile($fs->getDir($this->project), $filename);
             $ricFiles[] = $f->getName();
         }
     }
     $phpdoc->setRicFiles($ricFiles);
     if ($this->undocumentedelements) {
         $phpdoc->setUndocumentedelements($this->undocumentedelements);
     }
     if ($this->customtags) {
         $phpdoc->setCustomtags($this->customtags);
     }
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:77,代码来源:PhpDocumentorTask.php


注:本文中的PhingFile::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。