diff --git a/app/ContainerModal.react.js b/app/ContainerModal.react.js index da2930212f..8b5d74cdb0 100644 --- a/app/ContainerModal.react.js +++ b/app/ContainerModal.react.js @@ -8,7 +8,6 @@ var ContainerStore = require('./ContainerStore'); var Navigation = Router.Navigation; var ContainerModal = React.createClass({ - mixins: [Navigation], getInitialState: function () { return { query: '', diff --git a/app/ContainerStore.js b/app/ContainerStore.js index 44d273916e..cf239b19eb 100644 --- a/app/ContainerStore.js +++ b/app/ContainerStore.js @@ -45,7 +45,7 @@ var ContainerStore = assign(EventEmitter.prototype, { stream.on('data', function (data) { console.log(data); - // TODO: Make + // TODO: Dont refresh on deleting placeholder containers self.update(function (err) { console.log('Updated container data.'); }); @@ -82,10 +82,6 @@ var ContainerStore = assign(EventEmitter.prototype, { _pullScratchImage: function (callback) { var image = docker.client().getImage('scratch:latest'); image.inspect(function (err, data) { - if (err) { - callback(err); - return; - } if (!data) { docker.client().pull('scratch:latest', function (err, stream) { if (err) { @@ -130,6 +126,10 @@ var ContainerStore = assign(EventEmitter.prototype, { _createPlaceholderContainer: function (imageName, name, callback) { console.log('_createPlaceholderContainer', imageName, name); this._pullScratchImage(function (err) { + if (err) { + callback(err); + return; + } docker.client().createContainer({ Image: 'scratch:latest', Tty: false, @@ -158,14 +158,11 @@ var ContainerStore = assign(EventEmitter.prototype, { } } }, - // Returns all shoes + // Returns all containers containers: function() { return this._containers; }, create: function (repository, tag, callback) { - - console.log('create', repository, tag); - var containerName = this._generateName(repository); tag = tag || 'latest'; var imageName = repository + ':' + tag; @@ -191,7 +188,8 @@ var ContainerStore = assign(EventEmitter.prototype, { callback(null, containerName); stream.setEncoding('utf8'); stream.on('data', function (data) { - console.log(data); + // TODO: update progress + //console.log(data); }); stream.on('end', function () { self._createContainer(imageName, containerName, function () { @@ -199,8 +197,6 @@ var ContainerStore = assign(EventEmitter.prototype, { }); }); }); - - // Create placeholder container } else { // If not then directly create the container self._createContainer(imageName, containerName, function () { diff --git a/app/boot2docker.js b/app/boot2docker.js index f4ef4858a9..1c90bfe105 100644 --- a/app/boot2docker.js +++ b/app/boot2docker.js @@ -6,7 +6,7 @@ var async = require('async'); var cmdExec = function (cmd, callback) { exec(cmd, function (stderr, stdout, code) { - if (code) { + if (code !== 0) { callback('Exit code ' + code + ': ' + stderr); } else { callback(null, stdout); diff --git a/app/main.js b/app/main.js index 0e6a4bfdc3..05e9e31515 100644 --- a/app/main.js +++ b/app/main.js @@ -49,7 +49,7 @@ var routes = ( ); boot2docker.ip(function (err, ip) { - if (!err) { + if (window.location.hash !== '#/') { docker.setHost(ip); ContainerStore.init(function () { Router.run(routes, function (Handler) { diff --git a/script/env b/script/env index afc1b55acf..343e8551df 100755 --- a/script/env +++ b/script/env @@ -7,6 +7,8 @@ export NPM="$BASE/cache/node-v$NODE_VERSION/bin/npm" export NODE="$BASE/cache/node-v$NODE_VERSION/bin/node" export PATH="$BASE/cache/node-v$NODE_VERSION/bin/:$BASE/node_modules/.bin:$PATH" export NODE_PATH="$BASE/node_modules" +export BOOT2DOCKER_CLI_VERSION=$($NODE -pe "JSON.parse(process.argv[1])['boot2docker-version']" "$(cat $BASE/package.json)") +export BOOT2DOCKER_CLI_VERSION_FILE=boot2docker-$BOOT2DOCKER_CLI_VERSION mkdir -p $BASE/cache @@ -20,3 +22,14 @@ if [ ! -f "$NODE" ]; then fi popd > /dev/null + +pushd $BASE/resources > /dev/null + +if [ ! -f $BOOT2DOCKER_CLI_VERSION_FILE ]; then + cecho "-----> Downloading Boot2docker CLI..." $purple + rm -rf boot2docker-* + curl -L -o $BOOT2DOCKER_CLI_VERSION_FILE https://github.com/boot2docker/boot2docker-cli/releases/download/v${BOOT2DOCKER_CLI_VERSION}/boot2docker-v${BOOT2DOCKER_CLI_VERSION}-darwin-amd64 + chmod +x $BOOT2DOCKER_CLI_VERSION_FILE +fi + +popd > /dev/null diff --git a/script/run b/script/gulp similarity index 91% rename from script/run rename to script/gulp index 29b93c51a3..c576fd1f81 100755 --- a/script/run +++ b/script/gulp @@ -2,4 +2,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $DIR/env -gulp +gulp $*