From d46c17d46ae3a511c5a22a12b87a3c41e408401d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Dec 2012 10:25:33 -0500 Subject: [PATCH] added shell directory with shell files --- config.json | 39 ++++++++++++++---------------- lib/client/editor/_codemirror.js | 2 +- lib/client/storage/_dropbox.js | 12 +++++---- lib/server/rest.js | 24 +++++++++++++----- shell/c9kill.sh | 12 +++++++++ cloudcmd.bat => shell/cloudcmd.bat | 2 +- shell/deploy.sh | 10 ++++++++ install-dev => shell/install-dev | 0 shell/kill.js | 17 +++++++++++++ shell/secret.bat | 13 ++++++++++ shell/secret.sh | 13 ++++++++++ 11 files changed, 110 insertions(+), 34 deletions(-) create mode 100755 shell/c9kill.sh rename cloudcmd.bat => shell/cloudcmd.bat (91%) create mode 100755 shell/deploy.sh rename install-dev => shell/install-dev (100%) create mode 100644 shell/kill.js create mode 100644 shell/secret.bat create mode 100644 shell/secret.sh diff --git a/config.json b/config.json index 865518b4..741f2fe2 100644 --- a/config.json +++ b/config.json @@ -1,22 +1,19 @@ -{ - "cache" : {"allowed" : false}, - "appcache" : false, - "minification" : { - "js" : false, - "css" : false, - "html" : false, - "img" : false - }, - "github_id" : "891c251b925e4e967fa9", - "github_secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545", - "dropbox_key" : "0nd3ssnp5fp7tqs", - "dropbox_secret" : "r61lxpchmk8l06o", - "dropbox_chooser_key" : "o7d6llji052vijk", - "show_keys_panel" : true, - "server" : true, - "logs" : false, - "socket" : true, - "port" : 80, - "ip" : null, - "rest" : true +{ + "api_url" :"/api/v1", + "appcache" : false, + "cache" : {"allowed" : false}, + "minification" : { + "js" : false, + "css" : false, + "html" : false, + "img" : false + }, + "github_id" : "ec1f2e74b35a361e10bc", + "logs" : false, + "show_keys_panel" : true, + "server" : true, + "socket" : true, + "port" : 80, + "ip" : null, + "rest" : true } \ No newline at end of file diff --git a/lib/client/editor/_codemirror.js b/lib/client/editor/_codemirror.js index 633480b4..bb63ef91 100644 --- a/lib/client/editor/_codemirror.js +++ b/lib/client/editor/_codemirror.js @@ -1,4 +1,4 @@ -var CloudCommander, Util, DOM, CloudFunc, CodeMirror; +var CloudCommander, Util, DOM, CodeMirror; /* object contains editors CodeMirror */ (function(){ "use strict"; diff --git a/lib/client/storage/_dropbox.js b/lib/client/storage/_dropbox.js index 2c174b74..c6fff5c2 100644 --- a/lib/client/storage/_dropbox.js +++ b/lib/client/storage/_dropbox.js @@ -1,17 +1,18 @@ -var CloudCommander, Util, DOM, Dropbox; +var CloudCommander, DOM, Dropbox; /* module for work with github */ (function(){ "use strict"; - const cloudcmd = CloudCommander; - + const cloudcmd = CloudCommander, + CHOOSER_API = 'https://www.dropbox.com/static/api/1/dropbox.js'; + var CLIENT_ID, DropBoxStore = {}, options = { linkType: "direct", success: function(files) { - console.log("Here's the file link:" + files[0].link); + console.log("Here's the file link:" + files[0].link); }, cancel: function() { console.log('Chose something'); @@ -28,7 +29,7 @@ var CloudCommander, Util, DOM, Dropbox; cloudcmd.getConfig(function(pConfig){ var lElement = DOM.anyload({ - src : 'https://www.dropbox.com/static/api/1/dropbox.js', + src : CHOOSER_API, not_append : true, id : 'dropboxjs', func : DropBoxStore.choose @@ -38,6 +39,7 @@ var CloudCommander, Util, DOM, Dropbox; var lDropBoxId = pConfig.dropbox_chooser_key; lElement.setAttribute('data-app-key', lDropBoxId); document.body.appendChild(lElement); + console.timeEnd('dropbox load'); }); } diff --git a/lib/server/rest.js b/lib/server/rest.js index 866c4205..c28766c0 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -5,7 +5,8 @@ var main = global.cloudcmd.main, Util = main.util, - APIURL = '/api/v1', + Config = main.config, + APIURL = Config.api_url, OK = 200, Header = main.generateHeaders('api.json', false); @@ -94,7 +95,11 @@ */ function onGET(pParams){ var lResult = {error: 'command not found'}, - lCmd = pParams.command; + lCmd = pParams.command, + lConfig = main.config, + lEnv = process.env, + lEnvId, + lConfigId; switch(lCmd){ case '': @@ -102,12 +107,19 @@ break; case 'github_id': - var lEnv = process.env, - lConfig = main.config; - - lResult = lEnv.github_id || lConfig.github_id; + lEnvId = lEnv.github_id; + lConfigId = lConfig.github_id, + + lResult = lEnvId || lConfigId; break; + case 'dropbox_chooser_id': + lEnvId = lEnv.dropbox_chooser_id; + lConfigId = lConfig.dropbox_chooser_id; + + lResult = lEnvId || lConfigId; + break; + case 'kill': pParams.data = { mesage: 'Cloud Commander was killed' diff --git a/shell/c9kill.sh b/shell/c9kill.sh new file mode 100755 index 00000000..40e87d7e --- /dev/null +++ b/shell/c9kill.sh @@ -0,0 +1,12 @@ +kill -9 `ps ax|grep node-openshift|grep -v grep|awk '{print $1}'` +# print finded process +ProcessList=`ps ax|grep node-openshift` +echo $ProcessList +# getting pid of process +PID=`echo "${ProcessList}"|grep -v grep|awk '{print $1}'` +echo $PID +#kill it +if test ! $PID +then echo 'process not found' +else kill -9 $PID && echo 'killed process' +fi \ No newline at end of file diff --git a/cloudcmd.bat b/shell/cloudcmd.bat similarity index 91% rename from cloudcmd.bat rename to shell/cloudcmd.bat index 4c94262d..280f6023 100644 --- a/cloudcmd.bat +++ b/shell/cloudcmd.bat @@ -6,4 +6,4 @@ :: 866 charset to Unicode 65001 sometime :: when it's neaded. :: ------------------------------------- -node cloudcmd || chcp 866 \ No newline at end of file +node ../cloudcmd || chcp 866 \ No newline at end of file diff --git a/shell/deploy.sh b/shell/deploy.sh new file mode 100755 index 00000000..fdda2c00 --- /dev/null +++ b/shell/deploy.sh @@ -0,0 +1,10 @@ +echo 'appfog' +af update +echo 'http://cloudcmd.aws.af.cm/' +echo 'cloud foundry' +vmc update +echo 'http://cloudcmd.cloudfoundry.com/' +echo 'nodester' +git push nodester master +echo 'heroku' +git push heroku master \ No newline at end of file diff --git a/install-dev b/shell/install-dev similarity index 100% rename from install-dev rename to shell/install-dev diff --git a/shell/kill.js b/shell/kill.js new file mode 100644 index 00000000..7b08dfb5 --- /dev/null +++ b/shell/kill.js @@ -0,0 +1,17 @@ +/* c9.io kill active node process */ + +(function(){ + "use strict"; + + var exec = require('child_process').exec, + lCmd = 'kill -9' + ' ' + /* kill finded process */ + '`ps ax' + '|' + /* show all process */ + 'grep node-openshift' + '|' + /* find node-openshift */ + 'grep -v grep' + '|' + /* exlude grep command */ + 'awk "{print $1}"`'; /* show first collumn */ + + exec(lCmd, function(error, stdout, stderr){ + console.log(error || stdout || stderr); + }); + +})(); diff --git a/shell/secret.bat b/shell/secret.bat new file mode 100644 index 00000000..1c72b43e --- /dev/null +++ b/shell/secret.bat @@ -0,0 +1,13 @@ +# +# part of Cloud Commander +# win32 version +# secrets of github and dropbox +# must not be shared +# http://github.com/coderaiser/cloudcmd +# +# for using just add %-symbol on start and end of name +# like %github_secret% + +github_secret=e21b3724d84f0f7570d2d04d8e055f3cc3be3071 +dropbox_key=0nd3ssnp5fp7tqs +dropbox_chooser_key=o7d6llji052vijk diff --git a/shell/secret.sh b/shell/secret.sh new file mode 100644 index 00000000..16cb1425 --- /dev/null +++ b/shell/secret.sh @@ -0,0 +1,13 @@ +# +# part of Cloud Commander +# *nix version +# secrets of github and dropbox +# must not be shared +# http://github.com/coderaiser/cloudcmd +# +# for using just add $-symbol on start of name +# like $github_secret + +export github_secret=e21b3724d84f0f7570d2d04d8e055f3cc3be3071 +export dropbox_key=0nd3ssnp5fp7tqs +export dropbox_chooser_key=o7d6llji052vijk