public static function create(ProjectInterface $project) { /** @var GitVersionCollection $gitVersionCollection */ $gitVersionCollection = GitVersionCollection::create($project->getDir()); foreach ($project->getTags() as $tag) { $gitVersionCollection->addFromTags($tag); } foreach ($project->getBranches() as $branch => $title) { $gitVersionCollection->add($branch, $title); } return $gitVersionCollection; }
public function getConfiguration() { if (!file_exists($this->projectDir)) { throw new \Exception(sprintf('Directory "%s" does no exists', $this->projectDir)); } $this->projectDir = realpath($this->projectDir); $samiCache = getenv('HOME') . '/.sami'; if (!is_dir($samiCache) && !@mkdir($samiCache, 0777, true)) { throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist and could not be created.', $samiCache)); } if (!is_writable($samiCache)) { throw new \InvalidArgumentException(sprintf('The directory "%s" is not writable.', $samiCache)); } $projectCachePath = $samiCache . '/' . str_replace('/', '-', $this->projectDir); $projectSrcCachePath = $projectCachePath . '/src'; $projectSamiCachePath = $projectCachePath . '/cache'; $git_cmd = function ($cmd) use($projectSrcCachePath) { return exec(sprintf('git --git-dir=%s --work-tree=%s %s >/dev/null 2>&1', $projectSrcCachePath . '/.git', $projectSrcCachePath, $cmd)); }; if (!file_exists($projectSrcCachePath)) { exec(sprintf('git clone %s %s', $this->projectDir, $projectSrcCachePath)); } else { $git_cmd('fetch'); } foreach (array_keys($this->branches) as $branch) { $git_cmd('branch ' . $branch); $git_cmd('checkout ' . $branch); $git_cmd('reset --hard origin/' . $branch); } $iterator = Finder::create()->files()->name('*.php')->exclude('Tests')->in($projectSrcCachePath . '/' . $this->srcDir); $versions = GitVersionCollection::create($projectSrcCachePath); foreach ($this->branches as $key => $value) { $versions->add($key, $value); } return new Sami($iterator, array('theme' => 'lyrixx', 'versions' => $versions, 'title' => $this->name, 'build_dir' => $this->buildDir . '/%version%', 'cache_dir' => $projectSamiCachePath . '/%version%', 'template_dirs' => array(__DIR__ . '/themes/lyrixx'), 'default_opened_level' => 2)); }
<?php use Sami\Sami; use Symfony\Component\Finder\Finder; use Sami\Version\GitVersionCollection; use Sami\RemoteRepository\GitHubRemoteRepository; $repository_root = dirname(__DIR__); $iterator = Finder::create()->files()->name('*.php')->in("{$repository_root}/src"); // generate documentation for all tags, and the master branch $versions = GitVersionCollection::create($repository_root)->addFromTags('*')->add('master', 'master branch'); return new Sami($iterator, array('versions' => $versions, 'title' => 'Silk API', 'build_dir' => __DIR__ . '/../../silk-api-docs/%version%', 'cache_dir' => __DIR__ . '/../../silk-api-docs-cache/%version%', 'remote_repository' => new GitHubRemoteRepository('aaemnnosttv/silk', $repository_root), 'default_opened_level' => 2));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $src = __DIR__ . '/../src'; $iterator = Finder::create()->files()->name('*.php')->in($src); $versions = GitVersionCollection::create($src . '/../')->addFromTags()->add('master', 'master'); return new Sami($iterator, array('theme' => 'enhanced', 'versions' => $versions, 'title' => 'Project API', 'build_dir' => __DIR__ . '/api/%version%', 'cache_dir' => __DIR__ . '/api/%version%', 'default_opened_level' => 2));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $dir = __DIR__ . '/src'; $iterator = Finder::create()->files()->name('*.php')->in($dir); $versions = GitVersionCollection::create($dir)->addFromTags(function ($version) { return preg_match('/^v?\\d+\\.\\d+\\.\\d+$/', $version); })->add('master', 'production')->add('develop', 'development'); $options = array('title' => 'jk/restserver API', 'versions' => $versions, 'build_dir' => __DIR__ . '/build/sami/%version%', 'cache_dir' => __DIR__ . '/build/sami_cache/%version%', 'default_opened_level' => 2); return new Sami($iterator, $options);
<?php use Sami\Sami; use Sami\RemoteRepository\GitHubRemoteRepository; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $dir = realpath(__DIR__ . '/../lavacharts/src'); $iterator = Finder::create()->files()->name('*.php')->exclude('Laravel')->in($dir); $versions = GitVersionCollection::create($dir)->add('2.5', '2.5.x Branch')->add('3.0', '3.0.x Branch'); $options = ['theme' => 'lava', 'versions' => $versions, 'title' => 'Lavacharts API', 'build_dir' => __DIR__ . '/build/%version%', 'cache_dir' => __DIR__ . '/cache/%version%', 'default_opened_level' => 2]; $sami = new Sami($iterator, $options); $templates = $sami['template_dirs']; $templates[] = __DIR__ . '/themes/'; $sami['template_dirs'] = $templates; return $sami;
$relativeFileName = str_replace(PIWIK_DOCUMENT_ROOT, '', $phpFile); $foundHooks = $hooks->searchForHooksInFile($relativeFileName, $phpFile); if (!empty($foundHooks)) { foreach ($foundHooks as $hook) { $view['hooks'][] = $hook; } } } $view['hooks'] = $hooks->sortHooksByName($view['hooks']); $view['hooks'] = $hooks->addUsages($view['hooks']); $hooks->generateDocumentation($view, $target); } $latestStable = file_get_contents('http://builds.piwik.org/LATEST_BETA'); $latestStable = trim($latestStable); if (empty($latestStable)) { echo 'Unable to fetch latest version'; exit(1); } /** @var $versions GitVersionCollection */ $versions = GitVersionCollection::create(PIWIK_DOCUMENT_ROOT)->add('master', 'master branch'); $versions->rewind(); while ($versions->valid()) { $version = $versions->current(); $sami = generateApiClassesReference($rootDir, $version->getName()); generateHooksReference($rootDir, $version->getName(), $sami); $versions->next(); } } catch (Exception $e) { echo 'Parse Error: ', $e->getMessage() . PHP_EOL; echo $e->getTraceAsString(); }
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $dir = dirname(__FILE__); // Define where we should look for source files, and where we should not look for source files. $iterator = Finder::create()->files()->name('*.php')->in($dir . '/../src'); // Setup the basic configuration settings for Sami. $configuration = array('title' => 'Documentation: When (Date Recursion Library)', 'build_dir' => $dir, 'cache_dir' => $dir . '/.cache'); // If this library has been cloned from the repository, then we can build documentation for the development branch, // the current release, and all other releases (tags). if (is_dir($dir . '/../.git')) { $configuration['versions'] = GitVersionCollection::create($dir . '/..')->addFromTags()->add('develop', 'Development Branch')->add('master', 'Current Release'); $configuration['build_dir'] .= '/%version%'; $configuration['cache_dir'] .= '/%version%'; } // Create a new instance of the Sami Docs Generator and return it, after passing in some configuration options of // course. return new Sami($iterator, $configuration);
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; $versions = GitVersionCollection::create(dirname(__FILE__) . '/src')->add('master', 'master branch')->addFromTags('1.*'); return new Sami(dirname(__FILE__) . '/src', array('title' => 'Notificato API', 'build_dir' => dirname(__FILE__) . '/../notificato-apidocs/%version%', 'cache_dir' => dirname(__FILE__) . '/../notificato-apidocs/cache/%version%', 'versions' => $versions));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create()->files()->name('*.php')->exclude('Resources')->exclude('Tests')->in($dir = __DIR__ . '/src'); $versions = GitVersionCollection::create($dir)->addFromTags('v0.1.*')->addFromTags('v0.2.*')->add('master'); return new Sami($iterator, ['theme' => 'default', 'versions' => $versions, 'title' => 'Psi', 'build_dir' => __DIR__ . '/docs/psi/%version%', 'cache_dir' => __DIR__ . '/cache/psi/%version%', 'default_opened_level' => 2]);
<?php $dir = dirname(__DIR__) . '/src'; use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create()->files()->name('*.php')->exclude('tests')->in($dir); $versions = GitVersionCollection::create($dir)->add('master', 'master branch')->add('unitTest', 'unitTest')->add('filecache', 'filecache'); return new Sami($iterator, array('theme' => 'enhanced', 'versions' => $versions, 'title' => 'Erdiko API', 'build_dir' => __DIR__ . '/build/%version%/', 'cache_dir' => __DIR__ . '/cache/%version%/', 'default_opened_level' => 1)); //php ../sami.phar update ./sami/sami_conf.php
<?php require 'vendor/autoload.php'; use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create()->files()->name('**.php')->exclude('Resources')->exclude('Tests')->exclude('vendor')->exclude('build')->in(__DIR__); $versions = GitVersionCollection::create(__DIR__)->addFromTags('v1.0.*')->add('master', 'master branch'); return new Sami($iterator, array('title' => 'GeoLocation Bundle', 'versions' => $versions, 'build_dir' => __DIR__ . '/build/doc/%version%', 'cache_dir' => __DIR__ . '/cache/doc/%version%', 'default_opened_level' => 3));
<?php use Sami\Sami; use Sami\RemoteRepository\GitHubRemoteRepository; use Sami\Version\GitVersionCollection; $directory = __DIR__ . '/src'; $versions = GitVersionCollection::create($directory)->add('0.3.0', '0.3.0')->add('0.2.0', '0.2.0')->add('0.1.0', '0.1.0')->add('master', 'master branch')->add('develop', 'develop branch'); $sami = new Sami($directory, ['theme' => 'default', 'versions' => $versions, 'title' => 'Klaviyo PHP API Library', 'build_dir' => '/tmp/sami/build/klaviyo-api-php/%version%', 'cache_dir' => '/tmp/sami/cache/klaviyo-api-php/%version%', 'remote_repository' => new GitHubRemoteRepository('GollyGood/klaviyo-api-php', dirname($directory)), 'default_opened_level' => 1]); return $sami;
<?php require __DIR__ . '/vendor/autoload.php'; use Sami\Sami; use Sami\Version\GitVersionCollection; $versions = GitVersionCollection::create(__DIR__ . '/src')->addFromTags('v1.0.*')->add('master', 'v2.0.0 dev'); return new Sami(__DIR__ . '/src', array('versions' => $versions, 'title' => 'Fabricius API', 'build_dir' => __DIR__ . '/../api/fabricius/%version%', 'cache_dir' => __DIR__ . '/../cache/fabricius/%version%', 'default_opened_level' => 1));
<?php use Sami\RemoteRepository\GitHubRemoteRepository; use Sami\Sami; use Sami\Version\GitVersionCollection; $versions = GitVersionCollection::create(__DIR__ . '/src')->addFromTags('v*.*.*')->addFromTags('v*.*')->add('master'); return new Sami(__DIR__ . '/src', array('versions' => $versions, 'build_dir' => __DIR__ . '/sami/build/%version%', 'cache_dir' => __DIR__ . '/sami/cache/%version%', 'remote_repository' => new GitHubRemoteRepository('Raphy/epitech-api', __DIR__)));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create()->files()->name('*.php')->exclude('tests')->in(dirname(__DIR__) . '/src')->in(dirname(__DIR__) . '/vendor/psr')->in(dirname(__DIR__) . '/vendor/skyzyx/signer/src'); $repo = dirname(__DIR__); $versions = GitVersionCollection::create($repo)->addFromTags('1.*')->add('master', 'master branch'); return new Sami($iterator, array('versions' => $versions, 'title' => 'WePay Signer for PHP', 'build_dir' => __DIR__ . '/api-build/%version%', 'cache_dir' => __DIR__ . '/api-cache/%version%', 'default_opened_level' => 2));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create()->files()->name('*.php')->exclude('Resources')->in($dir = 'src'); $versions = GitVersionCollection::create($dir)->add('develop', 'develop branch')->add('master', 'master branch')->addFromTags('*'); return new Sami($iterator, array('theme' => 'enhanced', 'versions' => $versions, 'title' => 'AuthBucket\\Bundle\\OAuth2Bundle API', 'build_dir' => __DIR__ . '/build/sami/%version%', 'cache_dir' => __DIR__ . '/build/cache/sami/%version%', 'include_parent_data' => false, 'default_opened_level' => 3));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $versions = GitVersionCollection::create(__DIR__)->addFromTags('*.*.0'); return new Sami(Finder::create()->files()->name('*.php')->in(__DIR__ . '/src/lib'), array('build_dir' => __DIR__ . '/../docs/%version%', 'cache_dir' => sys_get_temp_dir() . '/lib-country/%version%', 'theme' => 'github', 'versions' => $versions));
<?php use GitElephant\Repository; use Sami\Version\GitVersionCollection; $dir = __DIR__ . '/src'; $versions = GitVersionCollection::create($dir); $versions->add('master', 'master branch'); foreach (Repository::open('.')->getTags() as $tag) { $versions->addFromTags($tag->getName()); } return new Sami\Sami($dir, array('build_dir' => 'build/%version%', 'cache_dir' => 'cache/%version%', 'title' => 'GitElephant API', 'default_opened_level' => 2, 'versions' => $versions));
<?php require_once __DIR__ . '/vendor/autoload.php'; use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $dir = __DIR__ . '/src'; $iterator = Finder::create()->files()->name('*.php')->in($dir); $versions = GitVersionCollection::create($dir)->addFromTags('v0.*')->add('master', 'master branch'); return new Sami($iterator, ['title' => 'PHP Code Generator API', 'theme' => 'default', 'versions' => $versions, 'build_dir' => __DIR__ . '/api/%version%', 'cache_dir' => __DIR__ . '/cache/%version%', 'default_opened_level' => 2]);
<?php use Sami\RemoteRepository\GitHubRemoteRepository; use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $dir = '../src'; ini_set('memory_limit', -1); $iterator = Finder::create()->files()->name('*.php')->in($dir); $versions = GitVersionCollection::create($dir)->addFromTags('v4.*'); return new Sami($iterator, array('title' => 'Clusterpoint 4.0 PHP Client API', 'versions' => $versions, 'build_dir' => __DIR__ . '/docapi/build/%version%', 'cache_dir' => __DIR__ . '/docapi/cache/%version%', 'default_opened_level' => 2, 'remote_repository' => new GitHubRemoteRepository('clusterpoint/php-client-api-v4', '../')));
<?php require __DIR__ . '/../../vendor/autoload.php'; use Sami\Sami; use Symfony\Component\Finder\Finder; use Sami\Version\GitVersionCollection; use Sami\RemoteRepository\GitHubRemoteRepository; $iterator = Finder::create()->files()->name('*.php')->exclude('stubs')->in($dir = __DIR__ . '/laravel/src'); $versions = GitVersionCollection::create($dir)->add('4.2', 'Laravel 4.2')->add('5.0', 'Laravel 5.0')->add('5.1', 'Laravel 5.1')->add('5.2', 'Laravel 5.2')->add('master', 'Laravel Dev'); return new Sami($iterator, array('title' => 'Laravel API', 'versions' => $versions, 'build_dir' => __DIR__ . '/build/%version%', 'cache_dir' => __DIR__ . '/cache/%version%', 'default_opened_level' => 2, 'remote_repository' => new GitHubRemoteRepository('laravel/framework', dirname($dir))));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create()->files()->name('*.php')->in($dir = sprintf('%s/src', __DIR__)); $versions = GitVersionCollection::create($dir)->add('master', 'master branch'); return new Sami($iterator, array('versions' => $versions, 'title' => 'Fermio Sprites API', 'build_dir' => sprintf('%s/api', __DIR__), 'cache_dir' => sprintf('%s/cache', __DIR__)));
<?php require_once __DIR__ . '/bootstrap.php'; require_once ABSPATH . '/wp-admin/includes/plugin.php'; $data = get_plugin_data(COMFORT_FILE); $versions = \Sami\Version\GitVersionCollection::create(dirname(__DIR__))->addFromTags('v1.*.*')->add('master'); $iterator = new \Symfony\Component\Finder\Finder(); $iterator->files()->in(COMFORT_DIR . '/includes')->name('*.php')->append(\Symfony\Component\Finder\Finder::create()->in(COMFORT_DIR)->name('*.php')->depth(0)); $config = new Sami\Sami($iterator, ['versions' => $versions, 'title' => 'Comfort', 'build_dir' => COMFORT_DIR . '/var/sami/%version%', 'cache_dir' => COMFORT_DIR . '/var/sami/cache/%version%']); return $config;
<?php /*************************************************************************************/ /* */ /* Thelia */ /* */ /* Copyright (c) OpenStudio */ /* email : info@thelia.net */ /* web : http://www.thelia.net */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 3 of the License */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* */ /*************************************************************************************/ #require 'vendor/autoload.php'; use Sami\Sami; use Symfony\Component\Finder\Finder; use Sami\Version\GitVersionCollection; $theliaPath = getenv("THELIA_PATH") . '/core/lib'; $iterator = Finder::create()->files()->name('*.php')->exclude('Resources')->exclude('I18n')->exclude('Tests')->in($theliaPath); $versions = GitVersionCollection::create($theliaPath)->add('2.2.0', '2.2.0 tag')->add('2.2.1', '2.2.1 tag')->add('master', 'master branch'); return new Sami($iterator, array('theme' => 'default', 'versions' => $versions, 'title' => 'Thelia 2 API', 'build_dir' => __DIR__ . '/api/%version%', 'cache_dir' => __DIR__ . '/cache/api/%version%', 'default_opened_level' => 2));