Skip to content

Commit 2681c52

Browse files
committed
Adding Drone CI and updating template
1 parent 8d9524f commit 2681c52

File tree

12 files changed

+2345
-15
lines changed

12 files changed

+2345
-15
lines changed

.drone.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
kind: pipeline
3+
name: default
4+
5+
clone:
6+
7+
steps:
8+
- name: prepare_package
9+
image: joomlaprojects/docker-images:packager
10+
commands:
11+
- tar -cjf api-static.bz2 archived.html css/ images/ img/ js/ index.html results.html robots.txt 403.html 404.html .htaccess
12+
13+
- name: upload_package
14+
image: appleboy/drone-scp
15+
depends_on: [ prepare_package ]
16+
settings:
17+
host:
18+
from_secret: api_host
19+
user:
20+
from_secret: api_user
21+
key:
22+
from_secret: api_key
23+
port: 22
24+
target: /home/api/
25+
source: api-static.bz2
26+
27+
- name: extract_package
28+
image: appleboy/drone-ssh
29+
depends_on: [ upload_package ]
30+
settings:
31+
host:
32+
from_secret: update_host
33+
user:
34+
from_secret: update_user
35+
key:
36+
from_secret: update_key
37+
port: 22
38+
script:
39+
- tar jxf /home/api/api-static.bz2 -C /home/api/public_html
40+
- rm -rf /home/api/api-static.bz2
41+
42+
trigger:
43+
branch:
44+
- master
45+
event:
46+
- push
47+
48+
---
49+
kind: pipeline
50+
name: build_v2_documentation
51+
52+
clone:
53+
54+
steps:
55+
- name: prepare
56+
image: joomlaprojects/docker-images:php7.4
57+
commands:
58+
- composer install
59+
- vendor/bin/robo repos:checkout --fw=2
60+
61+
- name: generate_documentation
62+
image: phpdoc/phpdoc
63+
commands:
64+
- phpdoc run -d ./repos/*/src -t ./build/api-docs/v2/ --template ./ --title "Joomla! Framework 2.x API" -i ./repos/string/src/phputf8 --setting=graphs.enabled=true
65+
66+
---
67+
kind: signature
68+
hmac: 89007fb9d696ce7ddba323bd86e2957070075e74ab5f288d5a41bf5490060967
69+
70+
...

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44
.settings
55
.DS_Store
66
.idea
7+
8+
/.phpdoc/
9+
/api-docs/
10+
/build/
11+
/repos/
12+
/vendor/

RoboFile.php

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
/**
3+
* @package Joomla.Internal-Documentation
4+
*
5+
* @copyright Copyright (C) 2022 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later; see LICENSE.txt
7+
*/
8+
9+
use Robo\Symfony\ConsoleIO;
10+
use Robo\Tasks;
11+
12+
require_once 'vendor/autoload.php';
13+
14+
/**
15+
* Modern php task runner for Joomla! Browser Automated Tests execution
16+
*
17+
* @package RoboFile
18+
*
19+
* @since 1.0
20+
*/
21+
class RoboFile extends Tasks
22+
{
23+
protected $config;
24+
25+
public function buildApidocu(ConsoleIO $io, $opts = ['fw' => '2'])
26+
{
27+
$this->reposCheckout($io, $opts);
28+
$this->generatePhpdocu($io, $opts);
29+
}
30+
31+
public function reposCheckout(ConsoleIO $io, $opts = ['fw' => '2'])
32+
{
33+
$this->say('Checking out correct version of the framework repos');
34+
35+
if (!$this->config)
36+
{
37+
$this->config = \Symfony\Component\Yaml\Yaml::parseFile(__DIR__ . '/packages.yml');
38+
}
39+
40+
$taglessDirectories = [
41+
'datetime',
42+
'mediawiki-api',
43+
'renderer',
44+
'symfony-event-dispatcher-bridge'
45+
];
46+
47+
foreach ($this->config['packages'] as $name => $package)
48+
{
49+
if (is_null($package) || (is_array($package) && !(isset($package['deprecated']) || isset($package['abandoned']))))
50+
{
51+
$repo = $name;
52+
53+
if (isset($package['repo']))
54+
{
55+
$repo = $package['repo'];
56+
}
57+
58+
$this->say('Repository: ' . $name . ' (' . $repo . ')');
59+
60+
if (!is_dir(__DIR__ . '/repos/' . $name))
61+
{
62+
$this->say('Clone repo');
63+
system('git clone https://github.com/joomla-framework/' . $repo . '.git ./repos/' . $name);
64+
}
65+
66+
chdir(__DIR__ . '/repos/' . $name);
67+
$tag = system('git tag -l "' . $opts['fw'] . '.*"');
68+
system("git checkout tags/$tag");
69+
70+
chdir(__DIR__ . '/');
71+
}
72+
}
73+
74+
$this->say('Repos have been checked out.');
75+
}
76+
77+
public function generatePhpdocu(ConsoleIO $io, $opts = ['fw' => '2'])
78+
{
79+
$this->say('Generate API documentation using phpDocumentor for Joomla Framework ' . $opts['fw'] . '.x packages');
80+
$this->_exec('php phpDocumentor.phar -d ./repos/*/src -t ./build/api-docs/v' . $opts['fw'] . '/ --template ./ --title "Joomla! Framework ' . $opts['fw'] . '.x API" -i ./repos/string/src/phputf8');
81+
}
82+
}

base/macros.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
{{ element.description }}
5454
{% endif %}
5555
</div>
56-
{% if path(element) and type not in ['function', 'constant'] %}<a href="{{ path(element) }}" class="element__details">« More »</a>{% endif %}
56+
{% if path(element) and type not in ['function', 'constant'] %}<a href="{{ path(element|route('url')) }}" class="element__details">« More »</a>{% endif %}
5757
</div>
5858
{% endmacro %}

composer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "joomla/api.joomla.org",
3+
"description": "Code for api.joomla.org",
4+
"homepage": "http://github.com/joomla/api.joomla.org",
5+
"license": "GPL-2.0-or-later",
6+
"require": {
7+
"php": "^7.4"
8+
},
9+
"require-dev": {
10+
"consolidation/robo": "~3.0.4"
11+
},
12+
"config": {
13+
"platform": {
14+
"php": "7.4.0"
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)