Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kmadsen committed Sep 23, 2020
1 parent 71d6baa commit 9e276fd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
3 changes: 2 additions & 1 deletion validator/src/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ async function downloadService(release, service) {
async function downloadRelease(release, callback) {
const sdkServices = downloadService(release, "mapbox-sdk-services")
const sdkGeojson = downloadService(release, "mapbox-sdk-geojson")
let values = await Promise.all([sdkServices, sdkGeojson]);
const directionsModels = downloadService(release, "mapbox-sdk-directions-models")
let values = await Promise.all([sdkServices, sdkGeojson, directionsModels]);
callback(values)
}

Expand Down
19 changes: 16 additions & 3 deletions validator/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@ const releases = require('./releases')
const download = require('./download')
const runner = require('./runner')

const DEFAULT_SERVICE = "mapbox-sdk-services"

const argv = require('yargs')
.command('list-releases', 'Request available versions', (argv) => {
releases.listReleases(releases => {
console.log(releases)
.command('list-services', 'Request info on all available services', (argv) => {
releases.listServices(services => {
console.log(services)
});
})
.command('list-releases [service]', 'Request releases for a specific service', (argv) => {
argv.positional('service', {
describe: 'The service you want to know the releases available',
type: 'string',
default:DEFAULT_SERVICE
});
}, handler = (argv) => {
releases.listReleases(argv.service, release => {
console.log(release)
});
})
.command('download <release>', 'Download specific release', (argv) => {
Expand Down
14 changes: 10 additions & 4 deletions validator/src/releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ const fetch = require("node-fetch");
const fs = require('fs');

module.exports = {
listReleases: function(callback) {
const versionUrl = "https://api.bintray.com/search/packages/maven?g=com.mapbox.mapboxsdk&a=mapbox-sdk-services"
listServices: function(callback) {
const servicesUrl = "https://api.bintray.com/search/packages/maven?g=com.mapbox.mapboxsdk"
fetch(servicesUrl, { method: 'GET' })
.then( response => response.json() )
.then( json => callback(json) )
.catch( error => console.error('Unable to list services:', error) );
},
listReleases: function(service, callback) {
const versionUrl = `https://api.bintray.com/search/packages/maven?g=com.mapbox.mapboxsdk&a=${service}`
fetch(versionUrl, { method: 'GET' })
.then( response => response.json() )
.then( json => callback(json[0].versions) )
.then( json => callback(json) )
.catch( error => console.error('Unable to list release versions:', error) );
},

info: function(release, service) {
const releaseDirectory = this.mkdir(release)
const relativePath = `${releaseDirectory}/${service}.jar`
Expand Down
3 changes: 2 additions & 1 deletion validator/src/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function validateJsonData(release, data) {

java.classpath.push(`./${releaseDirectory}/mapbox-sdk-services.jar`);
java.classpath.push(`./${releaseDirectory}/mapbox-sdk-geojson.jar`);
java.classpath.push(`./${releaseDirectory}/mapbox-sdk-directions-models.jar`);

// TODO :thinking:
java.classpath.push("lib/gson-2.8.6.jar");
Expand All @@ -17,7 +18,7 @@ function validateJsonData(release, data) {

console.log(`Completed ${release} without a crash`)
} catch (err) {
console.log(`Completed ${release} with a CRASH`)
console.log(`Completed ${release} with a CRASH ${err}`)
}
}

Expand Down

0 comments on commit 9e276fd

Please sign in to comment.