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
7149fd1f
Commit
7149fd1f
authored
7 years ago
by
Josefine Wegert
Browse files
Options
Downloads
Patches
Plain Diff
minor changes
parent
e854c7e7
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app.js
+0
-1
0 additions, 1 deletion
app.js
frontendFunctions.js
+12
-13
12 additions, 13 deletions
frontendFunctions.js
initializers/gitRepos.js
+38
-40
38 additions, 40 deletions
initializers/gitRepos.js
zipFunctions.js
+63
-75
63 additions, 75 deletions
zipFunctions.js
with
113 additions
and
129 deletions
app.js
+
0
−
1
View file @
7149fd1f
...
...
@@ -135,7 +135,6 @@ function finalizeZip(){
}
function
createZip
(
zip
){
console
.
log
(
'
in createZip
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
zip
.
generateNodeStream
({
type
:
'
nodebuffer
'
,
streamFiles
:
true
}).
pipe
(
fs
.
createWriteStream
(
'
explorviz-builds.zip
'
)).
on
(
'
error
'
,
function
(
error
){
console
.
log
(
'
error in createZip:
'
,
error
);
...
...
This diff is collapsed.
Click to expand it.
frontendFunctions.js
+
12
−
13
View file @
7149fd1f
...
...
@@ -4,19 +4,18 @@
function
frontendClean
(
fileName
){
return
new
Promise
((
resolve
,
reject
)
=>
{
//' git fetch origin && git reset --hard origin/master '
exec
(
'
cd
'
+
fileName
+
'
&& git checkout package.json && npm prune
'
,
(
error
,
stdout
,
stderr
)
=>
{
exec
(
'
cd
'
+
fileName
+
'
&& git checkout package.json && npm prune
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
reject
(
error
)
return
;
}
if
(
error
)
{
reject
(
error
)
return
;
}
console
.
log
(
stdout
);
console
.
log
(
stderr
);
resolve
();
});
})
console
.
log
(
stdout
);
console
.
log
(
stderr
);
resolve
();
});
})
}
...
...
@@ -49,9 +48,9 @@
if
(
checkedPlugins
.
length
!==
0
){
checkedPlugins
.
forEach
((
pluginName
)
=>
{
//TODO now addon is listed under dependencies-section in package.json
exec
(
'
cd
'
+
fileName
+
'
&& ember install
'
+
downloadFiles
[
pluginName
]
+
'
--save
'
,
(
error
,
stdout
,
stderr
)
=>
{
console
.
log
(
'
in frontendInstallAddons
'
);
if
(
error
)
{
reject
(
error
);
return
;
...
...
This diff is collapsed.
Click to expand it.
initializers/gitRepos.js
+
38
−
40
View file @
7149fd1f
...
...
@@ -11,64 +11,63 @@ var exec = require('child_process').exec;
};
function
initBackend
(
downloadFiles
){
const
backendName
=
'
explorviz-ui-backend
'
;
const
downloadBackendURL
=
downloadFiles
[
backendName
];
function
initBackend
(
downloadFiles
){
const
backendName
=
'
explorviz-ui-backend
'
;
const
downloadBackendURL
=
downloadFiles
[
backendName
];
return
new
Promise
((
resolve
,
reject
)
=>
{
exec
(
'
git clone
'
+
downloadBackendURL
+
'
'
+
backendName
,
(
error
,
stdout
,
stderr
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
exec
(
'
git clone
'
+
downloadBackendURL
+
'
'
+
backendName
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
console
.
log
(
'
initGitRepos: backendFailed ->
'
,
error
);
reject
(
error
);
return
;
}
if
(
error
)
{
reject
(
error
);
return
;
}
console
.
log
(
stdout
);
console
.
log
(
stderr
);
});
resolve
(
downloadFiles
);
console
.
log
(
stdout
);
console
.
log
(
stderr
);
});
resolve
(
downloadFiles
);
});
}
});
}
function
initBackendPlugins
(
downloadFiles
){
downloadNames
=
Object
.
keys
(
downloadFiles
);
const
backendPlugins
=
downloadNames
.
filter
(
function
(
file
){
function
initBackendPlugins
(
downloadFiles
){
downloadNames
=
Object
.
keys
(
downloadFiles
);
const
backendPlugins
=
downloadNames
.
filter
(
function
(
file
){
return
/
\b
explorviz-backend-plugin-
\w
*/
.
exec
(
file
);
});
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
backendPlugins
.
length
!==
0
){
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
backendPlugins
.
length
!==
0
){
backendPlugins
.
forEach
((
pluginName
)
=>
{
exec
(
'
git clone
'
+
downloadFiles
[
pluginName
],
(
error
,
stdout
,
stderr
)
=>
{
backendPlugins
.
forEach
((
pluginName
)
=>
{
exec
(
'
git clone
'
+
downloadFiles
[
pluginName
],
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
reject
(
error
);
return
;
}
if
(
error
)
{
reject
(
error
);
return
;
}
console
.
log
(
stdout
);
console
.
log
(
stderr
);
console
.
log
(
stdout
);
console
.
log
(
stderr
);
resolve
(
downloadFiles
);
resolve
(
downloadFiles
);
});
});
})
}
else
{
resolve
(
downloadFiles
);
}
})
}
else
{
resolve
(
downloadFiles
);
}
})
})
}
}
function
initFrontend
(
downloadFiles
){
function
initFrontend
(
downloadFiles
){
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -77,7 +76,6 @@ function initFrontend(downloadFiles){
exec
(
'
git clone
'
+
downloadFrontendURL
+
'
'
+
frontendName
+
'
&& cd
'
+
frontendName
+
'
&& npm install
'
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
console
.
log
(
'
initGitRepos: frontendFailed ->
'
,
error
);
reject
(
error
);
return
;
}
...
...
This diff is collapsed.
Click to expand it.
zipFunctions.js
+
63
−
75
View file @
7149fd1f
var
express
=
require
(
'
express
'
);
var
fs
=
require
(
'
fs
'
);
var
fsReaddir
=
require
(
'
fs-readdir
'
);
var
JSZip
=
require
(
'
jszip
'
);
const
zip
=
new
JSZip
();
zip
.
file
(
"
README.txt
"
,
"
text for README
"
);
let
finishedArray
=
[];
function
streamFilesToZip
(
promiseArray
){
return
new
Promise
((
resolve
,
reject
)
=>
{
Promise
.
all
(
promiseArray
).
then
(
files
=>
{
files
.
forEach
(
file
=>
{
if
(
file
.
zipFileName
===
'
backend.war
'
){
var
express
=
require
(
'
express
'
);
var
fs
=
require
(
'
fs
'
);
var
fsReaddir
=
require
(
'
fs-readdir
'
);
var
JSZip
=
require
(
'
jszip
'
);
const
zip
=
new
JSZip
();
zip
.
file
(
"
README.txt
"
,
"
text for README
"
);
let
finishedArray
=
[];
function
streamFilesToZip
(
promiseArray
){
return
new
Promise
((
resolve
,
reject
)
=>
{
Promise
.
all
(
promiseArray
).
then
(
files
=>
{
files
.
forEach
(
file
=>
{
if
(
file
.
zipFileName
===
'
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
);
}
});
});
}
fs
.
readFileAsync
=
function
(
filePath
){
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
readFile
(
filePath
,
function
(
err
,
data
)
{
if
(
err
)
{
reject
(
err
);
}
else
{
resolve
(
data
);
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
(){
finishedArray
.
push
(
'
backend finished
'
);
if
(
finishedArray
.
length
===
promiseArray
.
length
){
resolve
(
zip
);
}
});
});
}
})
function
addBackendToZip
(
data
){
return
new
Promise
(
function
(
resolve
,
reject
){
zip
.
file
(
file
.
zipFileName
,
data
);
resolve
();
})
}
console
.
log
(
'
in backend.war
'
);
backendContent
=
fs
.
readFileAsync
(
file
.
path
);
backendContent
.
then
(
function
(
data
){
addBackendToZip
(
data
).
then
(
function
(){
finishedArray
.
push
(
'
backend finished
'
);
}
if
(
file
.
zipFileName
===
'
frontend
'
){
const
frontendStream
=
fsReaddir
(
file
.
path
)
.
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
'
error:
'
,
err
);
}).
on
(
'
data
'
,
function
(
data
){
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
frontendReadStream
=
fs
.
createReadStream
(
data
[
i
]);
zip
.
file
(
data
[
i
],
frontendReadStream
);
}
}).
on
(
'
finish
'
,
function
(){
finishedArray
.
push
(
'
frontend finished
'
);
if
(
finishedArray
.
length
===
promiseArray
.
length
){
resolve
(
zip
);
}
})
}
})
}
if
(
file
.
zipFileName
===
'
frontend
'
){
const
frontendStream
=
fsReaddir
(
file
.
path
)
.
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
'
error:
'
,
err
);
}).
on
(
'
data
'
,
function
(
data
){
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
frontendReadStream
=
fs
.
createReadStream
(
data
[
i
]);
zip
.
file
(
data
[
i
],
frontendReadStream
);
}
}).
on
(
'
finish
'
,
function
(){
finishedArray
.
push
(
'
frontend finished
'
);
if
(
finishedArray
.
length
===
promiseArray
.
length
){
resolve
(
zip
);
}
console
.
log
(
'
finishedArray in frontend:
'
,
finishedArray
);
})
}
})
})
})
}
})
}
module
.
exports
=
{
streamFilesToZip
}
module
.
exports
=
{
streamFilesToZip
}
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