From 11c5c223ef2efe841b894cfa27728dd700cb84d1 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 13:26:02 -0500 Subject: [PATCH 01/39] Add npm release and fix travis build Signed-off-by: Jeffrey Morgan --- .travis.yml | 4 ++-- package.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ad7f44200..bc0086f423 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,8 @@ script: after_script: - echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex - - security unlock-keychain -p "$KEY_SECRET" ~/Library/Keychains/keychain.keychain - - grunt release + - security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain + - npm run release os: - osx diff --git a/package.json b/package.json index 81342308da..800cb69d0c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "start": "grunt", "test": "jest -c jest-unit.json", "integration": "jest -c jest-integration.json", + "release": "grunt release", "lint": "jsxhint src" }, "license": "Apache-2.0", From 2d8de479ce0c59cbebec0fdf7946f7fc60827c1b Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 13:33:50 -0500 Subject: [PATCH 02/39] Add wine to travis ci Signed-off-by: Jeffrey Morgan --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index bc0086f423..76a63881b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ before_install: - brew unlink node - brew update - brew install homebrew/versions/node4-lts + - brew install wine script: - npm install From 11e766b23deac83dae4311d7d6369e200bffec92 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 14:29:30 -0500 Subject: [PATCH 03/39] Travis: temporarily remove wine Signed-off-by: Jeffrey Morgan --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 76a63881b5..2608929464 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ before_install: - brew unlink node - brew update - brew install homebrew/versions/node4-lts - - brew install wine script: - npm install @@ -17,6 +16,8 @@ script: after_script: - echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex - security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain + - security list-keychains + - security default-keychain -s ~/Library/Keychains/keychain.keychain - npm run release os: From 52dbf1a91d63a5c30aa0c3b26bc59af13898081d Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 14:49:40 -0500 Subject: [PATCH 04/39] Move release script to ci directory Signed-off-by: Jeffrey Morgan --- .travis.yml | 8 +------- ci/release | 5 +++++ 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 ci/release diff --git a/.travis.yml b/.travis.yml index 2608929464..12878978ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,7 @@ script: - npm install - npm test - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' - -after_script: - - echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex - - security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain - - security list-keychains - - security default-keychain -s ~/Library/Keychains/keychain.keychain - - npm run release + - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' os: - osx diff --git a/ci/release b/ci/release new file mode 100644 index 0000000000..fb9e430645 --- /dev/null +++ b/ci/release @@ -0,0 +1,5 @@ +echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex +security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain +security default-keychain -s keychain.keychain +security list-keys +npm run release From 875144508522fbdb6c4449bf87d620f0f48375cd Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 14:50:03 -0500 Subject: [PATCH 05/39] Chmod +x release script Signed-off-by: Jeffrey Morgan --- ci/release | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci/release diff --git a/ci/release b/ci/release old mode 100644 new mode 100755 From 750af65ffcb31868a4cf6b61588ff7857531f59d Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 15:03:00 -0500 Subject: [PATCH 06/39] Fix release command Signed-off-by: Jeffrey Morgan --- ci/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release b/ci/release index fb9e430645..98c03bd338 100755 --- a/ci/release +++ b/ci/release @@ -1,5 +1,5 @@ echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain security default-keychain -s keychain.keychain -security list-keys +security list-keychains npm run release From 7b79874a8a4268b4f57cf24608306d93d56a66dc Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 15:15:41 -0500 Subject: [PATCH 07/39] Temporary release-mac task Signed-off-by: Jeffrey Morgan --- Gruntfile.js | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index ee2afeadc6..d4f3e0afa4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -244,6 +244,7 @@ module.exports = function (grunt) { grunt.registerTask('default', ['newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']); grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron', 'copy:osx', 'shell:sign', 'shell:zip', 'copy:windows', 'rcedit:exes', 'compress']); + grunt.registerTask('release-mac', ['clean:release', 'babel', 'less', 'copy:dev', 'electron:osx', 'copy:osx', 'shell:sign', 'shell:zip']); process.on('SIGINT', function () { grunt.task.run(['shell:electron:kill']); diff --git a/package.json b/package.json index 800cb69d0c..7d057aad29 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test": "jest -c jest-unit.json", "integration": "jest -c jest-integration.json", "release": "grunt release", + "release-mac": "grunt release-mac", "lint": "jsxhint src" }, "license": "Apache-2.0", From 80f01815a8668076392da894fa5279a029eee80b Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 15:28:59 -0500 Subject: [PATCH 08/39] Travis: run release-mac Signed-off-by: Jeffrey Morgan --- ci/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release b/ci/release index 98c03bd338..4ab8348ace 100755 --- a/ci/release +++ b/ci/release @@ -2,4 +2,4 @@ echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/L security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain security default-keychain -s keychain.keychain security list-keychains -npm run release +npm run release-mac From d804a20527fc156018213f81f61d1e7d199c7c76 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 15:41:32 -0500 Subject: [PATCH 09/39] Travis: add linux build Signed-off-by: Jeffrey Morgan --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12878978ce..ffc629d48a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,10 @@ before_install: script: - npm install - npm test - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' + - '[ "${TRAVIS_OS_NAME}" = "linux" ] && npm test || false' + - '[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' + - '[ "${TRAVIS_OS_NAME}" = "osx" && "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' os: - osx + - linux From f03f307b5787fa9352e8b2f1733da7c77dfa1533 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 15:45:08 -0500 Subject: [PATCH 10/39] Travis: use build matrix for dual os --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffc629d48a..434c6e7bd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ cache: directories: - - resources - node_modules before_install: @@ -10,11 +9,15 @@ before_install: script: - npm install - - npm test - '[ "${TRAVIS_OS_NAME}" = "linux" ] && npm test || false' - '[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' - '[ "${TRAVIS_OS_NAME}" = "osx" && "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' -os: - - osx - - linux +matrix: + include: + - os: linux + services: + - docker + - os: osx + language: generic + From 179f437c35f61fcc1e0fc19b65bc2db1c8b08b09 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 15:55:19 -0500 Subject: [PATCH 11/39] Travis: fix node version Signed-off-by: Jeffrey Morgan --- .travis.yml | 14 +++++++------- ci/install | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100755 ci/install diff --git a/.travis.yml b/.travis.yml index 434c6e7bd3..077a5968b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,22 +2,22 @@ cache: directories: - node_modules -before_install: - - brew unlink node - - brew update - - brew install homebrew/versions/node4-lts +install: ./ci/install script: - npm install - '[ "${TRAVIS_OS_NAME}" = "linux" ] && npm test || false' - - '[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' - - '[ "${TRAVIS_OS_NAME}" = "osx" && "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' + - '[ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' + - '[ "${TRAVIS_OS_NAME}" = "osx" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release-mac || false' matrix: include: - os: linux services: - - docker + - docker + language: node_js + node_js: + - "4.1" - os: osx language: generic diff --git a/ci/install b/ci/install new file mode 100755 index 0000000000..0851c751f6 --- /dev/null +++ b/ci/install @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew unlink node + brew update + brew install homebrew/versions/node4-lts +fi From 30118cfd7fe59f06af003b8d733412ab74ab5583 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:19:58 -0500 Subject: [PATCH 12/39] Travis: release script Signed-off-by: Jeffrey Morgan --- .travis.yml | 18 +++++++++--------- ci/release | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 077a5968b8..084e7799b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,18 +6,18 @@ install: ./ci/install script: - npm install - - '[ "${TRAVIS_OS_NAME}" = "linux" ] && npm test || false' - - '[ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' - - '[ "${TRAVIS_OS_NAME}" = "osx" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release-mac || false' + - npm test + - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' + - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' matrix: include: - - os: linux - services: - - docker - language: node_js - node_js: - - "4.1" + - os: linux + services: + - docker + language: node_js + node_js: + - "4.1" - os: osx language: generic diff --git a/ci/release b/ci/release index 4ab8348ace..71d763e80f 100755 --- a/ci/release +++ b/ci/release @@ -1,5 +1,12 @@ -echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex -security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain -security default-keychain -s keychain.keychain -security list-keychains -npm run release-mac +#!/bin/bash + +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex + security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain + security default-keychain -s keychain.keychain + security list-keychains + npm run release-mac +else + echo "Skipped for now" +fi + From 637306b03c466d75a087ee5aba8b40b3574cecaf Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:26:08 -0500 Subject: [PATCH 13/39] Remove circle.yml Signed-off-by: Jeffrey Morgan --- circle.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 circle.yml diff --git a/circle.yml b/circle.yml deleted file mode 100644 index a6cf065bc2..0000000000 --- a/circle.yml +++ /dev/null @@ -1,3 +0,0 @@ -machine: - node: - version: 4.1.2 From dcb4fbf5a9503e9c43af368cb395e40035b9241b Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:27:55 -0500 Subject: [PATCH 14/39] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6939a181d6..5c58342740 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/kitematic/kitematic.svg?branch=master)](https://travis-ci.org/kitematic/kitematic) +[![Build Status](https://travis-ci.org/docker/kitematic.svg?branch=master)](https://travis-ci.org/kitematic/kitematic) [![Kitematic Logo](https://cloud.githubusercontent.com/assets/251292/5269258/1b229c3c-7a2f-11e4-96f1-e7baf3c86d73.png)](https://kitematic.com) From dbdbee24cc84ef7b6577791abe90cab7ca7a97e3 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:29:29 -0500 Subject: [PATCH 15/39] Travis: install on new line Signed-off-by: Jeffrey Morgan --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 084e7799b1..05b31a7af1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,8 @@ cache: directories: - node_modules -install: ./ci/install +install: + - ./ci/install script: - npm install From 94a55bc87ea827120b79141ac7461eb8dd7d920d Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:33:53 -0500 Subject: [PATCH 16/39] Travis: lint .travis.yml Signed-off-by: Jeffrey Morgan --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05b31a7af1..240b51fd95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,12 @@ script: matrix: include: - - os: linux - services: - - docker - language: node_js - node_js: - - "4.1" + - os: linux + services: + - docker + language: node_js + node_js: + - "4.1" - os: osx language: generic From f50a846d2692e96807ff907e332c1392af2b566f Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:36:50 -0500 Subject: [PATCH 17/39] Travis: install wine on linux Signed-off-by: Jeffrey Morgan --- ci/install | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/install b/ci/install index 0851c751f6..a289c67cfc 100755 --- a/ci/install +++ b/ci/install @@ -1,7 +1,9 @@ #!/bin/bash if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew unlink node - brew update - brew install homebrew/versions/node4-lts + brew unlink node + brew update + brew install homebrew/versions/node4-lts +else + apt-get install wine fi From 53ef34a13dd03aa7b81e1b5b8e6cc6d4cccbea69 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:39:02 -0500 Subject: [PATCH 18/39] Travis: add sudo to apt-get Signed-off-by: Jeffrey Morgan --- ci/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/install b/ci/install index a289c67cfc..b1598e70d7 100755 --- a/ci/install +++ b/ci/install @@ -5,5 +5,5 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update brew install homebrew/versions/node4-lts else - apt-get install wine + sudo apt-get install wine fi From c9d94f99014e7488b49c1e1ba999abcb2eb81d63 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:41:55 -0500 Subject: [PATCH 19/39] Travis: apt-get update Signed-off-by: Jeffrey Morgan --- ci/install | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/install b/ci/install index b1598e70d7..fa3b6f9551 100755 --- a/ci/install +++ b/ci/install @@ -5,5 +5,6 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update brew install homebrew/versions/node4-lts else + sudo apt-get update sudo apt-get install wine fi From 99c43f8dfb6dcd6a7956fb956f0d8ee6a728b3c4 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 16:45:38 -0500 Subject: [PATCH 20/39] Travis: build only on mac Signed-off-by: Jeffrey Morgan --- .travis.yml | 23 +++++++---------------- ci/release | 17 ++++++++--------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 240b51fd95..a68ee30de5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,15 @@ -cache: - directories: - - node_modules - install: - - ./ci/install + - brew unlink node + - brew update + - brew install homebrew/versions/node4-lts script: - npm install - npm test - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' + +after_script: - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' -matrix: - include: - - os: linux - services: - - docker - language: node_js - node_js: - - "4.1" - - os: osx - language: generic - +os: + - osx diff --git a/ci/release b/ci/release index 71d763e80f..f14ca6fb3a 100755 --- a/ci/release +++ b/ci/release @@ -1,12 +1,11 @@ #!/bin/bash -if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex - security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain - security default-keychain -s keychain.keychain - security list-keychains - npm run release-mac -else - echo "Skipped for now" -fi +echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex +security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain +security default-keychain -s keychain.keychain +security list-keychains + +# TODO: speed this up, it takes ~30 minutes +# brew install wine +npm run release-mac From ecd6b4bf17f998b304871455ee0a9059d6ddb6c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 24 Nov 2015 20:16:52 -0500 Subject: [PATCH 21/39] Delete .jshintrc --- .jshintrc | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 9240a3ae9f..0000000000 --- a/.jshintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "curly": true, - "noempty": true, - "newcap": true, - "eqeqeq": true, - "eqnull": true, - "esnext": true, - "undef": true, - "unused": true, - "devel": true, - "node": true, - "browser": true, - "evil": false, - "latedef": true, - "nonew": true, - "trailing": true, - "immed": true, - "smarttabs": true, - "strict": false, - "quotmark": false, - "nonbsp": true, - "noempty": true, - "camelcase": false, - "jasmine": true, - "globals": { - "define": true, - "jest": true, - "pit": true - }, - "predef": [ "-Promise" ] -} From 0fed4fd0e59e854a299b6e2f53bd5383a36ce32a Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 25 Nov 2015 11:14:08 +1000 Subject: [PATCH 22/39] Docs validation checker fixes Signed-off-by: Sven Dowideit --- docs/minecraft-server.md | 2 +- docs/nginx-web-server.md | 2 +- docs/rethinkdb-dev-database.md | 2 +- docs/userguide.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/minecraft-server.md b/docs/minecraft-server.md index 4456e0993f..2c4d089bae 100755 --- a/docs/minecraft-server.md +++ b/docs/minecraft-server.md @@ -17,7 +17,7 @@ using Kitematic and Docker. ### Create Minecraft Server Container First, if you haven't yet done so, [download and start -Kitematic](/). Once installed and running, the app should look like this: +Kitematic](index.md). Once installed and running, the app should look like this: Create a container from the recommended Minecraft image by clicking the "Create" button. diff --git a/docs/nginx-web-server.md b/docs/nginx-web-server.md index dd9e6599a9..7121c4fd6f 100755 --- a/docs/nginx-web-server.md +++ b/docs/nginx-web-server.md @@ -25,7 +25,7 @@ Let's get to it! #### Running the Nginx Web Server Container First, if you haven't yet done so, [download and start -Kitematic](/). Once installed and running, the app should look like this: +Kitematic](index.md). Once installed and running, the app should look like this: ![Nginx create](images/nginx-create.png) diff --git a/docs/rethinkdb-dev-database.md b/docs/rethinkdb-dev-database.md index c5546274cb..620cb8f189 100755 --- a/docs/rethinkdb-dev-database.md +++ b/docs/rethinkdb-dev-database.md @@ -19,7 +19,7 @@ In this tutorial, you will: ### Setting up RethinkDB in Kitematic First, if you haven't yet done so, [download and start -Kitematic](/). Once open, the app should look like +Kitematic](index.md). Once open, the app should look like this: ![Rethink create button](images/rethink-create.png) diff --git a/docs/userguide.md b/docs/userguide.md index 698b9f8bf3..4943e45562 100755 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -30,7 +30,7 @@ stream logs, and single click terminal into your Docker container all from the GUI. First, if you haven't yet done so, [download and start -Kitematic](/). +Kitematic](index.md). ## Container list From 604ed015dc08e007eab14fbfa3cfb20f0688c8b3 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 17:06:44 -0500 Subject: [PATCH 23/39] CI: Remove unused install Signed-off-by: Jeffrey Morgan --- ci/install | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100755 ci/install diff --git a/ci/install b/ci/install deleted file mode 100755 index fa3b6f9551..0000000000 --- a/ci/install +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew unlink node - brew update - brew install homebrew/versions/node4-lts -else - sudo apt-get update - sudo apt-get install wine -fi From 8975f8e61be56b92155791d4619fb807edcc283b Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 17:08:08 -0500 Subject: [PATCH 24/39] CI: only use travis for tests Signed-off-by: Jeffrey Morgan --- .travis.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index a68ee30de5..8228cfe757 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,8 @@ -install: - - brew unlink node - - brew update - - brew install homebrew/versions/node4-lts +language: node_js +node_js: + - "4.1" script: - npm install - npm test - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run integration || false' -after_script: - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./ci/release || false' - -os: - - osx From b43fc78a6399c587ee7ae62f26b793daeb024945 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 17:26:03 -0500 Subject: [PATCH 25/39] CI: Fix circleci Signed-off-by: Jeffrey Morgan --- circle.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000000..ceaa3ca553 --- /dev/null +++ b/circle.yml @@ -0,0 +1,6 @@ +machine: + xcode: + version: "7.0" + +cache_directories: + - node_modules From 4b888a2d87cc04718ad72a47cb8c4138734a0e4e Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 17:28:42 -0500 Subject: [PATCH 26/39] CI: Travis sudo: false Signed-off-by: Jeffrey Morgan --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8228cfe757..a416947675 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: false + language: node_js node_js: - "4.1" From 332cf7374717948ad4435d35c1707d93f51d332e Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 17:43:50 -0500 Subject: [PATCH 27/39] Travis: cache Signed-off-by: Jeffrey Morgan --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index a416947675..49d2dc07ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ language: node_js node_js: - "4.1" +cache: + directories: + - node_modules + script: - npm install - npm test From 15b2891a036fe8f0e0b5f2f313bfb48fbf6a9230 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 18:07:48 -0500 Subject: [PATCH 28/39] CI: Remove unused sign script Signed-off-by: Jeffrey Morgan --- ci/release | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100755 ci/release diff --git a/ci/release b/ci/release deleted file mode 100755 index f14ca6fb3a..0000000000 --- a/ci/release +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -echo $MAC_KEY_CONTENT > mac_key_content.hex && xxd -p -r mac_key_content.hex ~/Library/Keychains/keychain.keychain && rm mac_key_content.hex -security unlock-keychain -p "$MAC_KEY_SECRET" ~/Library/Keychains/keychain.keychain -security default-keychain -s keychain.keychain -security list-keychains - -# TODO: speed this up, it takes ~30 minutes -# brew install wine -npm run release-mac - From c5c9fc34bc7f839bc8e333e92728a8c8bd37bcbe Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 18:13:01 -0500 Subject: [PATCH 29/39] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c58342740..a8bdad8554 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/docker/kitematic.svg?branch=master)](https://travis-ci.org/kitematic/kitematic) +[![Build Status](https://travis-ci.org/docker/kitematic.svg?branch=master)](https://travis-ci.org/docker/kitematic) [![Kitematic Logo](https://cloud.githubusercontent.com/assets/251292/5269258/1b229c3c-7a2f-11e4-96f1-e7baf3c86d73.png)](https://kitematic.com) From 65cea9e82a0238cd57021ba82a9583d16f0ed8be Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 18:23:19 -0500 Subject: [PATCH 30/39] CI: proper circle cache syntax Signed-off-by: Jeffrey Morgan --- circle.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index ceaa3ca553..ea6f753291 100644 --- a/circle.yml +++ b/circle.yml @@ -2,5 +2,6 @@ machine: xcode: version: "7.0" -cache_directories: - - node_modules +dependencies: + cache_directories: + - node_modules From 241b354c662722fbe3e828e9a81bb0732dc908ec Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 18:38:57 -0500 Subject: [PATCH 31/39] CI: cache cellar Signed-off-by: Jeffrey Morgan --- circle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/circle.yml b/circle.yml index ea6f753291..1977fcf45c 100644 --- a/circle.yml +++ b/circle.yml @@ -5,3 +5,4 @@ machine: dependencies: cache_directories: - node_modules + - /usr/local/Cellar From 252049115e6ad64936d2dd867bdc93e01707680f Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 18:45:24 -0500 Subject: [PATCH 32/39] Put zip files in release dir Signed-off-by: Jeffrey Morgan --- .gitignore | 1 + Gruntfile.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7de51eecbc..b2eb68a055 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .swp build dist +release installer node_modules coverage diff --git a/Gruntfile.js b/Gruntfile.js index d4f3e0afa4..dd2362df6a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -195,7 +195,7 @@ module.exports = function (grunt) { ].join(' && '), }, zip: { - command: 'ditto -c -k --sequesterRsrc --keepParent <%= OSX_FILENAME_ESCAPED %> dist/' + BASENAME + '-' + packagejson.version + '-Mac.zip', + command: 'ditto -c -k --sequesterRsrc --keepParent <%= OSX_FILENAME_ESCAPED %> release/' + BASENAME + '-' + packagejson.version + '-Mac.zip', } }, @@ -206,7 +206,7 @@ module.exports = function (grunt) { compress: { windows: { options: { - archive: './dist/' + BASENAME + '-' + packagejson.version + '-Windows-Alpha.zip', + archive: './release/' + BASENAME + '-' + packagejson.version + '-Windows-Alpha.zip', mode: 'zip' }, files: [{ From d8de60d612337cf58899d35e8b596a996b314f17 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 18:52:18 -0500 Subject: [PATCH 33/39] Bump electron to 0.33.9 Signed-off-by: Jeffrey Morgan --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7d057aad29..6bebc3836b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "lint": "jsxhint src" }, "license": "Apache-2.0", - "electron-version": "0.33.6", + "electron-version": "0.33.9", "dependencies": { "alt": "^0.16.2", "ansi-to-html": "0.3.0", @@ -54,7 +54,7 @@ "devDependencies": { "babel": "^5.8.23", "babel-jest": "^5.2.0", - "electron-prebuilt": "^0.33.6", + "electron-prebuilt": "^0.33.9", "eslint": "^1.3.1", "eslint-plugin-react": "^3.3.0", "grunt": "^0.4.5", From ec92514207ef81340504ee457658dbee1aa4db2a Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 19:26:59 -0500 Subject: [PATCH 34/39] CI: add quotes to circle yml Signed-off-by: Jeffrey Morgan --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 1977fcf45c..2343e14ab4 100644 --- a/circle.yml +++ b/circle.yml @@ -4,5 +4,5 @@ machine: dependencies: cache_directories: - - node_modules - - /usr/local/Cellar + - "node_modules" + - "/usr/local/Cellar" From adc1f170f5992e758ad3cb52c6e52d048b431232 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 25 Nov 2015 19:38:57 -0500 Subject: [PATCH 35/39] CI: do not cache homebrew Signed-off-by: Jeffrey Morgan --- circle.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/circle.yml b/circle.yml index 2343e14ab4..90f69e603f 100644 --- a/circle.yml +++ b/circle.yml @@ -5,4 +5,3 @@ machine: dependencies: cache_directories: - "node_modules" - - "/usr/local/Cellar" From 835dc9c0470c5c525e2f439906ae56b29f9d15ed Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Thu, 26 Nov 2015 20:17:43 +1000 Subject: [PATCH 36/39] Use FROM docs/base:latest again Signed-off-by: Sven Dowideit --- docs/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Dockerfile b/docs/Dockerfile index 72cc010377..b42ddbd82d 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,4 +1,4 @@ -FROM docs/base:hugo-github-linking +FROM docs/base:latest MAINTAINER Mary Anthony (@moxiegirl) RUN svn checkout https://github.com/docker/compose/trunk/docs /docs/content/compose @@ -9,7 +9,8 @@ RUN svn checkout https://github.com/docker/tutorials/trunk/docs /docs/content RUN svn checkout https://github.com/docker/opensource/trunk/docs /docs/content/opensource RUN svn checkout https://github.com/docker/machine/trunk/docs /docs/content/machine +ENV PROJECT=kitematic # To get the git info for this repo COPY . /src -COPY . /docs/content/kitematic/ +COPY . /docs/content/$PROJECT/ From d39b8235b96161d6532c2d4226eec9b1b0ca1164 Mon Sep 17 00:00:00 2001 From: French Ben Date: Mon, 23 Nov 2015 15:50:43 -0800 Subject: [PATCH 37/39] Add package option for devTools window on start Signed-off-by: French Ben --- package.json | 1 + src/browser.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/package.json b/package.json index 6bebc3836b..206b329fa2 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "bugs": "https://github.com/kitematic/kitematic/issues", "scripts": { "start": "grunt", + "start-dev": "NODE_ENV=development grunt", "test": "jest -c jest-unit.json", "integration": "jest -c jest-integration.json", "release": "grunt release", diff --git a/src/browser.js b/src/browser.js index 2ad5a38954..cdd788e1e5 100644 --- a/src/browser.js +++ b/src/browser.js @@ -53,6 +53,10 @@ app.on('ready', function () { show: false }); + if (process.env.NODE_ENV === 'development') { + mainWindow.openDevTools({detach: true}); + } + mainWindow.loadUrl(path.normalize('file://' + path.join(__dirname, 'index.html'))); app.on('activate-with-no-open-windows', function () { From 83b2bff85024f28a6ea35ec8a3863cde5e807052 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Mon, 9 Nov 2015 23:16:44 -0800 Subject: [PATCH 38/39] Improved log performance and reliability Signed-off-by: Jeffrey Morgan --- src/actions/ContainerActions.js | 4 + src/actions/ContainerServerActions.js | 4 +- src/components/ContainerHomeLogs.react.js | 80 ++++++------------- src/components/ContainerListItem.react.js | 2 +- src/components/ContainerLogs.react.js | 61 --------------- src/stores/ContainerStore.js | 35 ++++++++- src/stores/LogStore.js | 85 -------------------- src/utils/DockerUtil.js | 94 ++++++++++++++++++++++- styles/container-home.less | 8 +- 9 files changed, 160 insertions(+), 213 deletions(-) delete mode 100644 src/components/ContainerLogs.react.js delete mode 100644 src/stores/LogStore.js diff --git a/src/actions/ContainerActions.js b/src/actions/ContainerActions.js index 2bcbdf8856..a9c2f4a61c 100644 --- a/src/actions/ContainerActions.js +++ b/src/actions/ContainerActions.js @@ -38,6 +38,10 @@ class ContainerActions { run (name, repo, tag) { dockerUtil.run(name, repo, tag); } + + active (name) { + dockerUtil.active(name); + } } export default alt.createActions(ContainerActions); diff --git a/src/actions/ContainerServerActions.js b/src/actions/ContainerServerActions.js index 7308349f11..59acb37c83 100644 --- a/src/actions/ContainerServerActions.js +++ b/src/actions/ContainerServerActions.js @@ -15,7 +15,9 @@ class ContainerServerActions { 'updated', 'waiting', 'kill', - 'stopped' + 'stopped', + 'log', + 'logs' ); } } diff --git a/src/components/ContainerHomeLogs.react.js b/src/components/ContainerHomeLogs.react.js index 0853f98692..bffe4157dc 100644 --- a/src/components/ContainerHomeLogs.react.js +++ b/src/components/ContainerHomeLogs.react.js @@ -1,74 +1,44 @@ import $ from 'jquery'; import React from 'react/addons'; -import LogStore from '../stores/LogStore'; import Router from 'react-router'; -import metrics from '../utils/MetricsUtil'; +import containerActions from '../actions/ContainerActions'; +import Convert from 'ansi-to-html'; -var _prevBottom = 0; +let escape = function (html) { + var text = document.createTextNode(html); + var div = document.createElement('div'); + div.appendChild(text); + return div.innerHTML; +}; + +let convert = new Convert(); +let prevBottom = 0; module.exports = React.createClass({ - mixins: [Router.Navigation], - getInitialState: function () { - return { - logs: [] - }; - }, - componentDidMount: function() { - if (!this.props.container) { - return; - } - this.update(); - this.scrollToBottom(); - LogStore.on(LogStore.SERVER_LOGS_EVENT, this.update); - LogStore.fetch(this.props.container.Name); + + componentDidUpdate: function () { + var node = $('.logs').get()[0]; + node.scrollTop = node.scrollHeight; }, componentWillReceiveProps: function (nextProps) { if (this.props.container && nextProps.container && this.props.container.Name !== nextProps.container.Name) { - LogStore.detach(this.props.container.Name); - LogStore.fetch(nextProps.container.Name); + containerActions.active(nextProps.container.Name); } }, - componentWillUnmount: function() { - if (!this.props.container) { - return; - } + componentDidMount: function () { + containerActions.active(this.props.container.Name); + }, - LogStore.detach(this.props.container.Name); - LogStore.removeListener(LogStore.SERVER_LOGS_EVENT, this.update); - }, - componentDidUpdate: function () { - this.scrollToBottom(); - }, - scrollToBottom: function () { - var parent = $('.logs'); - if (parent[0].scrollHeight - parent.height() >= _prevBottom - 50) { - parent.scrollTop(parent[0].scrollHeight - parent.height()); - } - _prevBottom = parent[0].scrollHeight - parent.height(); - }, - handleClickLogs: function () { - metrics.track('Viewed Logs', { - from: 'preview' - }); - this.context.router.transitionTo('containerLogs', {name: this.props.container.Name}); - }, - update: function () { - if (!this.props.container) { - return; - } - this.setState({ - logs: LogStore.logs(this.props.container.Name) - }); + componentWillUnmount: function () { + containerActions.active(null); }, + render: function () { - var logs = this.state.logs.map(function (l, i) { - return ; - }); - if (logs.length === 0) { - logs = "No logs for this container."; - } + let logs = this.props.container.Logs ? + this.props.container.Logs.map((l) =>
'))}}>
) : + ['0 No logs for this container.']; return (
diff --git a/src/components/ContainerListItem.react.js b/src/components/ContainerListItem.react.js index 589ff6ef3c..76c9d886a0 100644 --- a/src/components/ContainerListItem.react.js +++ b/src/components/ContainerListItem.react.js @@ -96,7 +96,7 @@ var ContainerListItem = React.createClass({ return ( -
  • +
  • {state}
    diff --git a/src/components/ContainerLogs.react.js b/src/components/ContainerLogs.react.js deleted file mode 100644 index 7da5e84129..0000000000 --- a/src/components/ContainerLogs.react.js +++ /dev/null @@ -1,61 +0,0 @@ -import $ from 'jquery'; -import React from 'react/addons'; -import LogStore from '../stores/LogStore'; - -var _prevBottom = 0; - -module.exports = React.createClass({ - getInitialState: function () { - return { - logs: [] - }; - }, - componentDidMount: function() { - if (!this.props.container) { - return; - } - this.update(); - this.scrollToBottom(); - LogStore.on(LogStore.SERVER_LOGS_EVENT, this.update); - LogStore.fetch(this.props.container.Name); - }, - componentWillUnmount: function() { - if (!this.props.container) { - return; - } - - LogStore.detach(this.props.container.Name); - LogStore.removeListener(LogStore.SERVER_LOGS_EVENT, this.update); - }, - componentDidUpdate: function () { - this.scrollToBottom(); - }, - scrollToBottom: function () { - var parent = $('.details-logs'); - if (parent.scrollTop() >= _prevBottom - 50) { - parent.scrollTop(parent[0].scrollHeight - parent.height()); - } - _prevBottom = parent[0].scrollHeight - parent.height(); - }, - update: function () { - if (!this.props.container) { - return; - } - this.setState({ - logs: LogStore.logs(this.props.container.Name) - }); - }, - render: function () { - var logs = this.state.logs.map(function (l, i) { - return ; - }); - if (logs.length === 0) { - logs = "No logs for this container."; - } - return ( -
    - {logs} -
    - ); - } -}); diff --git a/src/stores/ContainerStore.js b/src/stores/ContainerStore.js index 28a6e306dd..46ddfce8a1 100644 --- a/src/stores/ContainerStore.js +++ b/src/stores/ContainerStore.js @@ -3,6 +3,8 @@ import alt from '../alt'; import containerServerActions from '../actions/ContainerServerActions'; import containerActions from '../actions/ContainerActions'; +let MAX_LOG_SIZE = 3000; + class ContainerStore { constructor () { this.bindActions(containerActions); @@ -102,10 +104,8 @@ class ContainerStore { if (containers[container.Name] && containers[container.Name].State.Updating) { return; } - // Trigger log update - // TODO: fix this loading multiple times - // LogStore.fetch(container.Name); + container.Logs = containers[container.Name].Logs; containers[container.Name] = container; this.setState({containers}); @@ -141,7 +141,7 @@ class ContainerStore { } } - waiting({name, waiting}) { + waiting ({name, waiting}) { let containers = this.containers; if (containers[name]) { containers[name].State.Waiting = waiting; @@ -158,6 +158,33 @@ class ContainerStore { this.setState({pending: null}); } + log ({name, entry}) { + let container = this.containers[name]; + if (!container) { + return; + } + + if (!container.Logs) { + container.Logs = []; + } + + container.Logs.push.apply(container.Logs, entry.split('\n').filter(e => e.length)); + container.Logs = container.Logs.slice(container.Logs.length - MAX_LOG_SIZE, MAX_LOG_SIZE); + this.emitChange(); + } + + logs ({name, logs}) { + let container = this.containers[name]; + + if (!container) { + return; + } + + container.Logs = logs.split('\n'); + container.Logs = container.Logs.slice(container.Logs.length - MAX_LOG_SIZE, MAX_LOG_SIZE); + this.emitChange(); + } + static generateName (repo) { const base = _.last(repo.split('/')); const names = _.keys(this.getState().containers); diff --git a/src/stores/LogStore.js b/src/stores/LogStore.js deleted file mode 100644 index 89ed09cebd..0000000000 --- a/src/stores/LogStore.js +++ /dev/null @@ -1,85 +0,0 @@ -import {EventEmitter} from 'events'; -import assign from 'object-assign'; -import Convert from 'ansi-to-html'; -import docker from '../utils/DockerUtil'; -import stream from 'stream'; - -var _convert = new Convert(); -var _logs = {}; -var _streams = {}; - -var MAX_LOG_SIZE = 3000; - -module.exports = assign(Object.create(EventEmitter.prototype), { - SERVER_LOGS_EVENT: 'server_logs_event', - _escape: function (html) { - var text = document.createTextNode(html); - var div = document.createElement('div'); - div.appendChild(text); - return div.innerHTML; - }, - fetch: function (name) { - if (!name || !docker.client) { - return; - } - docker.client.getContainer(name).logs({ - stdout: true, - stderr: true, - timestamps: false, - tail: MAX_LOG_SIZE, - follow: false - }, (err, logStream) => { - if (err) { - return; - } - var logs = []; - var outstream = new stream.PassThrough(); - docker.client.modem.demuxStream(logStream, outstream, outstream); - outstream.on('data', (chunk) => { - logs.push(_convert.toHtml(this._escape(chunk))); - }); - logStream.on('end', () => { - _logs[name] = logs; - this.emit(this.SERVER_LOGS_EVENT); - this.attach(name); - }); - }); - }, - attach: function (name) { - if (!name || !docker.client || _streams[name]) { - return; - } - docker.client.getContainer(name).attach({ - stdout: true, - stderr: true, - logs: false, - stream: true - }, (err, logStream) => { - if (err) { - return; - } - _streams[name] = logStream; - var outstream = new stream.PassThrough(); - docker.client.modem.demuxStream(logStream, outstream, outstream); - outstream.on('data', (chunk) => { - _logs[name].push(_convert.toHtml(this._escape(chunk))); - if (_logs[name].length > MAX_LOG_SIZE) { - _logs[name] = _logs[name].slice(_logs[name].length - MAX_LOG_SIZE, MAX_LOG_SIZE); - } - this.emit(this.SERVER_LOGS_EVENT); - }); - logStream.on('end', () => { - this.detach(name); - }); - }); - }, - detach: function (name) { - if (_streams[name]) { - _streams[name].destroy(); - delete _streams[name]; - } - }, - logs: function (name) { - return _logs[name] || []; - } -}); diff --git a/src/utils/DockerUtil.js b/src/utils/DockerUtil.js index 7091482feb..c3f1c5f76d 100644 --- a/src/utils/DockerUtil.js +++ b/src/utils/DockerUtil.js @@ -7,13 +7,15 @@ import util from './Util'; import hubUtil from './HubUtil'; import metrics from '../utils/MetricsUtil'; import containerServerActions from '../actions/ContainerServerActions'; -import Promise from 'bluebird'; import rimraf from 'rimraf'; +import stream from 'stream'; export default { host: null, client: null, placeholders: {}, + streams: {}, + activeContainerName: null, setup (ip, name) { if (!ip || !name) { @@ -343,6 +345,85 @@ export default { }); }, + active (name) { + this.detach(); + this.activeContainerName = name; + + if (name) { + this.logs(); + } + }, + + logs () { + if (!this.activeContainerName) { + return; + } + + this.client.getContainer(this.activeContainerName).logs({ + stdout: true, + stderr: true, + tail: 1000, + follow: false, + timestamps: 1 + }, (err, logStream) => { + if (err) { + return; + } + + let logs = ''; + logStream.setEncoding('utf8'); + logStream.on('data', chunk => logs += chunk); + logStream.on('end', () => { + containerServerActions.logs({name: this.activeContainerName, logs}); + this.attach(); + }); + }); + }, + + attach () { + if (!this.activeContainerName) { + return; + } + + this.client.getContainer(this.activeContainerName).logs({ + stdout: true, + stderr: true, + tail: 0, + follow: true, + timestamps: 1 + }, (err, logStream) => { + if (err) { + return; + } + + if (this.stream) { + this.detach(); + } + this.stream = logStream; + + let timeout = null; + let batch = ''; + logStream.setEncoding('utf8'); + logStream.on('data', (chunk) => { + batch += chunk; + if (!timeout) { + timeout = setTimeout(() => { + containerServerActions.log({name: this.activeContainerName, entry: batch}); + timeout = null; + batch = ''; + }, 16); + } + }); + }); + }, + + detach () { + if (this.stream) { + this.stream.destroy(); + this.stream = null; + } + }, + listen () { this.client.getEvents((error, stream) => { if (error || !stream) { @@ -354,16 +435,25 @@ export default { stream.on('data', json => { let data = JSON.parse(json); - if (data.status === 'pull' || data.status === 'untag' || data.status === 'delete' || data.status === 'attach') { + if (data.status === 'pull' || data.status === 'untag' || data.status === 'delete' || data.status === 'attach') { return; } if (data.status === 'destroy') { containerServerActions.destroyed({id: data.id}); + this.detach(data.id); } else if (data.status === 'kill') { containerServerActions.kill({id: data.id}); + this.detach(data.id); } else if (data.status === 'stop') { containerServerActions.stopped({id: data.id}); + this.detach(data.id); + } else if (data.status === 'create') { + this.logs(); + this.fetchContainer(data.id); + } else if (data.status === 'start') { + this.attach(); + this.fetchContainer(data.id); } else if (data.id) { this.fetchContainer(data.id); } diff --git a/styles/container-home.less b/styles/container-home.less index b8dbc3f20b..91433584f8 100644 --- a/styles/container-home.less +++ b/styles/container-home.less @@ -7,14 +7,15 @@ flex-direction: row; padding: 1rem; .left { - width: 100%; + display: flex; + flex: 0.9 1 0; flex-direction: column; margin-right: 1rem; } .right { + display: flex; + flex: 0.1 0 300px; width: 40%; - min-width: 200px; - max-width: 600px; flex-direction: column; } .full { @@ -103,7 +104,6 @@ color: @gray-lightest; font-family: @font-code; font-size: 10px; - white-space: pre-wrap; -webkit-user-select: text; padding: 1.2rem 1.2rem 5rem 1.2rem; overflow: auto; From 0dd51c775ef798251f4fced569fe9dba903e13f9 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Mon, 30 Nov 2015 14:29:43 -0800 Subject: [PATCH 39/39] CI: Release on tags Signed-off-by: Jeffrey Morgan --- circle.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/circle.yml b/circle.yml index 90f69e603f..d06a79e23c 100644 --- a/circle.yml +++ b/circle.yml @@ -5,3 +5,10 @@ machine: dependencies: cache_directories: - "node_modules" + +deployment: + release: + tag: /v.*/ + owner: docker + commands: + - echo $CIRCLE_BRANCH