Skip to content

Commit 27062d6

Browse files
author
Matt Karl
committed
Fixed the template downloading/unzipping
1 parent b96c808 commit 27062d6

File tree

11 files changed

+177
-77
lines changed

11 files changed

+177
-77
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SpringRollStudio",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"private": true,
55
"dependencies": {
66
"jqueryui": "*",

deploy/assets/templates/default/springroll-template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "Default",
33
"id" : "io.springroll.default",
4-
"version" : "1.3.0",
4+
"version" : "1.3.1",
55
"github": "SpringRoll/SpringRollTemplate",
66
"rename" : {
77
"gitignore" : ".gitignore",
@@ -61,7 +61,7 @@
6161
},
6262
{
6363
"id": "easeljs-interface",
64-
"name": "EaselJS Animation",
64+
"name": "EaselJS Interface",
6565
"description": "Drag management and basic buttons for EaselJS",
6666
"main": "components/springroll/dist/modules/easeljs-interface.min.js",
6767
"mainDebug": "components/springroll/dist/modules/easeljs-interface.js",

deploy/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "SpringRollStudio",
33
"description": "Application for SpringRoll projects",
4-
"version": "0.2.3",
4+
"version": "0.2.4",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/SpringRoll/SpringRollStudio"
@@ -23,7 +23,6 @@
2323
},
2424
"dependencies": {
2525
"MD5": "~1.2.0",
26-
"adm-zip": "~0.4.4",
2726
"ansi2html": "~0.0.1",
2827
"connect": "^3.3.4",
2928
"fs-extra": "~0.12.0",
@@ -35,6 +34,7 @@
3534
"request": "^2.48.0",
3635
"semver": "~4.0.3",
3736
"serve-static": "^1.8.1",
37+
"unzip": "^0.1.11",
3838
"ws": "~0.4.32"
3939
}
4040
}

installer/win32.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# These three must be integers
55
!define VERSIONMAJOR 0
66
!define VERSIONMINOR 2
7-
!define VERSIONBUILD 3
7+
!define VERSIONBUILD 4
88
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
99
# It is possible to use "mailto:" links in here to open the email client
1010
!define HELPURL "https://github.com/SpringRoll/SpringRollStudio/issues"

installer/win64.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# These three must be integers
55
!define VERSIONMAJOR 0
66
!define VERSIONMINOR 2
7-
!define VERSIONBUILD 3
7+
!define VERSIONBUILD 4
88
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
99
# It is possible to use "mailto:" links in here to open the email client
1010
!define HELPURL "https://github.com/SpringRoll/SpringRollStudio/issues"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "SpringRollStudio",
33
"private": true,
4-
"version": "0.2.3",
4+
"version": "0.2.4",
55
"dependencies": {
66
"grunt": "^0.4.5",
77
"grunt-contrib-copy": "^0.7.0",

project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SpringRollStudio",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"main": [
55
"components/node-webkit-app/src/utils/UpdateChecker.js",
66
"components/node-webkit-app/src/utils/Browser.js",
@@ -77,6 +77,7 @@
7777
"src/less/tasks/TaskRunner.less"
7878
],
7979
"new": [
80+
"src/js/new/Extract.js",
8081
"src/js/new/JSONUtils.js",
8182
"src/js/new/TemplateModule.js",
8283
"src/js/new/Template.js",

src/jade/new.jade

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ html
2323
| Drag template here.
2424
.folder.center-vertical
2525
.error.center-vertical
26+
script#templateTemplate(type='text/html')
27+
<div class="template">
28+
<span class="name"></span>
29+
<button class="btn btn-danger pull-right">&times;</button>
30+
</div>
2631
#listTemplates.templates
27-
.template
28-
span.name Default
29-
button.btn.btn-default.disabled.pull-right(disabled='') ×
3032
.form-horizontal(role='form')
3133
header
3234
h1 Create New Project

src/js/new/Extract.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
(function()
2+
{
3+
if (APP)
4+
{
5+
var path = require('path');
6+
var fs = require('fs-extra');
7+
var unzip = require('unzip');
8+
}
9+
10+
/**
11+
* Extract abstraction
12+
* @class Extract
13+
* @static
14+
*/
15+
var Extract = {};
16+
17+
/**
18+
* Extract a zip file
19+
* @method run
20+
* @static
21+
* @param {String} zipPath The path to the zip file
22+
* @param {String} outputPath The output folder
23+
* @param {Function} callback Callback when completed or errored
24+
*/
25+
Extract.run = function(zipPath, outputPath, callback)
26+
{
27+
// Read the zipfile
28+
fs.createReadStream(zipPath)
29+
30+
// Parse the contents
31+
.pipe(unzip.Parse())
32+
33+
// Read each entry
34+
.on('entry', function(entry)
35+
{
36+
console.log(entry.type + " :: " + entry.path);
37+
38+
// remove the root directory which is <team>-<Repo>-<sha>
39+
var localFile = entry.path.substr(entry.path.indexOf('/') + 1);
40+
var outputFile = path.join(outputPath, localFile);
41+
42+
if (entry.type == "Directory")
43+
{
44+
fs.mkdirsSync(outputFile);
45+
}
46+
else
47+
{
48+
console.log("Copy file " + outputFile);
49+
50+
// Copy the file to output location
51+
entry.pipe(fs.createWriteStream(outputFile));
52+
}
53+
})
54+
.on('close', function()
55+
{
56+
console.log("Completed unzip");
57+
callback();
58+
});
59+
};
60+
61+
// Assign to namespace
62+
namespace('springroll.new').Extract = Extract;
63+
64+
}());

0 commit comments

Comments
 (0)