Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
f6f16d2f
Commit
f6f16d2f
authored
Mar 09, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved get_files_list to utils
parent
33d2dda1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
31 deletions
+33
-31
debomatic-webui/lib/client.js
debomatic-webui/lib/client.js
+3
-31
debomatic-webui/lib/utils.js
debomatic-webui/lib/utils.js
+30
-0
No files found.
debomatic-webui/lib/client.js
View file @
f6f16d2f
...
...
@@ -4,35 +4,9 @@ var fs = require('fs')
,
config
=
require
(
'
./config.js
'
)
,
utils
=
require
(
'
./utils.js
'
)
function
__get_files_list
(
dir
,
onlyDirectories
,
callback
)
{
fs
.
readdir
(
dir
,
function
(
err
,
files
){
result
=
[];
if
(
err
)
{
console
.
error
(
err
);
return
;
}
files
.
forEach
(
function
(
f
)
{
try
{
complete_path
=
path
.
join
(
dir
,
f
);
if
(
onlyDirectories
)
{
if
(
fs
.
statSync
(
complete_path
).
isDirectory
())
{
result
.
push
(
f
);
}
}
else
{
if
(
fs
.
statSync
(
complete_path
).
isFile
())
{
result
.
push
(
f
);
}
}
}
catch
(
fs_error
)
{}
});
callback
(
result
);
});
}
function
__get_files_list_from_package
(
data
,
callback
)
{
package_path
=
utils
.
get_package_path
(
data
)
__
get_files_list
(
package_path
,
false
,
function
(
files
)
{
utils
.
get_files_list
(
package_path
,
false
,
function
(
files
)
{
data
.
package
.
files
=
[]
data
.
package
.
debs
=
[]
data
.
package
.
archives
=
[]
...
...
@@ -68,7 +42,7 @@ function __send_package_files_list (event_name, socket, data) {
function
__send_distribution_packages
(
event_name
,
socket
,
data
)
{
distro_path
=
utils
.
get_distribution_pool_path
(
data
)
__
get_files_list
(
distro_path
,
true
,
function
(
packages
)
{
utils
.
get_files_list
(
distro_path
,
true
,
function
(
packages
)
{
data
.
distribution
.
packages
=
[]
packages
.
forEach
(
function
(
p
)
{
pack
=
{}
...
...
@@ -99,7 +73,7 @@ function __send_file (event_name, socket, data) {
}
function
__send_distributions
(
event_name
,
socket
,
data
)
{
__
get_files_list
(
config
.
debomatic
.
path
,
true
,
function
(
distros
){
utils
.
get_files_list
(
config
.
debomatic
.
path
,
true
,
function
(
distros
){
socket
.
emit
(
event_name
,
distros
);
});
}
...
...
@@ -137,8 +111,6 @@ function __watch_path_onsocket(event_name, socket, data, watch_path, updater) {
})
}
function
__generic_handler
(
event_name
,
socket
,
data
,
watch_path
,
callback
)
{
__watch_path_onsocket
(
event_name
,
socket
,
data
,
config
.
debomatic
.
path
,
callback
)
callback
(
event_name
,
socket
,
data
)
...
...
debomatic-webui/lib/utils.js
View file @
f6f16d2f
var
path
=
require
(
'
path
'
)
,
fs
=
require
(
'
fs
'
)
,
config
=
require
(
'
./config.js
'
)
function
__check_data_distribution
(
data
)
{
...
...
@@ -25,6 +26,32 @@ function __get_file_path(data) {
return
path
.
join
(
__get_package_path
(
data
),
data
.
package
.
name
+
'
_
'
+
data
.
package
.
version
+
'
.
'
+
data
.
file
.
name
)
}
function
__get_files_list
(
dir
,
onlyDirectories
,
callback
)
{
fs
.
readdir
(
dir
,
function
(
err
,
files
){
result
=
[];
if
(
err
)
{
console
.
error
(
err
);
return
;
}
files
.
forEach
(
function
(
f
)
{
try
{
complete_path
=
path
.
join
(
dir
,
f
);
if
(
onlyDirectories
)
{
if
(
fs
.
statSync
(
complete_path
).
isDirectory
())
{
result
.
push
(
f
);
}
}
else
{
if
(
fs
.
statSync
(
complete_path
).
isFile
())
{
result
.
push
(
f
);
}
}
}
catch
(
fs_error
)
{}
});
callback
(
result
);
});
}
utils
=
{
check_data_distribution
:
function
(
data
)
{
return
__check_data_distribution
(
data
)
...
...
@@ -44,6 +71,9 @@ utils = {
get_file_path
:
function
(
data
)
{
return
__get_file_path
(
data
)
},
get_files_list
:
function
(
dir
,
onlyDirectories
,
callback
)
{
return
__get_files_list
(
dir
,
onlyDirectories
,
callback
)
}
}
module
.
exports
=
utils
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment