diff --git a/Makefile b/Makefile index 719a645..b52d1a2 100644 --- a/Makefile +++ b/Makefile @@ -36,10 +36,10 @@ $(DIST_DIR): verify: @echo "Verify disabled" -serve: clean +serve: clean $(DIST_DIR) @docker-compose up --build --force-recreate serve -shell: +shell: $(DIST_DIR) @docker-compose up --build --force-recreate -d wait @docker-compose exec --user root wait sh diff --git a/assets/scripts/revealjs-plugins-config.js b/assets/scripts/revealjs-plugins-config.js new file mode 100644 index 0000000..cbb0bd0 --- /dev/null +++ b/assets/scripts/revealjs-plugins-config.js @@ -0,0 +1,14 @@ + +/* tslint:disable */ +/* eslint:disable */ + +menu: { + side: 'left', +}, +toolbar: { + fullscreen: true, + overview: false, // Buggy: make the toolbar disapear + notes: false, // Too low value to show this + help: true, + pause: true, +}, diff --git a/content/attributes.adoc b/content/attributes.adoc index 7e2c701..22ab535 100644 --- a/content/attributes.adoc +++ b/content/attributes.adoc @@ -18,9 +18,5 @@ :highlightjs-main-theme: github :highlightjs-theme: {revealjsdir}/plugin/highlight/styles/{highlightjs-main-theme}.min.css :invert: state=invert,background-color="white" -// Enable font awesome, and use it from local resources (instead of CDN) -:icons: font :stylesdir: styles -:iconfont-remote!: -:iconfont-name: font-awesome.min :notitle: true diff --git a/content/images/crowded-brussels.jpg b/content/images/crowded-brussels.jpg new file mode 100644 index 0000000..075b562 Binary files /dev/null and b/content/images/crowded-brussels.jpg differ diff --git a/content/images/damien-duportal-2.jpg b/content/images/damien-duportal-2.jpg new file mode 100755 index 0000000..ff804fa Binary files /dev/null and b/content/images/damien-duportal-2.jpg differ diff --git a/content/images/damien.jpg b/content/images/damien.jpg deleted file mode 100644 index f7cf115..0000000 Binary files a/content/images/damien.jpg and /dev/null differ diff --git a/content/images/gdg-lille.png b/content/images/gdg-lille.png deleted file mode 100644 index 3f1adfd..0000000 Binary files a/content/images/gdg-lille.png and /dev/null differ diff --git a/content/images/le-gouteur.jpg b/content/images/le-gouteur.jpg deleted file mode 100644 index cf6d1a3..0000000 Binary files a/content/images/le-gouteur.jpg and /dev/null differ diff --git a/content/images/man-in-the-middle-mitm-attack.png b/content/images/man-in-the-middle-mitm-attack.png new file mode 100644 index 0000000..c05b1b3 Binary files /dev/null and b/content/images/man-in-the-middle-mitm-attack.png differ diff --git a/content/images/mfa_workflow.png b/content/images/mfa_workflow.png new file mode 100644 index 0000000..5f2d160 Binary files /dev/null and b/content/images/mfa_workflow.png differ diff --git a/content/images/stuxnet.jpg b/content/images/stuxnet.jpg new file mode 100644 index 0000000..24d77c0 Binary files /dev/null and b/content/images/stuxnet.jpg differ diff --git a/content/images/test-pyramid.png b/content/images/test-pyramid.png deleted file mode 100644 index 76dd67a..0000000 Binary files a/content/images/test-pyramid.png and /dev/null differ diff --git a/content/images/traefikee-architecture-gray-bg.png b/content/images/traefikee-architecture-gray-bg.png deleted file mode 100755 index e0bb185..0000000 Binary files a/content/images/traefikee-architecture-gray-bg.png and /dev/null differ diff --git a/content/images/usb-stick.png b/content/images/usb-stick.png new file mode 100644 index 0000000..22bc793 Binary files /dev/null and b/content/images/usb-stick.png differ diff --git a/content/images/windows-update.png b/content/images/windows-update.png new file mode 100644 index 0000000..f7347f4 Binary files /dev/null and b/content/images/windows-update.png differ diff --git a/content/images/yubikey.jpg b/content/images/yubikey.jpg new file mode 100644 index 0000000..54ee39e Binary files /dev/null and b/content/images/yubikey.jpg differ diff --git a/content/includes/bout-en-bout.adoc b/content/includes/bout-en-bout.adoc deleted file mode 100644 index e1316f7..0000000 --- a/content/includes/bout-en-bout.adoc +++ /dev/null @@ -1,45 +0,0 @@ - -= Tests de bout en bout: Kezako ? - -== Tests de bout en bout - -* Objet: tester des scénarios d'utilisation de l'application -du point de vue de l'utilisateur final -* Usages: BDD ("Behaviour Driven Development") et non régression - -== Pyramide des tests - -image::test-pyramid.png[] - -== Problématiques des test bout en bout - -* Complexité -* Lents à exécuter -* Facilement Non-Déterministes (irrégularités) -* Arrivent tard dans le pipeline - -== Bonne pratiques - -* Usage orienté "régression" -* Maniaque sur la qualité -* Lors de l'apparition d'un échec de test: - - Mettre en exergue le bug au niveau de test unitaire - - Corriger le problème -* Voir le "bout en bout" comme une seconde ligne ("Nice to have") - -== Vous ne pouvez pas éviter - -* Les automates à états finis - - "Retries", breaking pattern -* L'asynchronisme -* La sécurisation des crédentials - - Tokens - - Système externes -* La frustration d'un test à mettre en quarantaine - -== Bibliographie - -* (EN) https://martinfowler.com/bliki/BroadStackTest.html[] -* (EN) https://www.softwaretestinghelp.com/what-is-end-to-end-testing/[] -* (FR) https://blog.testingdigital.com/quest-test-de-bout-bout-end-to-end-1288[] -* (FR) http://douche.name/blog/nomenclature-des-tests-logiciels/[] diff --git a/content/includes/tester-app.adoc b/content/includes/tester-app.adoc deleted file mode 100644 index 163c666..0000000 --- a/content/includes/tester-app.adoc +++ /dev/null @@ -1,48 +0,0 @@ - -= Tester une application complexe - -[%notitle] -== Traefik Enteprise Edition - -image::traefikee-architecture-gray-bg.png[background, size=cover] - -== KinD - -* Kubernetes in Docker : link:https://kind.sigs.k8s.io/[KinD] -** SIG Kubernetes - -* "New kid in town": k3s, de rancher -link:https://github.com/rancher/k3s[k3s sur icon:github[]] -** Très rapide ! - -== SinD - -* Swarm in Docker: link:https://github.com/jlevesy/go-sind[SinD sur icon:github[]] -** Un cluster swarm isolé en ~3-4s -** On travaille sur du "DockerEE in Docker"! - -== Isolation - -* Docker in Docker in Docker - -* Niveau 1: Docker non controlable -* Niveau 2: Docker "externe" pour isoler les tests -* Niveau 3: Les Docker (ou runc/cri-o) des clusters Swarm / Kubernetes - -== Performances - -* Pratique de Production: contrôle des ressources (CPU/Mémoire) -** Déterminisme des comportements lors de la parallélisation -** Permet de détecter les race conditions plus facilement - -* Mais à un moment, contention système -** Seule solution : `$$$` - -== Conclusion - -* Un framework complet: "batman" (sera peut être ouvert?) -* Adoption rapide -* Difficultées avec le shell -** SHELLCHECK -** Passation de connaissance -* Attention à ne pas faire QUE du bout en bout diff --git a/content/includes/tester-cli.adoc b/content/includes/tester-cli.adoc deleted file mode 100644 index e180fa7..0000000 --- a/content/includes/tester-cli.adoc +++ /dev/null @@ -1,133 +0,0 @@ - -= Tester une CLI - -== Problématique - -* Je fournis une CLI avec un `README` -* Comment s'assurer que la documentation: -** Est à jour ? -** Est fonctionnelle ? - -== Idée - -* Test "E2E" pour jouer les scénarios écrits (ref. Asciidoctor) -* Jouer une command == automatiser du shell - -== bats - -[quote] -__ -Bats is a TAP-compliant testing framework for Bash. It provides a simple way to verify that the UNIX programs you write behave as expected. -__ - -link:https://github.com/sstephenson/bats[bats on icon:github[]] - -== Exemple - -[source,bash] ----- -#!/usr/bin/env bats -# Fichier "test-docker.bats" - -@test "Binary docker is on the current PATH" { - command -v docker -} - -DOCKER_VERSION=18.09.3 -@test "docker version is ${DOCKER_VERSION}" { - docker -v | grep "${DOCKER_VERSION}" -} ----- - -== Execution - -[source,bash] ----- -$ bats test-docker.bats - ✓ Binary docker is on the current PATH - ✓ docker version is 18.09.3 - -2 tests, 0 failures ----- - -== TAP: Test Anything Protocol - -* Bats permet d'exporter en format link:http://testanything.org/[TAP] -** Parsable par une machine -** Vient du monde Perl, mais beaucoup de modules - -[source,bash] ----- -bats --tap addition.bats -1..2 -ok 1 Binary docker is on the current PATH -ok 2 docker version is 18.09.3 ----- - -== Facilitées : run - -* `run ` pour tester le exit code ou l'output - -[source,bash] ----- -@test "ls sur un fichier non existant a une erreur 1" { - run ls -l /nonexistent_filename - [ "$status" -eq 1 ] - [ "$output" = "ls: /nonexistent_filename: No such file or directory" ] -} ----- - -== Facilitées : load - -* `load custom_helper` pour réutiliser du code - -[source,bash] ----- -#!/bin/bash -# fichier "custom_helper.bash" - -say_hello() { - echo "Hello" -} ----- - -[source,bash] ----- -#!/bin/bats -load custom_helper - -@test "Dire bonjour" { - say_hello -} ----- - -== Facilitées : Hooks - -* `setup()` et `teardown()` sont exécutés (respectivement) avant et après chaque test - -[source,bash] ----- -setup() { - eval $(minikube env) -} -teardown() { - unset DOCKER_HOST -} - -@test "docker avec minikube" { - # setup has been run - docker ps # Using minikube - # teardown will be run -} ----- - -== Facilitées : Variables - - -* `$BATS_TEST_FILENAME` -* `$BATS_TEST_DIRNAME` -* `$BATS_TEST_NAMES` -* `$BATS_TEST_NAME` -* `$BATS_TEST_DESCRIPTION` -* `$BATS_TEST_NUMBER` -* `$BATS_TMPDIR` diff --git a/content/includes/tester-containeurs.adoc b/content/includes/tester-containeurs.adoc deleted file mode 100644 index 4614146..0000000 --- a/content/includes/tester-containeurs.adoc +++ /dev/null @@ -1,106 +0,0 @@ - -= Tester des containeurs / images - -== bats pour les containeurs - -* Exemple avec -link:https://github.com/jenkinsci/docker/blob/master/tests/runtime.bats[l'image Docker Jenkins] - -[source,bash] ----- -#!/usr/bin/env bats -load 'test_helper/bats-support/load' -load 'test_helper/bats-assert/load' -load test_helpers - -... - -@test "create test container" { - docker run -d -e JAVA_OPTS="-Duser.timezone=Europe/Madrid -Dhudson.model.DirectoryBrowserSupport.CSP=\"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';\"" --name $SUT_CONTAINER -P $SUT_IMAGE -} - -@test "test container is running" { - sleep 1 # give time to eventually fail to initialize - retry 3 1 assert "true" docker inspect -f {{.State.Running}} $SUT_CONTAINER -} ----- - -== Problèmes avec bats - -* Dernier commit : 19 février 2016... -* Erreurs difficile à comprendre -* Shell -* Installation - -== Communauté - -* Fork : link:https://github.com/bats-core/bats-core[] -** Communauté plus disponible (vs. 1 maintainer) -** Documentation améliorée -** Installation avec npm, brew, etc. - -* Helper Libraries : link:https://github.com/ztombol/bats-docs[] -** Facilite certaines manipulation en shell -** Propose des assertions, améliorant de fait les erreurs outputs - -== Packaging - -* Objectif : Packager de manière portable - -* Dénominateur commun : `npm` -** Windows ? Sécurité ? - -* Solution : Fournir `bats` dans un containeur Docker -** Les "helpers" librairies, CLIs et configurations sont des dépendances fixées - -== Gouter sa propre nourriture - -image::le-gouteur.jpg[] - -Testons l'image Docker bats ... avec bats! - -== Docker Multi-Stage - -[source,Dockerfile] ----- -FROM node:alpine as dependencies-solver -COPY package*.json /bats/ -WORKDIR /bats -RUN npm install - -FROM alpine:3.9 -ENV BATS_HELPERS_DIR=/opt/bats-helpers -COPY --from=dependencies-solver /bats/node_modules/bats /opt/bats -COPY --from=dependencies-solver /bats/node_modules/bats-support /opt/bats-helpers/bats-support -COPY --from=dependencies-solver /bats/node_modules/bats-file /opt/bats-helpers/bats-file -COPY --from=dependencies-solver /bats/node_modules/bats-assert /opt/bats-helpers/bats-assert -RUN apk add --no-cache bash -WORKDIR /tests -ENTRYPOINT ["/sbin/bats"] -CMD ["-v"] ----- - -== Self-Testing - -[source,bash] ----- -# docker_helper.bash -... -run_command_with_docker() { - docker run --rm -t ${CUSTOM_DOCKER_RUN_OPTS} \ - "${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" "$@" -} - -# test.bats -loader docker_helper - -@test "With no cmd/args, the image return Bats version" { - run_command_with_docker "bats -v" | grep "Bats" | grep "${BATS_VERSION}" -} ----- - -== Résultat - -* Facilite la contribution : exemple sur link:https://github.com/asciidoctor/docker-asciidoctor[l'image Docker de Asciidoctor] -* "Documentation" automatisée -* Meilleure processus de pensée pour élaborer les changements à plusieurs diff --git a/content/index.adoc b/content/index.adoc index 3bb9d57..f0abd94 100644 --- a/content/index.adoc +++ b/content/index.adoc @@ -1,72 +1,184 @@ -[%notitle] -= Tests de bout en bout en shell avec “bats”, pour CLI, containers et clusters + + += Sécurité dans le Numérique include::./attributes.adoc[] +[.small] +Présentation disponible à l’adresse: {presentationUrl}[{presentationUrl}] + +image::qrcode.png["QRCode to this presentation",height=150] + +[.small] +Présentation disponible en PDF: {presentationUrl}/slides.pdf[{presentationUrl}/slides.pdf] + [{invert}] -== Tests de bout en bout en shell avec “bats” +== Damien DUPORTAL -pour CLI, containers et clusters +// image::damien-duportal-2.jpg[height=200, align=left] +* Freelancer +* Consultant @ link:https://www.ovh.com/fr/[OVHCloud] -image::gdg-lille.png["GDG Lille",height=300] +* Me contacter : +** ++++++ damien.duportal+pro gmail.com +** link:https://www.linkedin.com/in/damien-duportal-ab70b524/[++++++ Damien Duportal,window=_blank] +** link:https://twitter.com/DamienDuportal[++++++ @DamienDuportal,window=_blank] -[.small] -Présentation disponible à l’URL: {presentationUrl}[{presentationUrl}] -== Comment utiliser cette présentation ? +== Au Menu -* Pour naviguer, utilisez les flèches en bas à droite (ou celles de votre clavier) -** Gauche/Droite: changer de chapitre -** Haut/Bas: naviguer dans un chapitre -* Pour avoir une vue globale : utiliser la touche "kbd:[o]" (pour "*Overview*") -* Pour voir les notes de l'auteur : utilisez la touche "kbd:[s]" (pour "*Speaker* notes") +1. Enjeux de la sécurité numérique +2. Un tour d'horizon des différents menaces +3. Comment se protéger ? -// //// Speaker Slide and Company slide -[{invert}] -== Whoami +== Enjeux de la sécurité numérique + +== Transformation Numérique +// Enjeux de la sécurité numérique +* Tout le monde fait sa transformation numérique... +* Même les organisations criminelles ! + +== Coût de la Cybercriminalité +// Enjeux de la sécurité numérique + +* 2014 en 🇧🇪 : **3,5 Milliards 💶** +* 2014 -> 2017 dans le 🌎 : **~380 Milliards -> 510 Milliards 💶** +* 2017 en 🇧🇪 : **4%** des cas - **>= 10 000 💶** par attaque +* 2020: Covid-19... + +== Pourquoi Moi ? +// Enjeux de la sécurité numérique + +* 2018 -> 2019 en 🇧🇪: **+30%** de plaintes +* 2019 en 🇧🇪 : +** **2/3** des entreprises +** Domaines touchés variés, de la startup aux hopitaux... +* Facilité des piratages, industrialisation à grande échelle + + +== Impacts + +* Sites inaccessibles +* Systèmes inopérants +* Données perdues +* Données volées +* Sites "défacées" + +== Conséquences + +* Perte d'activité ❌ et de chiffre d'affaire 💸 +* Image de marque 🌧 +* Intelligence et espionnage économiques 🕵️‍♂️ +* Responsabilité pénale ⚖️ + +== Un tour d'horizon des différents menaces + +== Rançongiciel + +(aka. "Ransomware") + +- Un programme malveillant ☠️ sur vos ordinateurs/serveurs 🖥 +- Chiffre les données ou bloque le système 🚪 +- Déchiffrement ou déblocage contre paiement d'une rançon 💸 + + +== Chantage -* Damien DUPORTAL: -** link:https://traefik.io/[Træfik,window=_blank]'s Developer 🥑 Advocate @ -link:https://containo.us/[Containous,window=_blank] and Freelancer -** Former Training Engineer @ CloudBees +- Variante du Rançongiciel +- Vol des informations **personnelles** ou **confidentielles** 👀 +- Chantage à la publication 💸 -* link:https://twitter.com/DamienDuportal[icon:twitter[] @DamienDuportal,window=_blank] -* link:https://github.com/dduportal[icon:github[] dduportal,window=_blank] +== Déni de service -image::damien.jpg[height=200] -// //// end of Speaker Slide and Company slide +(aka. "DDos") -== Menu +image::crowded-brussels.jpg[width=300] -* Tester une CLI +- Surcharge de site par envoi de millions de requêtes -* Tester des containeurs +== Hameçonnage -* Tests de bout en bout: Kezako ? +(aka. "Pishing") -* Tester une application complexe +- Un email ou SMS invite à s'identifier et/ou payer sur un site 🔏 +- Ledit site est une (+ ou - bonne) copie de l'original 👯‍♂️ +- But: usurpation d'identité 💳 ou vol d'information bancaires 💸 -:leveloffset: +1 +== "Homme Au Milieu" -// = Tester une CLI -include::./includes/tester-cli.adoc[] +(aka. "Man in the Middle") -// = Tester des containeurs -include::./includes/tester-containeurs.adoc[] +image::man-in-the-middle-mitm-attack.png[] -// = Tests de bout en bout: Kezako ? -include::./includes/bout-en-bout.adoc[] +== Comment se protéger ? -// = Tester une application complexe -include::./includes/tester-app.adoc[] +== Pas de protection absolue ! -:leveloffset: -1 +== ! + +image::usb-stick.png[width=400] + +== ! + +image::stuxnet.jpg[background, size=cover] + +== Evaluer la menace et les réponses + +- Menaces Extérieures ? Intérieures ? +- Risques pour chaque attaque ? + +== Demander de l'aide + +CERT (Federal Cyber Emergency Team): + +https://cert.be/fr[] + +== Restez à jour ! + +image::windows-update.png[] + +== Mots de Passes + +- Complexité et rotations + +image::https://imgs.xkcd.com/comics/password_strength.png[width=600] + +[.small] +https://imgs.xkcd.com/comics/password_strength.png[] + +== Authentification Multi Facteurs + +(aka. "MFA" ou "2FA") + +image::mfa_workflow.png[width=400] + +image::yubikey.jpg[width=300] + +== Protégez et Formez + +- Protégez vous +- Protégez vos employés et partenaires +- Pour mieux protéger vos clients et vos intérêts + +== GDPR + +Guerre économique : 🇪🇺 vs. 🇺🇸 vs. 🇨🇳 vs. 🇷🇺 + +== Sources + +- https://www.accenture.com/fr-fr/insight-cost-of-cybercrime-2017 +- https://www.feb.be/domaines-daction/securite--bien-etre-au-travail/securite-des-entreprises/le-cout-du-cybercrime-en-belgique_2017-12-13/ +- https://www.bdo.be/fr-be/actualites/2019/les-fraudes-coutent-en-moyenne-200%E2%80%89000-euros-aux-entreprises-belges +- https://www.imperva.com/learn/application-security/man-in-the-middle-attack-mitm/ +- https://www.alphorm.com/tutoriel/formation-en-ligne-scada-cybersecurite-des-systemes-industriels/tuto-video-retours-sur-experience-le-malware-stuxnet [{invert}] == Merci ! -link:https://twitter.com/DamienDuportal[icon:twitter[] @DamienDuportal] +++++++ damien.duportal+pro gmail.com + +link:https://twitter.com/DamienDuportal[++++++ @DamienDuportal,window=_blank] -link:https://github.com/dduportal[icon:github[] dduportal] +link:https://www.linkedin.com/in/damien-duportal-ab70b524/[++++++ Damien Duportal,window=_blank] [.small] link:{presentationUrl}[Slides: {presentationUrl}] @@ -74,4 +186,4 @@ link:{presentationUrl}[Slides: {presentationUrl}] image::qrcode.png["QRCode to this presentation",height=150] [.small] -link:{repositoryUrl}[Source on icon:github[]: {repositoryUrl}] +link:{repositoryUrl}[Source on ++++++: {repositoryUrl}] diff --git a/gulp/gulpfile.js b/gulp/gulpfile.js index 5c622ab..b1d3ad2 100644 --- a/gulp/gulpfile.js +++ b/gulp/gulpfile.js @@ -22,6 +22,7 @@ var tasks_dir_path = './tasks', docinfosPath: '/app/content/docinfos', imgSrcPath: '/app/content/images', videosSrcPath: '/app/content/videos', + scriptsSrcPath: '/app/assets/scripts', stylesSrcPath: '/app/assets/styles', fontSrcPath: '/app/assets/fonts', faviconPath: '/app/content/favicon.ico', @@ -31,6 +32,8 @@ var tasks_dir_path = './tasks', listen_ip: process.env.LISTEN_IP || '0.0.0.0', listen_port: process.env.LISTEN_PORT || 8000, livereload_port: process.env.LIVERELOAD_PORT || 35729, + revealjsPlugins: ["reveal.js-menu","reveal.js-toolbar"], + revealJSPluginListFile: '/tmp/revealjs-plugins-list.js', }; plugins.asciidoctorRevealjs.register(); @@ -49,6 +52,7 @@ gulp.task('build', gulp.series( 'prepare:revealjs', 'prepare:highlightjs', 'prepare:fontawesome', + 'prepare:revealjs-plugins', 'styles' ), 'html' diff --git a/gulp/tasks/html-slides.js b/gulp/tasks/html-slides.js index a0b5d65..5140d7f 100644 --- a/gulp/tasks/html-slides.js +++ b/gulp/tasks/html-slides.js @@ -15,6 +15,8 @@ module.exports = function (gulp, plugins, current_config) { 'docinfosPath': current_config.docinfosPath, 'presentationUrl': process.env.PRESENTATION_URL, 'repositoryUrl': process.env.REPOSITORY_URL, + 'revealjs_plugins': current_config.revealJSPluginListFile, + 'revealjs_plugins_configuration': current_config.scriptsSrcPath + '/revealjs-plugins-config.js' }, to_dir: current_config.distDir, } diff --git a/gulp/tasks/prepare-dependencies.js b/gulp/tasks/prepare-dependencies.js index e9e8653..054181f 100644 --- a/gulp/tasks/prepare-dependencies.js +++ b/gulp/tasks/prepare-dependencies.js @@ -6,6 +6,8 @@ module.exports = function (gulp, plugins, current_config) { revealJsDestDir = current_config.distDir + '/reveal.js', mainRevealCss = gulp.src(baseRevealJSPath + '/css/reveal.css') .pipe(gulp.dest(revealJsDestDir + '/css/')), + resetCss = gulp.src(baseRevealJSPath + '/css/reset.css') + .pipe(gulp.dest(revealJsDestDir + '/css/')), paperCSS = gulp.src(baseRevealJSPath + '/css/print/paper.css') .pipe(gulp.dest(revealJsDestDir + '/css/print')), mainRevealJs = gulp.src(baseRevealJSPath + '/js/reveal.js') @@ -29,7 +31,8 @@ module.exports = function (gulp, plugins, current_config) { notesJs, notesHtml, zoomJs, - markedJs + markedJs, + resetCss ); }); @@ -64,4 +67,34 @@ module.exports = function (gulp, plugins, current_config) { return plugins.mergeStreams(fontAwesomeCss, fontAwesomeFonts); }); + + ////////////////////////////// Managing RevelaJS Menu Plugin and dependencies + gulp.task('prepare:revealjs-plugins', function () { + var revealjsPluginsLoaderContent = '', + revealjsPluginsDirs = []; + + current_config.revealjsPlugins.forEach(function(revealjsPluginName) { + + // Append plugin to the loader list + // Note that revelajs plugins follow a naming convention for the "main" JS file. + revealjsPluginsLoaderContent += + "{ src: 'reveal.js/plugin/" + revealjsPluginName + + "/" + revealjsPluginName.split("-")[1] + ".js'},\n"; + + revealjsPluginsDirs.push(current_config.nodeModulesDir + '/' + revealjsPluginName + '/**/*') + + } ); + + // Write plugin list to file system + plugins.fs.writeFile(current_config.revealJSPluginListFile, revealjsPluginsLoaderContent, function() {}); + + // Copy plugins contents from nodes_modules + return gulp.src( + revealjsPluginsDirs, + { + base: current_config.nodeModulesDir + } + ) + .pipe(gulp.dest(current_config.distDir + '/reveal.js/plugin/')); + }); }; diff --git a/package.json b/package.json index b8d69c5..d77d5c4 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "repository": "https://github.com/dduportal/slides", "dependencies": { "highlight.js": "^10.1.2", - "font-awesome": "^4.7.0" + "font-awesome": "^4.7.0", + "reveal.js-menu": "1.2.0", + "reveal.js-toolbar": "0.2.1" }, "devDependencies": { "asciidoctor": "^2.2.0",