mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
Merge remote-tracking branch 'upstream/master' into feature_xpath
This commit is contained in:
commit
5c92e49d5d
12 changed files with 116 additions and 57 deletions
41
Gruntfile.js
41
Gruntfile.js
|
@ -9,7 +9,8 @@ module.exports = function(grunt) {
|
|||
|
||||
grunt.registerTask("prod",
|
||||
"Creates a production-ready build. Use the --msg flag to add a compile message.",
|
||||
["jshint", "exec:stats", "clean", "jsdoc", "concat", "copy", "cssmin", "uglify:prod", "inline", "htmlmin", "chmod"]);
|
||||
["jshint", "exec:stats", "clean", "jsdoc", "concat", "copy:html_dev", "copy:html_prod", "copy:html_inline",
|
||||
"copy:static_dev", "copy:static_prod", "cssmin", "uglify:prod", "inline", "htmlmin", "chmod"]);
|
||||
|
||||
grunt.registerTask("docs",
|
||||
"Compiles documentation in the /docs directory.",
|
||||
|
@ -18,6 +19,10 @@ module.exports = function(grunt) {
|
|||
grunt.registerTask("stats",
|
||||
"Provides statistics about the code base such as how many lines there are as well as details of file sizes before and after compression.",
|
||||
["concat:js", "uglify:prod", "exec:stats", "exec:repo_size", "exec:display_stats"]);
|
||||
|
||||
grunt.registerTask("release",
|
||||
"Prepares and deploys a production version of CyberChef to the gh-pages branch.",
|
||||
["copy:gh_pages", "exec:deploy_gh_pages"]);
|
||||
|
||||
grunt.registerTask("default",
|
||||
"Lints the code base and shows stats",
|
||||
|
@ -259,7 +264,7 @@ module.exports = function(grunt) {
|
|||
process: function(content, srcpath) {
|
||||
// TODO: Do all this in Jade
|
||||
content = content.replace(
|
||||
'<a href="cyberchef.htm" style="float: left; margin-left: 10px; margin-right: 80px;" download>Download CyberChef<img src="images/cloud_computing_download-plain-24x24.png" /></a>',
|
||||
'<a href="cyberchef.htm" style="float: left; margin-left: 10px; margin-right: 80px;" download>Download CyberChef<img src="images/download-24x24.png" /></a>',
|
||||
'<span style="float: left; margin-left: 10px;">Compile time: ' + grunt.template.today("dd/mm/yyyy HH:MM:ss") + ' UTC</span>');
|
||||
return grunt.template.process(content, template_options);
|
||||
}
|
||||
|
@ -275,7 +280,8 @@ module.exports = function(grunt) {
|
|||
src: [
|
||||
"**/*",
|
||||
"**/.*",
|
||||
"!stats.txt"
|
||||
"!stats.txt",
|
||||
"!ga.html"
|
||||
],
|
||||
dest: "build/dev/"
|
||||
}
|
||||
|
@ -289,11 +295,24 @@ module.exports = function(grunt) {
|
|||
src: [
|
||||
"**/*",
|
||||
"**/.*",
|
||||
"!stats.txt"
|
||||
"!stats.txt",
|
||||
"!ga.html"
|
||||
],
|
||||
dest: "build/prod/"
|
||||
}
|
||||
]
|
||||
},
|
||||
gh_pages: {
|
||||
options: {
|
||||
process: function(content, srcpath) {
|
||||
// Add Google Analytics code to index.html
|
||||
content = content.replace("</body></html>",
|
||||
grunt.file.read("src/static/ga.html") + "</body></html>");
|
||||
return grunt.template.process(content, template_options);
|
||||
}
|
||||
},
|
||||
src: "build/prod/index.html",
|
||||
dest: "build/prod/index.html"
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
|
@ -424,6 +443,16 @@ module.exports = function(grunt) {
|
|||
clean_git: {
|
||||
command: "git gc --prune=now --aggressive"
|
||||
},
|
||||
deploy_gh_pages: {
|
||||
command: [
|
||||
"git add build/prod/index.html -v",
|
||||
"COMMIT_HASH=$(git rev-parse HEAD)",
|
||||
"git commit -m \"GitHub Pages release for ${COMMIT_HASH}\"",
|
||||
"git push origin `git subtree split --prefix build/prod master`:gh-pages --force",
|
||||
"git reset HEAD~",
|
||||
"git checkout build/prod/index.html"
|
||||
].join(";")
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
css: {
|
||||
|
@ -432,7 +461,7 @@ module.exports = function(grunt) {
|
|||
},
|
||||
js: {
|
||||
files: "src/js/**/*.js",
|
||||
tasks: ["concat:js_all", "chmod:build"]
|
||||
tasks: ["concat:js", "chmod:build"]
|
||||
},
|
||||
html: {
|
||||
files: "src/html/**/*.html",
|
||||
|
@ -444,7 +473,7 @@ module.exports = function(grunt) {
|
|||
},
|
||||
grunt: {
|
||||
files: "Gruntfile.js",
|
||||
tasks: ["clean:dev", "concat:css", "concat:js_all", "copy:html_dev", "copy:static_dev", "chmod:build"]
|
||||
tasks: ["clean:dev", "concat:css", "concat:js", "copy:html_dev", "copy:static_dev", "chmod:build"]
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue