Skip to content

Commit 601b3c2

Browse files
Add a bit of documentation (#17)
* Add a bit of documentation I've met that function! 😊 * Update URLProvider.java * Provide additional explanation of the function * Provide additional explanation of the function * Update index.js * Update URLProvider.java * Add function description to python and go as well * Show maven debug output when building/testing java implementation
1 parent f5919d6 commit 601b3c2

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

.taskcluster.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ tasks:
111111
cd repo
112112
git config advice.detachedHead false
113113
git checkout {{event.head.sha}}
114-
mvn install
114+
mvn -X -e install
115115
metadata:
116116
name: taskcluster-lib-urls java test
117117
description: Run library test suite - java

src/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,18 @@ module.exports = {
175175
},
176176

177177
/**
178-
* Generate URL for Taskcluser UI.
178+
* Generate URL for Taskcluser UI. The purpose of the function is to switch on rootUrl:
179+
* "The driver for having a ui method is so we can just call ui with a path and any root url,
180+
* and the returned url should work for both our current deployment (with root URL = https://taskcluster.net)
181+
* and any future deployment. The returned value is essentially rootURL == 'https://taskcluster.net'
182+
* ? 'https://tools.taskcluster.net/${path}'
183+
* : '${rootURL}/${path}'. "
184+
*
185+
* @param rootUrl - string. Expected to be without a trailing slash
186+
* @param path - string. The rest of the path to append to the rootUrl.
187+
* Can start either with a slash or not.
188+
*
189+
* @returns string. The resulting url
179190
*/
180191
ui(rootUrl, path) {
181192
return withRootUrl(rootUrl).ui(path);

src/main/java/org/mozilla/taskcluster/urls/URLProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ public interface URLProvider {
2929
public String schema(String service, String schema);
3030

3131
/**
32-
* Generate URL for Taskcluser UI.
32+
* Generate URL for Taskcluser UI. The purpose of the function is to switch on rootUrl:
33+
* "The driver for having a ui method is so we can just call ui with a path and any root url,
34+
* and the returned url should work for both our current deployment (with root URL = https://taskcluster.net)
35+
* and any future deployment. The returned value is essentially rootURL == 'https://taskcluster.net'
36+
* ? 'https://tools.taskcluster.net/${path}'
37+
* : '${rootURL}/${path}'. "
38+
*
39+
* @param path - may or may not have an initial slash
3340
*/
3441
public String ui(String path);
3542

taskcluster_urls/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ def schema(root_url, service, name):
4444
return '{}/schemas/{}/{}'.format(root_url, service, name)
4545

4646
def ui(root_url, path):
47-
"""Generate URL for a path in the Taskcluster ui."""
47+
"""
48+
Generate URL for a path in the Taskcluster ui.
49+
The purpose of the function is to switch on rootUrl:
50+
"The driver for having a ui method is so we can just call ui with a path and any root url,
51+
and the returned url should work for both our current deployment (with root URL = https://taskcluster.net)
52+
and any future deployment. The returned value is essentially rootURL == 'https://taskcluster.net'
53+
'https://tools.taskcluster.net/${path}'
54+
'${rootURL}/${path}' "
55+
"""
4856
root_url = root_url.rstrip('/')
4957
path = path.lstrip('/')
5058
if root_url == OLD_ROOT_URL:

tcurls.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ func Schema(rootURL string, service string, name string) string {
6161
}
6262

6363
// UI generates a url for a page in taskcluster tools site
64+
// The purpose of the function is to switch on rootUrl:
65+
// "The driver for having a ui method is so we can just call ui with a path and any root url,
66+
// and the returned url should work for both our current deployment (with root URL = https://taskcluster.net)
67+
// and any future deployment. The returned value is essentially rootURL == 'https://taskcluster.net'
68+
// ? 'https://tools.taskcluster.net/${path}'
69+
// : '${rootURL}/${path}' "
6470
func UI(rootURL string, path string) string {
6571
path = strings.TrimLeft(path, "/")
6672
switch r := strings.TrimRight(rootURL, "/"); r {

0 commit comments

Comments
 (0)