ref: rename .getDistributables()

This commit is contained in:
AJ ONeal
2024-09-13 01:52:04 -06:00
parent 3364dcb075
commit e3e61ca256
12 changed files with 38 additions and 38 deletions

View File

@@ -7,7 +7,7 @@
* @param {string} formula
* @returns {PromiseLike<any> | Promise<any>}
*/
function getAllReleases(request, formula) {
function getDistributables(request, formula) {
if (!formula) {
return Promise.reject('missing formula for brew');
}
@@ -55,10 +55,10 @@ function failOnBadStatus(resp) {
return resp;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(require('@root/request'), 'mariadb').then(function (all) {
getDistributables(require('@root/request'), 'mariadb').then(function (all) {
console.info(JSON.stringify(all, null, 2));
});
}

View File

@@ -115,7 +115,7 @@ Repos.getCommitInfo = async function (repoPath, commitish) {
* @param {string} gitUrl
* @returns {PromiseLike<any> | Promise<any>}
*/
async function getAllReleases(gitUrl) {
async function getDistributables(gitUrl) {
let all = {
releases: [],
download: '',
@@ -190,7 +190,7 @@ async function getAllReleases(gitUrl) {
return all;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
(async function main() {
@@ -203,7 +203,7 @@ if (module === require.main) {
//'https://github.com/dense-analysis/ale.git',
];
for (let url of testRepos) {
let all = await getAllReleases(url);
let all = await getDistributables(url);
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all, null, 2));

View File

@@ -12,7 +12,7 @@ var GitHubish = require('./githubish.js');
* @param {String} [username]
* @param {String} [token]
*/
async function getAllReleases(
async function getDistributables(
_request,
owner,
repo,
@@ -21,7 +21,7 @@ async function getAllReleases(
token = '',
) {
baseurl = `${baseurl}/api/v1`;
let all = await GitHubish.getAllReleases({
let all = await GitHubish.getDistributables({
owner,
repo,
baseurl,
@@ -31,10 +31,10 @@ async function getAllReleases(
return all;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(
getDistributables(
null,
'root',
'pathman',
@@ -42,7 +42,7 @@ if (module === require.main) {
'',
'',
).then(
//getAllReleases(require('@root/request'), 'root', 'serviceman', 'https://git.rootprojects.org').then(
//getDistributables(require('@root/request'), 'root', 'serviceman', 'https://git.rootprojects.org').then(
function (all) {
console.info(JSON.stringify(all, null, 2));
},

View File

@@ -11,7 +11,7 @@ require('dotenv').config();
* @param {string} repo
* @returns {PromiseLike<any> | Promise<any>}
*/
async function getAllReleases(
async function getDistributables(
request,
owner,
repo,
@@ -120,10 +120,10 @@ function combinate(all, oses, arches) {
return all;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(
getDistributables(
require('@root/request'),
'BeyondCodeBootcamp',
'DuckDNS.sh',

View File

@@ -14,7 +14,7 @@ let GitHubish = require('./githubish.js');
* @param {String} [username]
* @param {String} [token]
*/
async function getAllReleases(
async function getDistributables(
_request,
owner,
repo,
@@ -22,7 +22,7 @@ async function getAllReleases(
username = process.env.GITHUB_USERNAME || '',
token = process.env.GITHUB_TOKEN || '',
) {
let all = await GitHubish.getAllReleases({
let all = await GitHubish.getDistributables({
owner,
repo,
baseurl,
@@ -32,10 +32,10 @@ async function getAllReleases(
return all;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(null, 'BurntSushi', 'ripgrep').then(function (all) {
getDistributables(null, 'BurntSushi', 'ripgrep').then(function (all) {
console.info(JSON.stringify(all, null, 2));
});
}

View File

@@ -12,7 +12,7 @@ let GitHubish = module.exports;
* @param {String} [opts.username]
* @param {String} [opts.token]
*/
GitHubish.getAllReleases = async function ({
GitHubish.getDistributables = async function ({
owner,
repo,
baseurl,
@@ -114,7 +114,7 @@ GitHubish.getAllReleases = async function ({
};
if (module === require.main) {
GitHubish.getAllReleases({
GitHubish.getDistributables({
owner: 'BurntSushi',
repo: 'ripgrep',
baseurl: 'https://api.github.com',

View File

@@ -18,7 +18,7 @@ function isOdd(filename) {
}
}
function getAllReleases(request) {
function getDistributables(request) {
/*
{
version: 'go1.13.8',
@@ -86,10 +86,10 @@ function getAllReleases(request) {
});
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(require('@root/request')).then(function (all) {
getDistributables(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
all.releases = all.releases.slice(0, 10);
console.info(JSON.stringify(all, null, 2));

View File

@@ -76,16 +76,16 @@ function transformReleases(links) {
};
}
async function getAllReleases(request) {
async function getDistributables(request) {
let releases = await getRawReleases(request);
let all = transformReleases(releases);
return all;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(require('@root/request')).then(function (all) {
getDistributables(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
all.releases = all.releases.slice(0, 10000);
console.info(JSON.stringify(all, null, 2));

View File

@@ -56,7 +56,7 @@ function transformReleases(links) {
};
}
function getAllReleases(request) {
function getDistributables(request) {
return getRawReleases(request)
.then(transformReleases)
.then(function (all) {
@@ -64,10 +64,10 @@ function getAllReleases(request) {
});
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(require('@root/request')).then(function (all) {
getDistributables(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
all.releases = all.releases.slice(0, 10000);
console.info(JSON.stringify(all, null, 2));

View File

@@ -10,7 +10,7 @@ var archMap = {
powerpc64le: 'ppc64le',
};
async function getAllReleases() {
async function getDistributables() {
let all = {
releases: [],
download: '',
@@ -134,10 +134,10 @@ function sortByVersion(a, b) {
return 0;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases().then(function (all) {
getDistributables().then(function (all) {
all = require('../_webi/normalize.js')(all);
all.releases = all.releases.slice(0, 10);
console.info(JSON.stringify(all, null, 2));

View File

@@ -40,7 +40,7 @@ let pkgMap = {
musl: ['tar.gz', 'tar.xz'],
};
async function getAllReleases(request) {
async function getDistributables(request) {
let all = {
releases: [],
download: '',
@@ -174,10 +174,10 @@ async function getAllReleases(request) {
return all;
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(require('@root/request')).then(function (all) {
getDistributables(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all));
//console.info(JSON.stringify(all, null, 2));

View File

@@ -1,6 +1,6 @@
'use strict';
function getAllReleases(request) {
function getDistributables(request) {
return request({
url: 'https://releases.hashicorp.com/terraform/index.json',
json: true,
@@ -37,10 +37,10 @@ function getAllReleases(request) {
});
}
module.exports = getAllReleases;
module.exports = getDistributables;
if (module === require.main) {
getAllReleases(require('@root/request')).then(function (all) {
getDistributables(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all));
});