From 5d9b538513802964d5313ffe27336cab3b7471b7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 20 Jan 2015 14:39:14 -0800 Subject: [PATCH 1/7] Add script to dump information for atom-shell --- script/dump_info.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 script/dump_info.js diff --git a/script/dump_info.js b/script/dump_info.js new file mode 100644 index 0000000000..c95dd736c3 --- /dev/null +++ b/script/dump_info.js @@ -0,0 +1,39 @@ +var app = require('app'); + +function getDate() { + var today = new Date(); + var year = today.getFullYear(); + var month = today.getMonth() + 1; + if (month <= 9) + month = '0' + month; + var day= today.getDate(); + if (day <= 9) + day = '0' + day; + return year + '-' + month + '-' + day; +} + +app.on('ready', function() { + var json = {}; + json.version = process.versions['atom-shell']; + json.date = getDate(); + + var names = ['v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome'] + for (var i in names) { + var name = names[i]; + json[name] = process.versions[name]; + } + + json.files = [ + 'darwin-x64', + 'darwin-x64-symbols', + 'linux-ia32', + 'linux-ia32-symbols', + 'linux-x64', + 'linux-x64-symbols', + 'win32-ia32', + 'win32-ia32-symbols', + ]; + + console.log(json); + process.exit(0); +}); From 74566375b558d1f8d7000ae9892f14e54c121629 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 20 Jan 2015 21:53:53 -0800 Subject: [PATCH 2/7] Download the index.json from server --- package.json | 3 ++- script/dump_info.js | 46 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f3e0388b6f..e28f9c4709 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "devDependencies": { "atom-package-manager": "0.112.0", "coffee-script": "~1.7.1", - "coffeelint": "~1.3.0" + "coffeelint": "~1.3.0", + "request": "*" }, "private": true, diff --git a/script/dump_info.js b/script/dump_info.js index c95dd736c3..beea7738f4 100644 --- a/script/dump_info.js +++ b/script/dump_info.js @@ -1,4 +1,8 @@ var app = require('app'); +var fs = require('fs'); +var request = require('request'); + +var TARGET_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json'; function getDate() { var today = new Date(); @@ -12,7 +16,7 @@ function getDate() { return year + '-' + month + '-' + day; } -app.on('ready', function() { +function getInfoForCurrentVersion() { var json = {}; json.version = process.versions['atom-shell']; json.date = getDate(); @@ -34,6 +38,42 @@ app.on('ready', function() { 'win32-ia32-symbols', ]; - console.log(json); - process.exit(0); + return json; +} + +function getIndexJsInServer(callback) { + request(TARGET_URL, function(e, res, body) { + if (e) + callback(e); + else if (res.statusCode != 200) + callback(new Error('Server returned ' + res.statusCode)); + else + callback(null, JSON.parse(body)); + }); +} + +function findObjectByVersion(all, version) { + for (var i in all) + if (all[i].version == version) + return i; + return -1; +} + +app.on('ready', function() { + getIndexJsInServer(function(e, all) { + if (e) { + console.error(e); + process.exit(1); + } + + var current = getInfoForCurrentVersion(); + var found = findObjectByVersion(all, current.version); + if (found == -1) + all.unshift(current); + else + all[found] = current; + + fs.writeFileSync(process.argv[2], JSON.stringify(all)); + process.exit(0); + }); }); From 87cd762eb36346adcea54e26a1dd457a75277c68 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 20 Jan 2015 21:58:46 -0800 Subject: [PATCH 3/7] :arrow_up: apm@0.122.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e28f9c4709..f6dd77767c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ ], "devDependencies": { - "atom-package-manager": "0.112.0", + "atom-package-manager": "0.122.0", "coffee-script": "~1.7.1", "coffeelint": "~1.3.0", "request": "*" From 62756a79dfc771ba65789905d1a781942bf9d7e7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 20 Jan 2015 22:01:37 -0800 Subject: [PATCH 4/7] Include apm version in index.json --- script/{dump_info.js => dump-version-info.js} | 7 +++++++ 1 file changed, 7 insertions(+) rename script/{dump_info.js => dump-version-info.js} (89%) diff --git a/script/dump_info.js b/script/dump-version-info.js similarity index 89% rename from script/dump_info.js rename to script/dump-version-info.js index beea7738f4..d5595c0c79 100644 --- a/script/dump_info.js +++ b/script/dump-version-info.js @@ -1,5 +1,6 @@ var app = require('app'); var fs = require('fs'); +var path = require('path'); var request = require('request'); var TARGET_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json'; @@ -16,10 +17,16 @@ function getDate() { return year + '-' + month + '-' + day; } +function getApmVersion() { + var package = require(path.resolve(__dirname, '..', 'package.json')); + return package.devDependencies['atom-package-manager']; +} + function getInfoForCurrentVersion() { var json = {}; json.version = process.versions['atom-shell']; json.date = getDate(); + json.apm = getApmVersion(); var names = ['v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome'] for (var i in names) { From 7b621262eaf3ad5d4cc02d29a706a77e1d2bafb0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 20 Jan 2015 22:09:30 -0800 Subject: [PATCH 5/7] Upload the index.json to S3 --- script/upload.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/upload.py b/script/upload.py index 7841017ed1..ae7255110d 100755 --- a/script/upload.py +++ b/script/upload.py @@ -190,6 +190,14 @@ def upload_node(bucket, access_key, secret_key, version): s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) + # Upload the index.json + atom_shell = os.path.join(OUT_DIR, 'atom.exe') + index_json = os.path.join(OUT_DIR, 'index.json') + execute([atom_shell, + os.path.join(SOURCE_ROOT, 'script', 'dump-version-info.js'), + index_json]) + s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell', [index_json]) + def auth_token(): token = os.environ.get('ATOM_SHELL_GITHUB_TOKEN') From 23760058e9d2aed61218b7cf24ac36a04a2c1a91 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 20 Jan 2015 22:16:27 -0800 Subject: [PATCH 6/7] Fix target url --- script/upload.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/upload.py b/script/upload.py index ae7255110d..320bd0661a 100755 --- a/script/upload.py +++ b/script/upload.py @@ -196,7 +196,8 @@ def upload_node(bucket, access_key, secret_key, version): execute([atom_shell, os.path.join(SOURCE_ROOT, 'script', 'dump-version-info.js'), index_json]) - s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell', [index_json]) + s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', + [index_json]) def auth_token(): From b8d0c5b3fed2e1eb936c4a8568d83ffafb2551b8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 21 Jan 2015 13:37:52 -0800 Subject: [PATCH 7/7] Include node's version --- script/dump-version-info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/dump-version-info.js b/script/dump-version-info.js index d5595c0c79..9158dc06e7 100644 --- a/script/dump-version-info.js +++ b/script/dump-version-info.js @@ -28,7 +28,7 @@ function getInfoForCurrentVersion() { json.date = getDate(); json.apm = getApmVersion(); - var names = ['v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome'] + var names = ['node', 'v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome'] for (var i in names) { var name = names[i]; json[name] = process.versions[name];