mirror of https://github.com/docker/docs.git
Fixed bugs with dev flow.
This commit is contained in:
parent
4e96e37ae6
commit
cc10f7f423
|
|
@ -8,7 +8,6 @@ var ContainerStore = require('./ContainerStore');
|
|||
var Navigation = Router.Navigation;
|
||||
|
||||
var ContainerModal = React.createClass({
|
||||
mixins: [Navigation],
|
||||
getInitialState: function () {
|
||||
return {
|
||||
query: '',
|
||||
|
|
|
|||
|
|
@ -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 () {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
13
script/env
13
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
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $DIR/env
|
||||
|
||||
gulp
|
||||
gulp $*
|
||||
Loading…
Reference in New Issue