Skip to content

Commit

Permalink
Updating devMode to only pull from version branch not master
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Sep 21, 2015
1 parent f7a832f commit 7da5305
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions app/scripts/downloadLibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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
Expand All @@ -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('@');
Expand All @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ci/travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ after-success() {
git remote add origin [email protected]:$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
Expand Down
2 changes: 1 addition & 1 deletion scripts/downloadLibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7da5305

Please sign in to comment.