Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
explorviz-downloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ExplorViz
explorviz-github-archive
explorviz-downloader
Commits
df43aef3
Commit
df43aef3
authored
8 years ago
by
Josefine Wegert
Browse files
Options
Downloads
Patches
Plain Diff
writes backend without addons to zip, backend and frontend together still not working
parent
63b3ea18
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.js
+91
-72
91 additions, 72 deletions
app.js
with
91 additions
and
72 deletions
app.js
+
91
−
72
View file @
df43aef3
...
...
@@ -87,6 +87,7 @@
function
backendClean
(){
console
.
log
(
'
in backendClean
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
exec
(
'
cd explorviz-ui-backend/plugins/net/explorviz/ && rm -rf plugins/*
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
...
...
@@ -104,7 +105,7 @@
}
function
backendPull
(){
console
.
log
(
'
in backendPull
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
exec
(
'
cd
'
+
fileName
+
'
git pull
'
,
(
error
,
stdout
,
stderr
)
=>
{
...
...
@@ -124,7 +125,9 @@
}
function
backendInstallAddons
(){
console
.
log
(
'
in backendInstallAddons
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
checkedPlugins
=
checkedFiles
.
filter
(
function
(
file
){
return
/
\b
explorviz-backend-plugin-
\w
*/
.
exec
(
file
);
...
...
@@ -133,7 +136,7 @@
if
(
checkedPlugins
.
length
!==
0
){
checkedPlugins
.
forEach
((
pluginName
)
=>
{
exec
(
'
git clone
'
+
downloadFiles
[
pluginName
]
+
'
&& c
p -R
'
+
pluginName
+
'
/
'
+
'
explorviz-ui-backend/plugins/net/explorviz/plugins/
'
,
(
error
,
stdout
,
stderr
)
=>
{
//'cd explorviz-ui-backend/plugins/net/explorviz/plugins/ ' +
exec
(
'
git clone
'
+
downloadFiles
[
pluginName
]
+
'
&& c
d
'
+
pluginName
+
'
&& cp -R
'
+
'
.
'
+
'
../
explorviz-ui-backend/plugins/net/explorviz/plugins/
'
,
(
error
,
stdout
,
stderr
)
=>
{
//'cd explorviz-ui-backend/plugins/net/explorviz/plugins/ ' +
if
(
error
)
{
reject
(
error
);
...
...
@@ -158,6 +161,7 @@
}
function
backendBuild
(){
console
.
log
(
'
in backendBuild
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
exec
(
'
cd
'
+
fileName
+
'
&& mvn compile war:war
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
...
...
@@ -188,6 +192,7 @@
}
promiseArray
.
push
(
backendAll
());
console
.
log
(
'
promiseArray:
'
,
promiseArray
);
finalizeZip
();
}
...
...
@@ -310,33 +315,47 @@ function streamFilesToZip(){
console
.
log
(
'
in streamFilesToZip
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
'
promiseArray:
'
,
promiseArray
);
Promise
.
all
(
promiseArray
).
then
(
files
=>
{
console
.
log
(
'
in Promise.all
'
);
let
finishedArray
=
[];
files
.
forEach
(
file
=>
{
if
(
file
.
zipFileName
===
'
backend.war
'
){
//
console.log('backend
Stream:
');
// backendStream = fs.createReadStream(file.path);
// console.log('zip.file:');
// zip.file(file.zipFileName, backendStream);
// console.log('backend done:');
// finishedArray.push('backend done');
const
backendStream
=
fs
.
readFileSync
(
file
.
path
,
"
base64
"
,
function
(
error
,
data
){
if
(
error
)
{
console
.
log
(
'
error:
'
,
error
)
console
.
log
(
'
in
backend
.war
'
);
fs
.
readFileAsync
=
function
(
filePath
){
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
readFile
(
filePath
,
function
(
err
,
data
)
{
if
(
err
)
{
reject
(
err
);
}
else
{
resolve
(
data
);
}
});
});
//console.log('backendStream:', backendStream);
const
backendReadStream
=
fs
.
createReadStream
(
backendStream
);
}
zip
.
file
(
file
.
zipFileName
,
backendReadStream
);
finishedArray
.
push
(
'
backend finished
'
);
if
(
finishedArray
.
length
===
files
.
length
){
function
addBackendToZip
(
data
){
return
new
Promise
(
function
(
resolve
,
reject
){
zip
.
file
(
file
.
zipFileName
,
data
);
resolve
();
})
}
backendContent
=
fs
.
readFileAsync
(
file
.
path
);
backendContent
.
then
(
function
(
data
){
addBackendToZip
(
data
).
then
(
function
(){
resolve
(
finishedArray
.
push
(
'
backend finished
'
));
})
})
if
(
finishedArray
.
length
===
files
.
length
){
resolve
();
}
}
...
...
@@ -347,7 +366,6 @@ const backendStream = fs.readFileSync(file.path, "base64", function(error, data)
}).
on
(
'
data
'
,
function
(
data
){
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
frontendReadStream
=
fs
.
createReadStream
(
data
[
i
]);
console
.
log
(
'
data[i]:
'
,
data
[
i
]);
zip
.
file
(
data
[
i
],
frontendReadStream
);
}
...
...
@@ -357,6 +375,7 @@ const backendStream = fs.readFileSync(file.path, "base64", function(error, data)
resolve
();
}
})
console
.
log
(
'
frontendStream:
'
,
frontendStream
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment