From 6c096b44c1c9635441e5b848993fef94eab87bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 27 Nov 2015 13:32:00 +0800 Subject: [PATCH 01/17] add lib/incoming.js for gitlab --- lib/incoming.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/incoming.js b/lib/incoming.js index 9bdb58f..5e3c94c 100644 --- a/lib/incoming.js +++ b/lib/incoming.js @@ -6,6 +6,7 @@ var exec = require('child_process').exec; exports.control = function(options) { return function incoming(req, res, next) { + console.log(req.body); webdep.clearLog(); webdep.log("Incoming " + (new Date()).toString()); @@ -14,8 +15,17 @@ exports.control = function(options) { var error = false; var repoData = {}; + var repoDataStr = req.body.payload; + if(!repoDataStr) { + for(var i in req.body) { + if(req.body.hasOwnProperty(i)) { + repoDataStr = i; + break; + } + } + } try { - repoData = JSON.parse(req.body.payload); + repoData = JSON.parse(repoDataStr); } catch (err) { repoData = { error: err }; @@ -24,7 +34,7 @@ exports.control = function(options) { deploysList.forEach(function(deploy) { - if (deploy.type == "github") { + if (deploy.type == "github" || deploy.type == "gitlab") { if (!repoData.error && !repoData.repository) { webdep.log("Webhook payload was not for a push."); @@ -84,7 +94,7 @@ exports.control = function(options) { - } + }; }; From 378cf3972729cdad0e3810a9a0e8680955165d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 27 Nov 2015 13:47:11 +0800 Subject: [PATCH 02/17] remove console --- lib/incoming.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/incoming.js b/lib/incoming.js index 5e3c94c..f42aeec 100644 --- a/lib/incoming.js +++ b/lib/incoming.js @@ -6,7 +6,6 @@ var exec = require('child_process').exec; exports.control = function(options) { return function incoming(req, res, next) { - console.log(req.body); webdep.clearLog(); webdep.log("Incoming " + (new Date()).toString()); From e99409a6ce2131503fc237adfa7de65b18d6d3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 16:34:38 +0800 Subject: [PATCH 03/17] =?UTF-8?q?incoming=20=E4=BD=BF=E7=94=A8=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=96=B9=E5=BC=8F=E5=A4=84=E7=90=86=20github=20gitlab?= =?UTF-8?q?=20=E7=9A=84=20hook=E3=80=82=E5=B9=B6=E4=B8=94=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=83=A8=E5=88=86=E7=9A=84=20log=20=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/incoming.js | 77 +++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 54 deletions(-) diff --git a/lib/incoming.js b/lib/incoming.js index f42aeec..2fadf1b 100644 --- a/lib/incoming.js +++ b/lib/incoming.js @@ -4,17 +4,16 @@ var path = require("path"); var exec = require('child_process').exec; exports.control = function(options) { - + webdep.clearLog(); return function incoming(req, res, next) { - - webdep.clearLog(); + webdep.log(req, res, next); webdep.log("Incoming " + (new Date()).toString()); - var deploysList = webdep.getDeployList(); var error = false; - var repoData = {}; + // github type. var repoDataStr = req.body.payload; + // gitlab type if(!repoDataStr) { for(var i in req.body) { if(req.body.hasOwnProperty(i)) { @@ -23,6 +22,7 @@ exports.control = function(options) { } } } + // parse the post body data. try { repoData = JSON.parse(repoDataStr); } @@ -31,68 +31,39 @@ exports.control = function(options) { error = true; } - deploysList.forEach(function(deploy) { - - if (deploy.type == "github" || deploy.type == "gitlab") { - - if (!repoData.error && !repoData.repository) { - webdep.log("Webhook payload was not for a push."); - return; - } - - if (!repoData.error) { - webdep.log("Checking incoming repo " + repoData.repository.url + "..."); + if (!repoData.error && !repoData.repository) { + webdep.log("Webhook payload was not for a push."); + } + if (repoData.error) { + webdep.log(""); + webdep.log("Error while parsing post body"); + } else { + webdep.log('Webhook from', repoData.repository.homepage, '(', repoData.repository.description, ').', 'Checking this incoming repo.'); + deploysList.forEach(function(deploy) { + var branch; + if (["github", "gitlab"].indexOf(deploy.type) > -1) { // remove .git from the repo string, since the hook will not have that address when it comes from github // so instead of explaining that you shouldnt enter ".git", we just remove it here. if (repoData.repository.url == deploy.repo.replace(".git$", "")) { - - var branch = repoData.ref.split("/").pop(); - - webdep.log("> Checking branch '" + branch + "' ..."); - + branch = repoData.ref.split("/").pop(); if (branch == deploy.branch) { - + webdep.log("Match branch", branch, ', begin deploy.'); runDeploy(deploy); - } - else { - webdep.log("> No, wrong branch, nothing to do"); - webdep.log("> Got:"); - webdep.log("> " + branch); - webdep.log("> But expected:"); - webdep.log("> " + deploy.branch); - } - } - else { - webdep.log("No, wrong repo, nothing to do"); - webdep.log("Got:"); - webdep.log(repoData.repository.url); - webdep.log("But expected:"); - webdep.log(deploy.repo.replace(".git", "")); } - - } - else { - webdep.log(""); - webdep.log("Error while parsing post body"); } - } - }); + }); + } if (error) { res.statusCode = 500; res.write("ERROR"); - } - else { + } else { res.write("OK"); } next(); - - - - }; }; @@ -100,7 +71,7 @@ exports.control = function(options) { function runDeploy(deploy) { - webdep.log("> Run " + deploy.name + " with branch " + deploy.branch); + webdep.log("> Begin run " + deploy.name + " with branch " + deploy.branch); var localPath = path.resolve(deploy.basepath); @@ -114,10 +85,9 @@ function runDeploy(deploy) { webdep.log("> ERROR (error): " + error); } webdep.log("--------------------------"); - webdep.log("> DONE!"); + webdep.log("> Deploy done!"); }); - webdep.log("--------------------------"); cmd.stdout.on('data', function(data) { webdep.log(data.toString()); @@ -137,7 +107,6 @@ function runDeploy(deploy) { cmd.stderr.on('data', function(data) { webdep.log(data.toString()); }); - } exports.runDeploy = runDeploy; From e0dfc27db41e88881ff850cbb0332c80c42e1bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:04:48 +0800 Subject: [PATCH 04/17] =?UTF-8?q?ui=20=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 3 +-- public/css/style.css | 2 +- public/css/style.styl | 1 + public/js/main.js | 8 +++++--- public/views/index.html | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index b5c3fed..a3f8f0e 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,6 @@ var webdep = require("./lib/webdep.js"); var runningScript = process.argv.length > 1 ? process.argv[1] : ""; if (runningScript == __filename) { webdep.init(); -} -else { +} else { module.exports = webdep; } diff --git a/public/css/style.css b/public/css/style.css index 0e04e18..150c2f7 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -5,5 +5,5 @@ body{font-family:arial,helvetica;font-size:14px;color:#333;background-color:#fff table{margin-top:30px;float:left;width:100%;border-collapse:collapse;} table th{text-align:left;font-weight:normal;color:#aaa;border:1px solid #eee;font-style:italic;padding:5px 20px 5px 5px} table td{padding:5px 20px 5px 5px;border:1px solid #eee} -.log-container{height:100%;padding:30px;float:left;width:50%;box-sizing:border-box;background-color:#000;color:#0f0;} +.log-container{height:100%;overflow:auto;padding:30px;float:left;width:50%;box-sizing:border-box;background-color:#000;color:#0f0;} .log-container h2{margin:0;padding:0;opacity:.5} diff --git a/public/css/style.styl b/public/css/style.styl index 54a7932..2599672 100644 --- a/public/css/style.styl +++ b/public/css/style.styl @@ -82,6 +82,7 @@ table .log-container height 100% + overflow auto padding 30px float left width 60% diff --git a/public/js/main.js b/public/js/main.js index b25974f..a46dcee 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -4,7 +4,8 @@ socket.on("log", function(e) { var logDom = document.getElementById("log"); - logDom.innerHTML = e.log; + logDom.innerHTML = logDom.innerHTML + '
' + e.log; + document.getElementById("log-container").scrollTop = logDom.offsetHeight; }); socket.on("deploys", function(e) { @@ -15,6 +16,7 @@ var buttons = document.querySelectorAll(".deploys-box button"); for(var i = 0, ii = buttons.length; i < ii; i++) { var button = buttons[i]; + /*jshint -W083*/ button.addEventListener("click", function() { var id = this.parentNode.parentNode.getAttribute("data-id"); console.log("TJENA", id); @@ -24,7 +26,6 @@ }); socket.on("not-logged-in", function(e) { - var logDom = document.getElementById("log"); logDom.innerHTML = "Please login!"; var logContainer = document.querySelector(".login-box"); @@ -33,11 +34,12 @@ document.querySelector(".deploys-box").style.display = "none"; document.querySelector(".login-box .error").style.display = "none"; - document.querySelector(".login-box button").addEventListener("click", function() { + document.querySelector("form.login-box").addEventListener("submit", function(evt) { document.getElementById("log").innerHTML = "Trying to log in..."; var username = document.querySelector(".login-box #username").value; var password = document.querySelector(".login-box #password").value; socket.emit("login", {username: username, password: password}); + evt.preventDefault(); }, false); }); diff --git a/public/views/index.html b/public/views/index.html index 5965060..dd023d4 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -14,7 +14,7 @@

Webhook Deployer v{{version}}

Your auto-deploy companion

- +
@@ -47,7 +47,7 @@

Webhook Deployer v{{version}}

-
+

Log:

{{log}}
From e937b9833d86dfceabf2e0fcd63e9fd8044e57ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:05:21 +0800 Subject: [PATCH 05/17] jshint --- lib/webdep.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/webdep.js b/lib/webdep.js index 63bfdd8..b6706a3 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -10,7 +10,8 @@ var http = require("http"); var fs = require("fs"); var path = require("path"); var querystring = require("querystring"); -var log = logStartText = "The log is empty."; +var logStartText = "The log is empty."; +var log = logStartText; var Keygrip = require('keygrip'); var Cookies = require('cookies'); var SessionStore = require('./sessionstore'); @@ -36,16 +37,16 @@ exports.init = function(newOptions, callback) { // Handle arguments if (typeof newOptions == "function") { callback = newOptions; - delete newOptions; + newOptions = {}; } - + var key; // Merge options - for(var key in defaultOptions) { + for(key in defaultOptions) { options[key] = defaultOptions[key]; } - for(var key in newOptions) { + for(key in newOptions) { options[key] = newOptions[key]; } @@ -100,7 +101,7 @@ exports.init = function(newOptions, callback) { // extend to have a render function res.render = function(template, data, status) { require("./render")(res, template, data, status); - } + }; // Handle requests var data = ""; @@ -130,12 +131,13 @@ exports.init = function(newOptions, callback) { if (match) { foundRoute = true; req.params.urlData = match && match.length > 0 ? match[1] : null; + /*jshint -W083*/ route.action(req, res, function() { res.end(); }); break; } - }; + } if (!foundRoute) { res.statusCode = 404; @@ -218,8 +220,6 @@ exports.init = function(newOptions, callback) { } - - // Start server server.listen(options.port, function(err) { if (!err) { @@ -245,7 +245,7 @@ exports.init = function(newOptions, callback) { } }); -} +}; exports.stop = function(callback) { server.close(); @@ -258,7 +258,7 @@ exports.clearLog = function() { exports.log = function(){ - if (arguments.length == 0) { + if (arguments.length === 0) { return log; } @@ -320,7 +320,7 @@ function cookieSessions(name) { res.cookie(name, req.session, { signed: true }); }); next(); - } + }; } function getDeployFromId(id) { @@ -372,7 +372,7 @@ exports.getDeployList = getDeployList = function() { return deploysList; -} +}; // randomString returns a pseude-random ASCII string which contains at least the specified number of bits of entropy From 92033274b369e1c8fe3291c2e6d07c1eb12c1555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:20:51 +0800 Subject: [PATCH 06/17] broadcast message to all client. --- lib/webdep.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/webdep.js b/lib/webdep.js index b6706a3..465bc0f 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -275,6 +275,8 @@ exports.log = function(){ } log += message + "\n"; + // broadcast message to all client. + io.sockets.emit('log', {cache: false, log: log}); // only send the login to those that are authenticated /*if (io) { var clients = io.sockets.clients(); From 05c9c4c4594b3d3365ee9300dfd182322abc189d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:21:07 +0800 Subject: [PATCH 07/17] selenium-standalone version for test. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8616ae6..f89be3b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "grunt-cli": "~0.1.8", "webdriverjs": "~0.7.3", "webdriverio": "^2.2.3", - "selenium-standalone": "^2.43.1-5" + "selenium-standalone": "2.43.1-5" }, "dependencies": { "commander": "~1.1.1", From 6c5e0ee0df700a2dd11ea640ff495b75497f2752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:22:51 +0800 Subject: [PATCH 08/17] ~ --- lib/incoming.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/incoming.js b/lib/incoming.js index 2fadf1b..9db4fe5 100644 --- a/lib/incoming.js +++ b/lib/incoming.js @@ -6,7 +6,6 @@ var exec = require('child_process').exec; exports.control = function(options) { webdep.clearLog(); return function incoming(req, res, next) { - webdep.log(req, res, next); webdep.log("Incoming " + (new Date()).toString()); var deploysList = webdep.getDeployList(); var error = false; From 08b876c4900e3f317a109dbcdf398e36649f37ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:36:26 +0800 Subject: [PATCH 09/17] ~ --- lib/webdep.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/webdep.js b/lib/webdep.js index 465bc0f..4193818 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -182,14 +182,10 @@ exports.init = function(newOptions, callback) { // Handler login socket.on("login", function(e) { - - if (e.username == options.username && e.password == options.password) { - // create the session when the user has logged in socket.request.session.authenticated = true; sendLoginInfo(socket); - } else { socket.request.session.authenticated = false; socket.emit("login-error"); @@ -257,24 +253,19 @@ exports.clearLog = function() { }; exports.log = function(){ - if (arguments.length === 0) { return log; } - if (log == logStartText) { log = ""; } - var message = util.format.apply(this, arguments); - if (process.stdout.destroyed !== false || process.stdout.isTTY) { if (options.logToConsole !== false) { console.log(message); } } log += message + "\n"; - // broadcast message to all client. io.sockets.emit('log', {cache: false, log: log}); // only send the login to those that are authenticated From 84f9ff767f8e4e164b6473ae7104044dbd90d21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:48:50 +0800 Subject: [PATCH 10/17] broadcast message to all client which is authenticated. --- lib/webdep.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/webdep.js b/lib/webdep.js index 4193818..840e161 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -266,8 +266,12 @@ exports.log = function(){ } } log += message + "\n"; - // broadcast message to all client. - io.sockets.emit('log', {cache: false, log: log}); + // broadcast message to all client which is authenticated. + io.sockets.sockets.forEach(function(socket) { + if (socket.request.session && socket.request.session.authenticated === true) { + socket.emit("log", {sessionId: socket.id, cache: false, log: log}); + } + }); // only send the login to those that are authenticated /*if (io) { var clients = io.sockets.clients(); From e78934dbd676b86d9139ae141faafb97e5d2a226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:49:07 +0800 Subject: [PATCH 11/17] ~ --- lib/webdep.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/webdep.js b/lib/webdep.js index 840e161..38d5658 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -272,15 +272,6 @@ exports.log = function(){ socket.emit("log", {sessionId: socket.id, cache: false, log: log}); } }); - // only send the login to those that are authenticated - /*if (io) { - var clients = io.sockets.clients(); - clients.forEach(function(socket) { - if (socket.handshake.session.authenticated === true) { - socket.send("log", {sessionId: socket.id, cache: false, log: log}); - } - }); - }*/ return exports; From c41c7acb7c2e6adc3e2cea3858ac3a0bf4abd3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Tue, 1 Dec 2015 18:51:42 +0800 Subject: [PATCH 12/17] 0.7.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、add gitlab. 2、add auto emit log to socket for html to show log. 3、fix test bug. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f89be3b..584be51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webhook-deployer", - "version": "0.7.7", + "version": "0.7.8", "description": "Deployer server app triggered by (github) webhooks", "main": "index.js", "scripts": { From 069a4004f458c2b8028f65b811b9b1841651eb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 4 Dec 2015 11:53:39 +0800 Subject: [PATCH 13/17] deploy by id. --- lib/webdep.js | 6 +++--- public/css/style.styl | 3 +++ public/js/main.js | 2 +- public/views/index.html | 12 ++++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/webdep.js b/lib/webdep.js index 38d5658..2d1176d 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -284,7 +284,7 @@ function sendLoginInfo(socket) { var deploysList = getDeployList(); var deploys = []; - deploysList.forEach(function(deploy) { + deploysList.forEach(function(deploy, index) { var repoUrlDetails = deploy.repo.split("/"); var repoName = repoUrlDetails.pop(); var userName = repoUrlDetails.pop(); @@ -352,9 +352,9 @@ exports.getDeployList = getDeployList = function() { } - deploysList.forEach(function(item) { + deploysList.forEach(function(item, index) { if (!item.id) { - item.id = item.repo.replace(/[\/:]/g, '').toLowerCase(); + item.id = index; } }); diff --git a/public/css/style.styl b/public/css/style.styl index 2599672..78c73cf 100644 --- a/public/css/style.styl +++ b/public/css/style.styl @@ -33,6 +33,9 @@ body .deploys-box display none + width 100% + overflow scroll + border 1px solid #eee .login-box display none diff --git a/public/js/main.js b/public/js/main.js index a46dcee..e873a54 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -1,6 +1,7 @@ (function() { var socket = io(); + var template = '{{#deploys}} {{deploy.name}} {{deploy.command}} {{deploy.repo}} {{deploy.branch}} {{/deploys}}'; socket.on("log", function(e) { var logDom = document.getElementById("log"); @@ -9,7 +10,6 @@ }); socket.on("deploys", function(e) { - var template = "{{#deploys}}{{deploy.repo}}{{deploy.branch}}{{/deploys}}"; var html = Mustache.to_html(template, e); document.querySelector(".deploys-box tbody").innerHTML = html; diff --git a/public/views/index.html b/public/views/index.html index dd023d4..cfa7694 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -31,14 +31,18 @@

Webhook Deployer v{{version}}

- repo - branch + Name + Commane + Repo + Branch {{#deploys}} - - + + + {{deploy.name}} + {{deploy.command}} {{deploy.repo}} {{deploy.branch}} From 316123314334671fb7cbd7df09d405721fc077a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 4 Dec 2015 11:56:08 +0800 Subject: [PATCH 14/17] 0.7.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 584be51..1703dd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webhook-deployer", - "version": "0.7.8", + "version": "0.7.9", "description": "Deployer server app triggered by (github) webhooks", "main": "index.js", "scripts": { From 7538b1cffb63d0d01f9208cc8fac39d00a0a2ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 4 Dec 2015 12:20:01 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E9=95=BF=E5=BA=A6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/js/main.js b/public/js/main.js index e873a54..4e3c392 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -5,7 +5,11 @@ socket.on("log", function(e) { var logDom = document.getElementById("log"); - logDom.innerHTML = logDom.innerHTML + '
' + e.log; + var innerHTML = logDom.innerHTML + '
' + e.log; + if(innerHTML.length > 30000) { + innerHTML = innerHTML.substr(innerHTML.length - 30000); + } + logDom.innerHTML = innerHTML; document.getElementById("log-container").scrollTop = logDom.offsetHeight; }); From 15d5b39b229554f19cf721de384443f3e903698b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 4 Dec 2015 12:20:14 +0800 Subject: [PATCH 16/17] 0.7.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1703dd8..fbaa009 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webhook-deployer", - "version": "0.7.9", + "version": "0.7.10", "description": "Deployer server app triggered by (github) webhooks", "main": "index.js", "scripts": { From aee064c30e786f5adf7d6e3efaf324967d125f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E5=A5=87=E8=BE=89?= Date: Fri, 4 Dec 2015 14:32:35 +0800 Subject: [PATCH 17/17] auto id. --- lib/webdep.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/webdep.js b/lib/webdep.js index 2d1176d..5b51bc2 100644 --- a/lib/webdep.js +++ b/lib/webdep.js @@ -354,7 +354,7 @@ exports.getDeployList = getDeployList = function() { deploysList.forEach(function(item, index) { if (!item.id) { - item.id = index; + item.id = '_auto_prefix_index_id_' + index; } }); diff --git a/package.json b/package.json index fbaa009..7254297 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webhook-deployer", - "version": "0.7.10", + "version": "0.7.11", "description": "Deployer server app triggered by (github) webhooks", "main": "index.js", "scripts": {