a3aa574397e2ae1875b9fbb6db11a378356bf0b5
[webi-installers/.git] / _common / gitea.js
1 'use strict';
2
3 var ghRelease = require('./github.js');
4
5 /**
6  * Gets the releases for 'ripgrep'. This function could be trimmed down and made
7  * for use with any github release.
8  *
9  * @param request
10  * @param {string} owner
11  * @param {string} repo
12  * @returns {PromiseLike<any> | Promise<any>}
13  */
14 function getAllReleases(request, owner, repo, baseurl) {
15   if (!baseurl) {
16     return Promise.reject('missing baseurl');
17   }
18   return ghRelease(request, owner, repo, baseurl + '/api/v1').then(function (all) {
19     return all;
20   });
21 }
22
23 module.exports = getAllReleases;
24
25 if (module === require.main) {
26   getAllReleases(require('@root/request'), 'coolaj86', 'go-pathman', 'https://git.coolaj86.com').then(
27   //getAllReleases(require('@root/request'), 'root', 'serviceman', 'https://git.rootprojects.org').then(
28     function (all) {
29       console.log(JSON.stringify(all, null, 2));
30     }
31   );
32 }