Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Toolchain
sgc
Commits
e7f15903
Commit
e7f15903
authored
Nov 19, 2018
by
Philipp Nowinski
Browse files
[FEATURE] add hooks for custom log messages + parse additional config
file in sgc-scripts
parent
7d5a2c64
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/settings.js
View file @
e7f15903
...
...
@@ -79,12 +79,19 @@ class Settings {
* Returns the sgc-config object
*/
static
parseConfig
()
{
try
{
fs
.
statSync
(
'
./sgc-core/gulp/config.json
'
)
;
return
require
(
'
./config.json
'
)
;
}
catch
(
exception
)
{
return
require
(
'
../../.sgc-config.json
'
);
let
scriptsConfig
;
let
projectConfig
;
let
mergedConfig
;
if
(
fs
.
existsSync
(
'
../sgc-scripts/.sgc-config.json
'
)
)
{
scriptsConfig
=
require
(
'
../../
sgc-scripts/
.sgc-config.json
'
);
}
projectConfig
=
require
(
'
../../.sgc-config.json
'
);
if
(
scriptsConfig
)
{
mergedConfig
=
Object
.
assign
(
projectConfig
,
scriptsConfig
);
}
else
{
mergedConfig
=
projectConfig
;
}
return
mergedConfig
;
}
/**
...
...
core/tasks/images.js
View file @
e7f15903
...
...
@@ -56,6 +56,13 @@ module.exports = class Images extends Task {
}
catch
(
error
)
{
this
.
_handleError
(
error
);
}
if
(
this
.
_config
.
hasOwnProperty
(
'
logMessages
'
)
&&
this
.
_config
.
logMessages
.
hasOwnProperty
(
'
images:uploadedSuccess
'
)
)
{
let
messageConfig
=
this
.
_config
.
logMessages
[
'
images:uploadedSuccess
'
];
this
.
_logger
[
messageConfig
.
level
](
messageConfig
.
message
);
}
this
.
_logger
.
info
(
`Task
${
chalk
.
bold
(
'
images
'
)}
finished after
${
this
.
getElapsed
(
hirestime
.
S
)}
s`
);
resolve
();
});
...
...
@@ -73,6 +80,13 @@ module.exports = class Images extends Task {
}
catch
(
error
)
{
this
.
_handleError
(
error
);
}
if
(
this
.
_config
.
hasOwnProperty
(
'
logMessages
'
)
&&
this
.
_config
.
logMessages
.
hasOwnProperty
(
'
imagesSuccess
'
)
)
{
let
messageConfig
=
this
.
_config
.
logMessages
[
'
imagesSuccess
'
];
this
.
_logger
[
messageConfig
.
level
](
messageConfig
.
message
);
}
this
.
_logger
.
info
(
`Task
${
chalk
.
bold
(
'
images
'
)}
finished after
${
this
.
getElapsed
(
hirestime
.
S
)}
s`
);
resolve
();
});
...
...
Write
Preview
Supports
Markdown
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