From 7da5305fee5741a51f5f20a33cae6c8baf66d188 Mon Sep 17 00:00:00 2001 From: Mike Pirog Date: Mon, 21 Sep 2015 14:08:03 -0700 Subject: [PATCH] Updating devMode to only pull from version branch not master --- app/scripts/downloadLibs.js | 23 ++++++++++++----------- ci/travis-ci.sh | 2 +- scripts/downloadLibs.js | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/scripts/downloadLibs.js b/app/scripts/downloadLibs.js index a93e003..6df3982 100644 --- a/app/scripts/downloadLibs.js +++ b/app/scripts/downloadLibs.js @@ -134,15 +134,16 @@ var getProjectVersion = function(project, callback) { // If we are in dev mode this is trivial if (getDevMode() === true || getDevMode() === 'true') { - callback('master'); + callback('v' + ['0', getMinorVersion()].join('.')); } // If not we need to do some exploration on the github API else { // Request opts to find the github tags for a project + var projectParts = project.split('@'); var options = { hostname: 'api.github.com', port: 443, - path: '/repos/kalabox/' + project + '/tags', + path: '/repos/kalabox/' + projectParts[0] + '/tags', method: 'GET', json: true, headers: {'User-Agent': 'Kalabox'} @@ -172,19 +173,19 @@ var getProjectVersion = function(project, callback) { }; /** - * Returns a string with the url of the master branch + * Returns a string with the url of the dev branch * tarball. The package must be on github and have a repository - * field in its pacakge.json. It must also have a master branch that is + * field in its pacakge.json. It must also have a dev branch that is * considered the development branch on github. */ -var getMasterTarball = function(pkg) { +var getTarball = function(pkg, version) { // Build our tarball URL // https://github.com/kalabox/kalabox-plugin-dbenv/tarball/master var tarUrl = { protocol: 'https:', host: 'github.com', - pathname: ['kalabox', pkg, 'tarball', 'master'].join('/') + pathname: ['kalabox', pkg, 'tarball', version].join('/') }; // Return the formatted tar URL @@ -201,7 +202,7 @@ var getMasterTarball = function(pkg) { * and have a master branch or this is not going to work. * */ -var pkgToDev = function(pkg) { +var pkgToDev = function(pkg, version) { // Split our package so we can reassemble later var parts = pkg.split('@'); @@ -210,8 +211,8 @@ var pkgToDev = function(pkg) { if (_.includes(pkg, 'kalabox-')) { // Get the tarball location - var masterTar = getMasterTarball(parts[0]); - return [parts[0], masterTar].join('@'); + var tar = getTarball(parts[0], version); + return [parts[0], tar].join('@'); } // Otherwise just return what we have @@ -225,8 +226,8 @@ var pkgToDev = function(pkg) { _.forEach(pkgs, function(pkg) { getProjectVersion(pkg, function(version) { - if (version === 'master') { - pkg = pkgToDev(pkg); + if (version.charAt(0) === 'v') { + pkg = pkgToDev(pkg, version); } var spawn = require('child_process').spawn; diff --git a/ci/travis-ci.sh b/ci/travis-ci.sh index ea2387d..3d1efc1 100755 --- a/ci/travis-ci.sh +++ b/ci/travis-ci.sh @@ -91,7 +91,7 @@ after-success() { git remote add origin git@github.com:$TRAVIS_REPO_SLUG.git git checkout $TRAVIS_BRANCH - if [ $TRAVIS_BRANCH == "master" ]; then + if [ -z "$DISCO_TAG" ]; then # If we are on the master branch then we need to grab the dev # releases of packages when we build our app deps later on export KALABOX_DEV=true diff --git a/scripts/downloadLibs.js b/scripts/downloadLibs.js index 6bdead7..1a4bbce 100644 --- a/scripts/downloadLibs.js +++ b/scripts/downloadLibs.js @@ -133,7 +133,7 @@ var getProjectVersion = function(project, callback) { // If we are in dev mode this is trivial if (getDevMode() === true || getDevMode() === 'true') { - callback('master'); + callback('v' + ['0', getMinorVersion()].join('.')); } // If not we need to do some exploration on the github API else {