diff --git a/.gitignore b/.gitignore index dd9a1094d..a572103b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -.gradle \ No newline at end of file +dist +.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..cabd84dad --- /dev/null +++ b/build.gradle @@ -0,0 +1,42 @@ +// This application is built in node.js, and there is a plugin for it in Gradle that does +// a lot of the work for us as far as dealing with node.js builds. We're calling in that +// plugin here +plugins { + id "com.moowork.node" version "1.2.0" +} + +// We've also got to confgure the plugin a little bit. This line will instruct the node plugin +// to download and install node.js and npm locally, for this particular project. It ensures that +// those are installed during the build, but not system-wide, just within this directory. +node { + download = true +} + +// Whenever we call the build task (it's a task called build) which will run any and all +// other tasks that are required to actually call the build "built." +task build + +task zip(type: Zip) { + from ('.') { + include "*" + include "bin/**" + include "data/**" + include "node_modules/**" + include "public/**" + include "routes/**" + include "views/**" + } + destinationDir(file("dist")) + baseName "trainSchedule" + } + + build.dependsOn zip + zip.dependsOn npm_build + + +// All we need to do, in order for this build to actually run, is to call some of the tasks +// built in to the node.js and npm plugins. We're going to call them here. +build.dependsOn npm_build +npm_build.dependsOn npmInstall +npm_build.dependsOn npm_test +npm_test.dependsOn npmInstall diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..e080ed02f --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user guide at https://docs.gradle.org/4.6/userguide/multi_project_builds.html + */ + +rootProject.name = 'cicd-pipeline-train-schedule-gradle' diff --git a/views/index.jade b/views/index.jade index 6e6be7155..a4525aefe 100644 --- a/views/index.jade +++ b/views/index.jade @@ -10,4 +10,4 @@ block content #trainInfo strong #trainSchedule - strong Select a train to view its current schedule. \ No newline at end of file + strong Select a train to view its current schedule.