Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging for the customize task #3563

Merged
merged 2 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions build/customize-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,23 @@
doShowVersions()
doCustomize(false);
doGenerateIndexHtml(true);
console.log('Finished applying customizations')
cb();
});

// Apply defaults instead of any customizations that are available in custom-src
gulp.task('customize-default', function (cb) {
doCustomize(true);
doGenerateIndexHtml(false);
console.log('Finished applying default customizations')
cb();
});

// Remove all customizations (removes all symlinks as if customize had not been run)
gulp.task('customize-reset', function (cb) {
doCustomize(true, true);
doGenerateIndexHtml(false);
console.log('Finished resetting customizations')
cb();
});

Expand Down Expand Up @@ -112,6 +115,7 @@

if (!reset) {
fs.symlinkSync(srcFile, destFile);
console.log(' + Linking file : ' + srcFile + ' ==> ' + destFile);
}
})

Expand All @@ -133,20 +137,18 @@
}
if (!reset && fs.existsSync(srcFolder)) {
fs.symlinkSync(srcFolder, destFolder);
console.log(' + Linking folder : ' + srcFolder + ' ==> ' + destFolder);
}
});
}

// Copy the correct custom module to either import the supplied custom module or provide an empty module
function doCustomizeCreateModule(forceDefaults, reset, customConfig, baseFolder, customBaseFolder) {
const defaultSrcFolder = path.resolve(__dirname, '../src/frontend/packages/core/misc/custom');
console.log(baseFolder);
const destFile = path.join(baseFolder, 'src/custom-import.module.ts');
const customModuleFile = path.join(baseFolder, 'src/custom/custom.module.ts');
const customRoutingModuleFile = path.join(baseFolder, 'src/custom/custom-routing.module.ts');

console.log(customModuleFile);

// Delete the existing file if it exists
if (fs.existsSync(destFile)) {
fs.unlinkSync(destFile)
Expand All @@ -158,9 +160,15 @@
srcFile = 'custom-src.module.ts_';
if (fs.existsSync(customRoutingModuleFile)) {
srcFile = 'custom-src-routing.module.ts_';
console.log(' + Found custom module with routing');
} else {
console.log(' + Found custom module without routing');
}
} else {
console.log(' + No custom module found - linking empty custom module');
}
fs.copySync(path.join(defaultSrcFolder, srcFile), destFile);
console.log(' + Copying file : ' + path.join(defaultSrcFolder, srcFile) + ' ==> ' + destFile);
}
}

Expand Down Expand Up @@ -208,6 +216,8 @@

// Generate index.html from template
function doGenerateIndexHtml(customize) {

console.log(' + Generating index.html');
// Copy the default
fs.copySync(INDEX_TEMPLATE, INDEX_HTML);

Expand All @@ -223,6 +233,10 @@
}
}

if (metadata.title) {
console.log(' + Overridding title to: "' + metadata.title + '"');
}

// Patch different page title if there is one
var title = metadata.title || 'Stratos';
replace.sync({ files: INDEX_HTML, from: /@@TITLE@@/g, to: title });
Expand All @@ -236,6 +250,7 @@

if (fs.existsSync(GIT_METADATA)) {
gitMetadata = JSON.parse(fs.readFileSync(GIT_METADATA));
console.log(" + Project Metadata: " + JSON.stringify(gitMetadata));
}

// Git Information
Expand Down Expand Up @@ -273,4 +288,4 @@
}
}

})();
})();
7 changes: 2 additions & 5 deletions deploy/Dockerfile.all-in-one
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Docker build for all-in-one Stratos
FROM splatform/stratos-aio-base:opensuse as builder

COPY --chown=stratos:users *.json ./
COPY --chown=stratos:users gulpfile.js ./
COPY --chown=stratos:users src ./src
COPY --chown=stratos:users build ./build/
# Ensure that we copy the custom-src folder
COPY --chown=stratos:users . ./
COPY --chown=stratos:users deploy/tools/generate_cert.sh generate_cert.sh
COPY --chown=stratos:users deploy/db deploy/db
COPY --chown=stratos:users deploy/all-in-one/config.all-in-one.properties config.properties

RUN npm install \
Expand Down