Skip to content

Commit f2af6e9

Browse files
committed
About to generate versioned API
1 parent 8ce5490 commit f2af6e9

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ api/
77
cache/
88
coverage/
99
docs/_build
10+
_site/

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ php:
99
# disabled hhvm because of a bug in 3.2.0 which is resolved in 3.3.0
1010
# see: https://github.com/facebook/hhvm/issues/3932
1111

12-
addons:
13-
apt:
14-
packages:
15-
- git
16-
1712
install:
1813
- composer install
1914

sami.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@
22
require_once __DIR__ . '/vendor/autoload.php';
33

44
use Sami\Sami;
5+
use Sami\Version\GitVersionCollection;
56
use Symfony\Component\Finder\Finder;
67

7-
$iterator = Finder::create()->files()->name('*.php')->in(__DIR__ . '/src');
8+
$dir = __DIR__ . '/src';
9+
$iterator = Finder::create()
10+
->files()
11+
->name('*.php')
12+
->in($dir);
13+
14+
$versions = GitVersionCollection::create($dir)
15+
->addFromTags('v0.*')
16+
->add('master', 'master branch')
17+
;
818

919
return new Sami($iterator, [
1020
'title' => 'PHP Code Generator API',
1121
'theme' => 'default',
12-
'build_dir' => __DIR__ . '/api',
22+
'versions' => $versions,
23+
'build_dir' => __DIR__ . '/api/%version%',
24+
'cache_dir' => __DIR__ . '/cache/%version%',
1325
'default_opened_level' => 2
14-
]);
26+
]);

0 commit comments

Comments
 (0)