From 66f94a7cef1dc132b2db38ea8fcb6d66eb96fc8d Mon Sep 17 00:00:00 2001 From: Gubolin Date: Sat, 2 Aug 2014 11:45:33 +0200 Subject: save GitHub project in one file (now media loads properly); make it easier to open projects by other users --- github.js | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'github.js') diff --git a/github.js b/github.js index 6f0ce6e..573f4d4 100644 --- a/github.js +++ b/github.js @@ -68,21 +68,12 @@ GitHubBackend.prototype.getProject = function ( var repo = myself.gh.getRepo(userName, projectName); var branch = repo.getBranch(); // master (default) - var media, pdata; branch.read('snap.xml', false).then( function (sourceContent) { - branch.read('media.xml', false).then( // true for binary - function (mediaContent) { - callBack.call( - null, - sourceContent.content, - mediaContent.content - ); - }, - function (error) { - errorCall.call(this, error, 'GitHub'); - } + callBack.call( + null, + sourceContent.content ); }, function (error) { @@ -133,16 +124,15 @@ GitHubBackend.prototype.login = function ( GitHubBackend.prototype.saveProject = function (commitMessage, ide, callBack, errorCall) { var myself = this, - pdata, - media; + data; + var pdata, media; var repoName = ide.projectName.replace(/[^\w-]/g, ''); // TODO validation of project name ide.serializer.isCollectingMedia = true; pdata = ide.serializer.serialize(ide.stage); media = ide.hasChangedMedia ? ide.serializer.mediaXML(ide.projectName) : null; - ide.serializer.isCollectingMedia = false; - ide.serializer.flushMedia(); + data = '' + pdata + media + ''; // check if serialized data can be parsed back again try { @@ -194,8 +184,7 @@ GitHubBackend.prototype.saveProject = function (commitMessage, ide, callBack, er var message = commitMessage; var contents = { - 'snap.xml': pdata, - 'media.xml': media, // may be binary + 'snap.xml': data, 'README.md': ide.projectNotes }; -- cgit v1.3.1