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
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
027d1598
"...main/gitlab@git.se.informatik.uni-kiel.de:nts/teetime.git" did not exist on "49f1103dbe9350bf7317ae86d306863daa6a2408"
Commit
027d1598
authored
8 years ago
by
Josefine Wegert
Browse files
Options
Downloads
Patches
Plain Diff
download frontend with addons finished
parent
f6409722
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.js
+238
-189
238 additions, 189 deletions
app.js
with
238 additions
and
189 deletions
app.js
+
238
−
189
View file @
027d1598
...
...
@@ -30,22 +30,23 @@ app.set('view engine', '.hbs');
//initialize the git repos
//TODO error handling is not working properly, error returned is not in let error, but in req + req and res are undefined!
// nanit.initialize(downloadFiles, function(req,res,err){
// // console.log('err in nanit.initialize:', err);
// // console.log('req in nanit.initialize:', req);
// // console.log('res in nanit.initialize:', res);
// let response =
// 'There was an error during cloning the git repositories. ' +
// 'Please contact "explorviz-developers-request@listserv.dfn.de" ' +
// 'and add the following information: ' + req;
// if(err){
// console.log('nanit.initialize error');
// res.send(response);
// return;
// };
// });
//TODO add spinner for telling user to wait until initialization is done
nanit
.
initialize
(
downloadFiles
,
function
(
req
,
res
,
err
){
// console.log('err in nanit.initialize:', err);
// console.log('req in nanit.initialize:', req);
// console.log('res in nanit.initialize:', res);
let
response
=
'
There was an error during cloning the git repositories.
'
+
'
Please contact "explorviz-developers-request@listserv.dfn.de"
'
+
'
and add the following information:
'
+
req
;
if
(
err
){
console
.
log
(
'
nanit.initialize error
'
);
res
.
send
(
response
);
return
;
};
});
//routes
app
.
get
(
'
/
'
,
function
(
req
,
res
){
...
...
@@ -101,7 +102,6 @@ resolve({zipFileName:'backend.war', path:'explorviz-ui-backend/target/explorviz-
})
promiseArray
.
push
(
backendPromise
);
console
.
log
(
'
promiseArray:
'
,
promiseArray
);
}
frontendChecked
=
checkedFiles
.
find
(
function
(
file
){
...
...
@@ -115,7 +115,7 @@ if (frontendChecked){
function
frontendPull
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
'
resolve
frontendPull
Promise
'
,
resolve
);
console
.
log
(
'
in
frontendPull
()
'
);
exec
(
'
cd
'
+
fileName
+
'
git pull
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
...
...
@@ -129,49 +129,52 @@ resolve();
});
})
}
promiseArray
.
push
(
frontendPull
);
console
.
log
(
'
promiseArray.push(frontendPullPromise):
'
,
promiseArray
);
function
frontendInstallAddons
(){
console
.
log
(
'
in frontendInstallAddons()
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
checkedPlugins
=
checkedFiles
.
filter
(
function
(
file
){
return
/
\b
explorviz-frontend-plugin-
\w
*/
.
exec
(
file
);
});
if
(
checkedPlugins
.
length
!==
0
){
// const frontendInstallAddons = frontendPullPromise.then((resolve, reject) => {
checkedPlugins
.
forEach
((
pluginName
)
=>
{
exec
(
'
cd
'
+
'
explorviz-ui-frontend
'
+
'
ember install
'
+
downloadFiles
[
pluginName
],
(
error
,
stdout
,
stderr
)
=>
{
// console.log('in installAddons()');
// checkedPlugins = checkedFiles.filter(function(file){
// return /\bexplorviz-frontend-plugin-\w*/.exec(file);
// });
// console.log('checkedPlugins', checkedPlugins);
// checkedPlugins.forEach((pluginName) => {
// exec('cd ' + 'explorviz-ui-frontend ' + 'ember install ' + downloadFiles[pluginName], (error, stdout, stderr) => {
// console.log('in exec plugin install');
// console.log('error in exec plugin install', error);
// if (error) {
// reject(error);
// return;
// }
if
(
error
)
{
reject
(
error
);
return
;
}
// console.log(stdout);
// console.log(stderr);
console
.
log
(
stdout
);
console
.
log
(
stderr
);
resolve
();
// resolve({zipFileName:'Zwischenschritt2', path:'./explorviz-ui-frontend/dist/'
});
});
// });
})
}
else
{
resolve
();
}
// })
})
}
// })
//promiseArray.push(frontendInstallAddons);
//console.log('promiseArray.push(frontendInstallAddons):',promiseArray);
function
frontendBuild
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
'
resolve frontendBuildPromise
'
,
resolve
);
//build everything you have
console
.
log
(
'
in frontendBuild()
'
);
exec
(
'
cd
'
+
fileName
+
'
&& ember build --environment=production
'
,
(
error
,
stdout
,
stderr
)
=>
{
//
if (error) {
//
reject(error);
//
return;
//
}
if
(
error
)
{
reject
(
error
);
return
;
}
console
.
log
(
stdout
);
console
.
log
(
stderr
);
...
...
@@ -183,63 +186,109 @@ exec('cd ' + fileName +' && ember build --environment=production', (error, stdou
})
}
//console.log('frontendBuildPromise:', frontendBuildPromise);
//promiseArray.push(frontendBuild());
console
.
log
(
'
promiseArray:
'
,
promiseArray
);
function
frontendAll
()
{
return
frontendPull
().
then
(
function
(){
return
frontendInstallAddons
().
then
(
function
(){
return
frontendBuild
()
})
})
}
promiseArray
.
push
(
frontendAll
());
finalizeZip
();
};
function
finalizeZip
(){
return
streamFilesToZip
().
then
(
function
(){
return
createZip
()
}).
catch
(
function
(
error
)
{
let
response
=
'
There was an error during your build.
'
+
'
Please contact "explorviz-developers-request@listserv.dfn.de"
'
+
'
and add the following information:
'
+
error
;
res
.
send
(
response
);
})
}
function
streamFilesToZip
(){
console
.
log
(
'
in streamFilesToZip
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
Promise
.
all
(
promiseArray
).
then
(
files
=>
{
console
.
log
(
'
in promise.all: promiseArray
'
,
promiseArray
);
console
.
log
(
'
in Promise.all
'
);
let
finishedArray
=
[];
files
.
forEach
(
file
=>
{
if
(
file
.
zipFileName
===
'
backend.war
'
){
backendStream
=
fs
.
createReadStream
(
file
.
path
);
zip
.
file
(
file
.
zipFileName
,
backendStream
);
const
backendSteam
=
fsReaddir
(
file
.
path
).
on
(
'
data
'
,
function
(
data
){
const
backendReadStream
=
fs
.
createReadStream
(
data
);
zip
.
file
(
zipFileName
,
backendReadStream
);
}).
on
(
'
error
'
,
function
(){
console
.
log
(
'
error:
'
,
error
);
}).
on
(
'
finish
'
,
function
(){
finishedArray
.
push
(
'
backend finished
'
);
if
(
finishedArray
.
length
===
files
.
length
){
resolve
();
}
})
// backendStream = fs.createReadStream(file.path);
// zip.file(file.zipFileName, backendStream);
// finishedArray.push('backend done');
}
if
(
file
.
zipFileName
===
'
frontend
'
){
console
.
log
(
'
zipFileName: frontend
'
,
file
.
zipFileName
);
const
stream
=
fsReaddir
(
file
.
path
)
.
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
'
error:
'
,
err
);
}).
on
(
'
data
'
,
function
(
data
){
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
frontendStream
=
fs
.
createReadStream
(
data
[
i
]);
console
.
log
(
'
frontend data[i]
'
,
data
[
i
]);
zip
.
file
(
data
[
i
],
frontendStream
);
}
}).
on
(
'
finish
'
,
function
(){
finishedArray
.
push
(
'
frontend finished
'
);
if
(
finishedArray
.
length
===
files
.
length
){
resolve
();
}
})
}
});
})
})
})
};
function
createZip
(){
console
.
log
(
'
in createZip
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
zip
.
generateNodeStream
({
type
:
'
nodebuffer
'
,
streamFiles
:
true
}).
pipe
(
fs
.
createWriteStream
(
'
explorviz-builds.zip
'
)).
on
(
'
finish
'
,
function
()
{
console
.
log
(
'
explorviz-builds.zip written.
'
);
res
.
download
(
'
explorviz-builds.zip
'
);
});
}).
catch
(
function
(
error
)
{
let
response
=
'
There was an error during your build.
'
+
'
Please contact "explorviz-developers-request@listserv.dfn.de"
'
+
'
and add the following information:
'
+
error
;
res
.
send
(
response
);
})
}
});
...
...
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