summaryrefslogtreecommitdiff
path: root/github.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2014-08-02 11:45:33 +0200
committerGubolin <gubolin@fantasymail.de>2014-08-02 11:45:33 +0200
commit66f94a7cef1dc132b2db38ea8fcb6d66eb96fc8d (patch)
treed6a47294c4cd405154309132a8484e0b0b521382 /github.js
parent3571c41da1d30e61e8436079073ebcbfe50ac8de (diff)
downloadsnap-66f94a7cef1dc132b2db38ea8fcb6d66eb96fc8d.tar.gz
snap-66f94a7cef1dc132b2db38ea8fcb6d66eb96fc8d.zip
save GitHub project in one file (now media loads properly); make it easier to open projects by other users
Diffstat (limited to 'github.js')
-rw-r--r--github.js25
1 files changed, 7 insertions, 18 deletions
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 = '<snapdata>' + pdata + media + '</snapdata>';
// 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
};