diff --git a/.gitignore b/.gitignore index dd9a1094d..2b3ae0230 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -.gradle \ No newline at end of file +.gradle +dist diff --git a/README.md b/README.md index 79dbbf406..70fa8de4b 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ This is a simple train schedule app written using nodejs. It is intended to be u ## Running the app -It is not necessary to run this app locally in order to complete the learning activities, but if you wish to do so you will need a local installation of npm. Begin by installing the npm dependencies with: +You need a Java JDK 7 or later to run the build. You can run the build like this: - npm install + ./gradlew build -Then, you can run the app with: +You can run the app with: - npm start + ./gradlew npm_start Once it is running, you can access it in a browser at [http://localhost:3000](http://localhost:3000) \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..70ff983cb --- /dev/null +++ b/build.gradle @@ -0,0 +1,33 @@ +plugins { + //inlude the nodeJS plugin to execute nodejs and npm tasks + id "com.moowork.node" version "1.2.0" +} + +node { + download = true +} + +//declare a build task +task build + +//declare a task to create a zip of the app +task zip(type: Zip) { + from ('.') { + include "*" + include "bin/**" + include "data/**" + include "node_modules/**" + include "public/**" + include "routes/**" + include "views/**" + } + destinationDir(file("dist")) + baseName "trainSchedule" +} + +//declare task dependencies +build.dependsOn zip +zip.dependsOn npm_build +npm_build.dependsOn npm_test +npm_test.dependsOn npmInstall +npm_build.dependsOn npmInstall \ No newline at end of file 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..0bb42d398 100644 --- a/views/index.jade +++ b/views/index.jade @@ -1,7 +1,7 @@ extends layout block content - h1 Find your train! + h1 Find your train and book your tickets! p Select your train below to see its current schedule. #wrapper #trainList