From b6a2014270aeca7b2b5ea47bfd673bf1bc0aed05 Mon Sep 17 00:00:00 2001 From: Andrew Butters <23127331+abutters@users.noreply.github.com> Date: Fri, 28 Apr 2023 12:52:06 +0100 Subject: [PATCH] [DL-9447] Upgraded the dependencies for the VAT (MTD) End-to-End Service Guide. --- .gitignore | 53 +- .node-version | 1 + .ruby-version | 2 +- Dockerfile | 17 + Gemfile | 4 - Gemfile.lock | 171 +++---- README.md | 103 ++-- batect | 205 ++++++++ batect.cmd | 473 ++++++++++++++++++ batect.yml | 44 ++ build.sbt | 10 +- conf/application-json-logger.xml | 4 +- conf/application.conf | 20 +- config.rb | 13 +- config/tech-docs.yml | 26 +- project/AppDependencies.scala | 11 +- project/build.properties | 2 +- project/plugins.sbt | 16 +- .../documentation/partials/_give-feedback.erb | 7 + source/stylesheets/give-feedback.css.scss | 37 ++ test/BuildSpec.scala | 20 +- 21 files changed, 1006 insertions(+), 233 deletions(-) create mode 100644 .node-version create mode 100644 Dockerfile create mode 100755 batect create mode 100644 batect.cmd create mode 100644 batect.yml create mode 100644 source/documentation/partials/_give-feedback.erb create mode 100644 source/stylesheets/give-feedback.css.scss diff --git a/.gitignore b/.gitignore index 8ea4dae..45ba642 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,27 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile ~/.gitignore_global -# Ignore bundler config -/.bundle - -# Ignore the build directory -/build - -# Ignore cache -/.sass-cache -/.cache - -# Ignore .DS_store file -.DS_Store - -Staticfile.auth - -/vendor -/public -/target -/project/project -/project/target +logs +project/project +project/target +target +lib_managed +public/ +tmp +.history +dist +/.idea +/*.iml +/*.ipr +/out +/.idea_modules +/.classpath /.project -/logs -.idea -/.bsp \ No newline at end of file +/RUNNING_PID +/.settings +*.iws +node_modules/ +npm-debug.log +yarn-debug.log +yarn-error.log +/vendor +/.batect +/.bsp diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..9c846f9 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +16.11.0 \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index ec1cf33..6ebad14 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.3 +3.1.2 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d072646 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM noonat/rbenv-nodenv + +# Update list of Ruby versions in rbenv +RUN cd ~/.rbenv/plugins/ruby-build && git pull +# Install version of Ruby that we want +COPY .ruby-version /tmp +RUN cd /tmp && rbenv install + +# Update list of Node versions in nodenv +RUN cd ~/.nodenv/plugins/node-build && git pull +# Install version of Node that we want +COPY .node-version /tmp +RUN cd /tmp && nodenv install + +# Make root accessible to other users, this is because the batect tasks run as the current user +# but need access to rbenv and nodenv +RUN chmod +x /root diff --git a/Gemfile b/Gemfile index ed60c86..4d49f07 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,4 @@ gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby] # Include the tech docs gem gem 'govuk_tech_docs' -# Overrride middleman-search with our fork. -# See: https://github.com/manastech/middleman-search/pull/24 -# gem 'middleman-search', git: 'https://github.com/alphagov/middleman-search' - gem 'thin', '~> 1.7.0' diff --git a/Gemfile.lock b/Gemfile.lock index 5890802..1f46078 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,23 @@ GEM remote: https://rubygems.org/ specs: - activesupport (5.2.4.5) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - autoprefixer-rails (9.8.6.5) - execjs - backports (3.20.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) + autoprefixer-rails (10.4.13.0) + execjs (~> 2) + backports (3.24.1) chronic (0.10.2) chunky_png (1.4.0) - coderay (1.1.3) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) - commonmarker (0.21.2) - ruby-enum (~> 0.5) + commonmarker (0.23.9) compass (1.0.3) chunky_png (~> 1.2) compass-core (~> 1.0.2) @@ -32,21 +30,21 @@ GEM sass (>= 3.3.0, < 3.5) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - concurrent-ruby (1.1.8) - contracts (0.13.0) - daemons (1.3.1) - dotenv (2.7.6) - em-websocket (0.5.2) + concurrent-ruby (1.2.2) + contracts (0.17) + daemons (1.4.1) + dotenv (2.8.1) + em-websocket (0.5.3) eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) + http_parser.rb (~> 0) erubis (2.7.0) eventmachine (1.2.7) - execjs (2.7.0) - fast_blank (1.0.0) - fastimage (2.2.2) - ffi (1.14.2) - govuk_tech_docs (2.1.0) - activesupport + execjs (2.8.1) + fast_blank (1.0.1) + fastimage (2.2.6) + ffi (1.15.5) + govuk_tech_docs (3.3.1) + autoprefixer-rails (~> 10.2) chronic (~> 0.10.2) middleman (~> 4.0) middleman-autoprefixer (~> 2.10.0) @@ -56,47 +54,43 @@ GEM middleman-sprockets (~> 4.0.0) middleman-syntax (~> 3.2.0) nokogiri - openapi3_parser (~> 0.5.0) - pry - redcarpet (~> 3.5.0) - sass - sprockets (~> 4.0.0) - haml (5.2.1) + openapi3_parser (~> 0.9.0) + redcarpet (~> 3.5.1) + haml (5.2.2) temple (>= 0.8.0) tilt hamster (3.0.0) concurrent-ruby (~> 1.0) hashie (3.6.0) - http_parser.rb (0.6.0) - i18n (0.9.5) + http_parser.rb (0.8.0) + i18n (1.6.0) concurrent-ruby (~> 1.0) - kramdown (2.3.0) + kramdown (2.4.0) rexml - listen (3.0.8) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) memoist (0.16.2) - method_source (1.0.0) - middleman (4.3.11) + middleman (4.4.3) coffee-script (~> 2.2) - haml (>= 4.0.5) + haml (>= 4.0.5, < 6.0) kramdown (>= 2.3.0) - middleman-cli (= 4.3.11) - middleman-core (= 4.3.11) - middleman-autoprefixer (2.10.1) - autoprefixer-rails (~> 9.1) + middleman-cli (= 4.4.3) + middleman-core (= 4.4.3) + middleman-autoprefixer (2.10.0) + autoprefixer-rails (>= 9.1.4) middleman-core (>= 3.3.3) - middleman-cli (4.3.11) + middleman-cli (4.4.3) thor (>= 0.17.0, < 2.0) middleman-compass (4.0.1) compass (>= 1.0.0, < 2.0.0) middleman-core (>= 4.0.0) - middleman-core (4.3.11) - activesupport (>= 4.2, < 6.0) - addressable (~> 2.3) + middleman-core (4.4.3) + activesupport (>= 6.1, < 7.1) + addressable (~> 2.4) backports (~> 3.6) - bundler - contracts (~> 0.13.0) + bundler (~> 2.0) + contracts (~> 0.13) dotenv erubis execjs (~> 2.0) @@ -104,21 +98,23 @@ GEM fastimage (~> 2.0) hamster (~> 3.0) hashie (~> 3.4) - i18n (~> 0.9.0) - listen (~> 3.0.0) + i18n (~> 1.6.0) + listen (~> 3.0) memoist (~> 0.14) - padrino-helpers (~> 0.13.0) + padrino-helpers (~> 0.15.0) parallel rack (>= 1.4.5, < 3) sassc (~> 2.0) servolux tilt (~> 2.0.9) + toml uglifier (~> 3.0) - middleman-livereload (3.4.6) + webrick + middleman-livereload (3.4.7) em-websocket (~> 0.5.1) middleman-core (>= 3.3) rack-livereload (~> 0.3.15) - middleman-search-gds (0.11.1) + middleman-search-gds (0.11.2) execjs (~> 2.6) middleman-core (>= 3.2) nokogiri (~> 1.6) @@ -128,59 +124,64 @@ GEM middleman-syntax (3.2.0) middleman-core (>= 3.2) rouge (~> 3.2) - mini_portile2 (2.5.0) - minitest (5.14.3) + mini_portile2 (2.8.1) + minitest (5.18.0) multi_json (1.15.0) - nokogiri (1.11.1) - mini_portile2 (~> 2.5.0) + nokogiri (1.14.3) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + nokogiri (1.14.3-arm64-darwin) + racc (~> 1.4) + nokogiri (1.14.3-x86_64-darwin) racc (~> 1.4) - openapi3_parser (0.5.2) + nokogiri (1.14.3-x86_64-linux) + racc (~> 1.4) + openapi3_parser (0.9.2) commonmarker (~> 0.17) - padrino-helpers (0.13.3.4) - i18n (~> 0.6, >= 0.6.7) - padrino-support (= 0.13.3.4) + padrino-helpers (0.15.3) + i18n (>= 0.6.7, < 2) + padrino-support (= 0.15.3) tilt (>= 1.4.1, < 3) - padrino-support (0.13.3.4) - activesupport (>= 3.1) - parallel (1.20.1) - pry (0.14.0) - coderay (~> 1.1) - method_source (~> 1.0) - public_suffix (4.0.6) - racc (1.5.2) - rack (2.2.3) + padrino-support (0.15.3) + parallel (1.23.0) + parslet (2.0.0) + public_suffix (5.0.1) + racc (1.6.2) + rack (2.2.6.4) rack-livereload (0.3.17) rack - rb-fsevent (0.10.4) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.1) - rexml (3.2.4) - rouge (3.26.0) - ruby-enum (0.9.0) - i18n + rexml (3.2.5) + rouge (3.30.0) sass (3.4.25) sassc (2.4.0) ffi (~> 1.9) servolux (0.13.0) - sprockets (4.0.2) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - temple (0.8.2) + rack (>= 2.2.4, < 4) + temple (0.10.0) thin (1.7.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (1.1.0) - thread_safe (0.3.6) - tilt (2.0.10) - tzinfo (1.2.9) - thread_safe (~> 0.1) + thor (1.2.1) + tilt (2.0.11) + toml (0.3.0) + parslet (>= 1.8.0, < 3.0.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uglifier (3.2.0) execjs (>= 0.3.0, < 3) + webrick (1.8.1) PLATFORMS ruby + universal-darwin-19 + x86_64-linux DEPENDENCIES govuk_tech_docs @@ -189,4 +190,4 @@ DEPENDENCIES wdm (~> 0.1.0) BUNDLED WITH - 1.16.6 + 2.3.7 diff --git a/README.md b/README.md index c1f47e4..7943d12 100644 --- a/README.md +++ b/README.md @@ -1,89 +1,78 @@ -# Technical Documentation - Vat Service Guide +# Technical Documentation - VAT (MTD) End-to-End Service Guide -## Getting started +## Overview -To preview or build the website, we need to use the terminal. +This repository contains the source files that are used to generate the [VAT (MTD) end-to-end service guide on the HMRC Developer Hub](https://developer.service.hmrc.gov.uk/guides/vat-mtd-end-to-end-service-guide). -Install Ruby with Rubygems, perferably with a [Ruby version manager][rvm], -and the [Bundler gem][bundler]. +## Editing Service Guide pages -In the application folder type the following to install the required gems: +To make changes, edit the files that are located in `./source/documentation`. All pages are written in [Markdown](https://en.wikipedia.org/wiki/Markdown). -``` -bundle install -``` - -## Making changes +To add new pages simply copy and paste one of the existing pages, it will automatically appear in the menu. -To make changes edit the source files in the `source` folder. +## Previewing -### Single page output +#### Option 1 - Using Docker (recommended) -Although a single page of HTML is generated the markdown is spread across -multiple files to make it easier to manage. They can be found in -`source/documentation`. +Requirements: +* [Docker](https://www.docker.com/) -A new markdown file isn't automatically included in the generated output. If we -add a new markdown file at the location `source/documentation/agile/scrum.md`, -the following snippet in `source/index.html.md.erb`, includes it in the -generated output. +**Tip:** On macOS, use Homebrew to install [colima](https://github.com/abiosoft/colima) and then Docker client. Then start colima. +To live preview: ``` -<%= partial 'documentation/agile/scrum' %> +./batect preview ``` +The local URL and port where the files can be previewed will be output, this is normally http://localhost:4567. -Including files manually like this lets us specify the position they appear in -the page. +**Note:** The first time this is run it builds the Docker image and installs dependencies so may take 5 mins. +Subsequent runs will be much quicker. -### Multiple pages +#### Option 2 - Local install (Not recommended) -To add a completely new page, create a file with a `.html.md` extension in the `/source` directory. +Requirements: +* [Ruby Version Manager][rbenv] +* [Node Version Manager][nodenv] -For example, `source/about.html.md` will be accessible on . - -## Preview - -Whilst writing documentation we can run a middleman server to preview how the -published version will look in the browser. After saving a change the preview in -the browser will automatically refresh. +To live preview: +``` +bundle install +bundle exec middleman serve +``` +The local URL and port where the files can be previewed will be output, this is normally http://localhost:4567. -The preview is only available on our own computer. Others won't be able to -access it if they are given the link. +## Running the Scala Application -Type the following to start the server: +Requirements: +* Scala/sbt +### Build the HTML files ``` -bundle exec middleman server +./batect build ``` - -If all goes well something like the following output will be displayed: - +### Run the Scala Application ``` -== The Middleman is loading -== LiveReload accepting connections from ws://192.168.0.8:35729 -== View your site at "http://Laptop.local:4567", "http://192.168.0.8:4567" -== Inspect your site configuration at "http://Laptop.local:4567/__middleman", "http://192.168.0.8:4567/__middleman" +sbt run ``` -You should now be able to view a live preview at http://localhost:4567. - -## Build - -If you want to publish the website without using a build script you may need to -build the static HTML files. - -Type the following to build the HTML: +The local URL and port where the files can be previewed will be output, this is normally http://localhost:9000. +### How do I update the Ruby Gems +To update the Ruby Gems to the latest versions, run ``` -bundle exec middleman build +./batect update ``` +This will update the `Gemfile.lock` -This will create a `build` subfolder in the application folder which contains -the HTML and asset files ready to be published. +### How do I change the Ruby version +Edit `.ruby-version` with the required version of Ruby. -[rvm]: https://www.ruby-lang.org/en/documentation/installation/#managers -[bundler]: http://bundler.io/ +### How do I change the Node version +Edit `.node-version` with the required version of Node. -### License +[tdt]: https://github.com/alphagov/tech-docs-template +[rbenv]: https://github.com/rbenv/rbenv +[nodenv]: https://github.com/nodenv/nodenv +## License This code is open source software licensed under the [Apache 2.0 License]("http://www.apache.org/licenses/LICENSE-2.0.html"). diff --git a/batect b/batect new file mode 100755 index 0000000..4b3c763 --- /dev/null +++ b/batect @@ -0,0 +1,205 @@ +#!/usr/bin/env bash + +{ + set -euo pipefail + + # This file is part of Batect. + # Do not modify this file. It will be overwritten next time you upgrade Batect. + # You should commit this file to version control alongside the rest of your project. It should not be installed globally. + # For more information, visit https://github.com/batect/batect. + + VERSION="0.83.6" + CHECKSUM="${BATECT_DOWNLOAD_CHECKSUM:-d31a2931e96d2df1cde64e0948ffb57ce818b380b688ccc31f17617a64a3b32c}" + DOWNLOAD_URL_ROOT=${BATECT_DOWNLOAD_URL_ROOT:-"https://updates.batect.dev/v1/files"} + DOWNLOAD_URL=${BATECT_DOWNLOAD_URL:-"$DOWNLOAD_URL_ROOT/$VERSION/batect-$VERSION.jar"} + QUIET_DOWNLOAD=${BATECT_QUIET_DOWNLOAD:-false} + + BATECT_WRAPPER_CACHE_DIR=${BATECT_CACHE_DIR:-"$HOME/.batect/cache"} + VERSION_CACHE_DIR="$BATECT_WRAPPER_CACHE_DIR/$VERSION" + JAR_PATH="$VERSION_CACHE_DIR/batect-$VERSION.jar" + BATECT_WRAPPER_DID_DOWNLOAD=false + + SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + + function main() { + if ! haveVersionCachedLocally; then + download + BATECT_WRAPPER_DID_DOWNLOAD=true + fi + + checkChecksum + runApplication "$@" + } + + function haveVersionCachedLocally() { + [ -f "$JAR_PATH" ] + } + + function download() { + checkForCurl + + mkdir -p "$VERSION_CACHE_DIR" + temp_file=$(mktemp) + + if [[ $QUIET_DOWNLOAD == 'true' ]]; then + curl --silent --fail --show-error --location --output "$temp_file" --retry 3 --retry-connrefused "$DOWNLOAD_URL" + else + echo "Downloading Batect version $VERSION from $DOWNLOAD_URL..." + curl -# --fail --show-error --location --output "$temp_file" --retry 3 --retry-connrefused "$DOWNLOAD_URL" + fi + + mv "$temp_file" "$JAR_PATH" + } + + function checkChecksum() { + local_checksum=$(getLocalChecksum) + + if [[ "$local_checksum" != "$CHECKSUM" ]]; then + echo "The downloaded version of Batect does not have the expected checksum. Delete '$JAR_PATH' and then re-run this script to download it again." + exit 1 + fi + } + + function getLocalChecksum() { + if [[ "$(uname)" == "Darwin" ]]; then + shasum -a 256 "$JAR_PATH" | cut -d' ' -f1 + else + sha256sum "$JAR_PATH" | cut -d' ' -f1 + fi + } + + function runApplication() { + java_path=$(getPathToJava) + checkForJava "$java_path" + + java_version_info=$(getJavaVersionInfo "$java_path") + checkJavaVersion "$java_version_info" + + java_version=$(extractJavaVersion "$java_version_info") + java_version_major=$(extractJavaMajorVersion "$java_version") + + if (( java_version_major >= 9 )); then + JAVA_OPTS=(--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED) + else + JAVA_OPTS=() + fi + + if [[ "$(uname -o 2>&1)" == "Msys" ]] && hash winpty 2>/dev/null && [ -t /dev/stdin ]; then + GIT_BASH_PTY_WORKAROUND=(winpty) + else + GIT_BASH_PTY_WORKAROUND=() + fi + + BATECT_WRAPPER_SCRIPT_DIR="$SCRIPT_PATH" \ + BATECT_WRAPPER_CACHE_DIR="$BATECT_WRAPPER_CACHE_DIR" \ + BATECT_WRAPPER_DID_DOWNLOAD="$BATECT_WRAPPER_DID_DOWNLOAD" \ + HOSTNAME="$HOSTNAME" \ + exec \ + ${GIT_BASH_PTY_WORKAROUND[@]+"${GIT_BASH_PTY_WORKAROUND[@]}"} \ + "$java_path" \ + -Djava.net.useSystemProxies=true \ + ${JAVA_OPTS[@]+"${JAVA_OPTS[@]}"} \ + -jar "$JAR_PATH" \ + "$@" + } + + function checkForCurl() { + if ! hash curl 2>/dev/null; then + echo "curl is not installed or not on your PATH. Please install it and try again." >&2 + exit 1 + fi + } + + function getPathToJava() { + if useJavaHome; then + echo "$JAVA_HOME/bin/java" + else + echo "java" + fi + } + + function useJavaHome() { + test -n "${JAVA_HOME+x}" + } + + function checkForJava() { + local java_path="$1" + + if ! hash "$java_path" 2>/dev/null; then + showJavaNotInstalledError + fi + } + + function showJavaNotInstalledError() { + if useJavaHome; then + echo "JAVA_HOME is set to '$JAVA_HOME', but there is no Java executable at '$JAVA_HOME/bin/java'." >&2 + else + echo "Java is not installed or not on your PATH. Please install it and try again." >&2 + fi + + exit 1 + } + + function checkJavaVersion() { + java_version_info="$1" + java_version=$(extractJavaVersion "$java_version_info") + java_version_major=$(extractJavaMajorVersion "$java_version") + java_version_minor=$(extractJavaMinorVersion "$java_version") + + if (( java_version_major < 1 || ( java_version_major == 1 && java_version_minor <= 7 ) )); then + if useJavaHome; then + echo "The version of Java that is available in JAVA_HOME is version $java_version, but version 1.8 or greater is required." >&2 + echo "If you have a newer version of Java installed, please make sure JAVA_HOME is set correctly." >&2 + echo "JAVA_HOME takes precedence over any versions of Java available on your PATH." >&2 + else + echo "The version of Java that is available on your PATH is version $java_version, but version 1.8 or greater is required." >&2 + echo "If you have a newer version of Java installed, please make sure your PATH is set correctly." >&2 + fi + + exit 1 + fi + + if ! javaIs64Bit "$java_version_info"; then + if useJavaHome; then + echo "The version of Java that is available in JAVA_HOME is a 32-bit version, but Batect requires a 64-bit Java runtime." >&2 + echo "If you have a 64-bit version of Java installed, please make sure JAVA_HOME is set correctly." >&2 + echo "JAVA_HOME takes precedence over any versions of Java available on your PATH." >&2 + else + echo "The version of Java that is available on your PATH is a 32-bit version, but Batect requires a 64-bit Java runtime." >&2 + echo "If you have a 64-bit version of Java installed, please make sure your PATH is set correctly." >&2 + fi + + exit 1 + fi + } + + function getJavaVersionInfo() { + local java_path="$1" + + "$java_path" -version 2>&1 || showJavaNotInstalledError + } + + function extractJavaVersion() { + echo "$1" | grep version | sed -En ';s/.* version "([0-9]+)(\.([0-9]+))?.*".*/\1.\3/p;' + } + + function extractJavaMajorVersion() { + java_version=$1 + + echo "${java_version%.*}" + } + + function extractJavaMinorVersion() { + java_version=$1 + java_version_minor="${java_version#*.}" + + echo "${java_version_minor:-0}" + } + + function javaIs64Bit() { + echo "$1" | grep -q '64-[Bb]it' + } + + main "$@" + exit $? +} diff --git a/batect.cmd b/batect.cmd new file mode 100644 index 0000000..f31b843 --- /dev/null +++ b/batect.cmd @@ -0,0 +1,473 @@ +@echo off +rem This file is part of Batect. +rem Do not modify this file. It will be overwritten next time you upgrade Batect. +rem You should commit this file to version control alongside the rest of your project. It should not be installed globally. +rem For more information, visit https://github.com/batect/batect. + +setlocal EnableDelayedExpansion + +set "version=0.83.6" + +if "%BATECT_CACHE_DIR%" == "" ( + set "BATECT_CACHE_DIR=%USERPROFILE%\.batect\cache" +) + +set "rootCacheDir=!BATECT_CACHE_DIR!" +set "cacheDir=%rootCacheDir%\%version%" +set "ps1Path=%cacheDir%\batect-%version%.ps1" + +set script=Set-StrictMode -Version 2.0^ + +$ErrorActionPreference = 'Stop'^ + +^ + +$Version='0.83.6'^ + +^ + +function getValueOrDefault($value, $default) {^ + + if ($value -eq $null) {^ + + $default^ + + } else {^ + + $value^ + + }^ + +}^ + +^ + +$DownloadUrlRoot = getValueOrDefault $env:BATECT_DOWNLOAD_URL_ROOT "https://updates.batect.dev/v1/files"^ + +$UrlEncodedVersion = [Uri]::EscapeDataString($Version)^ + +$DownloadUrl = getValueOrDefault $env:BATECT_DOWNLOAD_URL "$DownloadUrlRoot/$UrlEncodedVersion/batect-$UrlEncodedVersion.jar"^ + +$ExpectedChecksum = getValueOrDefault $env:BATECT_DOWNLOAD_CHECKSUM 'd31a2931e96d2df1cde64e0948ffb57ce818b380b688ccc31f17617a64a3b32c'^ + +^ + +$RootCacheDir = getValueOrDefault $env:BATECT_CACHE_DIR "$env:USERPROFILE\.batect\cache"^ + +$VersionCacheDir = "$RootCacheDir\$Version"^ + +$JarPath = "$VersionCacheDir\batect-$Version.jar"^ + +$DidDownload = 'false'^ + +^ + +function main() {^ + + if (-not (haveVersionCachedLocally)) {^ + + download^ + + $DidDownload = 'true'^ + + }^ + +^ + + checkChecksum^ + + runApplication @args^ + +}^ + +^ + +function haveVersionCachedLocally() {^ + + Test-Path $JarPath^ + +}^ + +^ + +function download() {^ + + Write-Output "Downloading Batect version $Version from $DownloadUrl..."^ + +^ + + createCacheDir^ + +^ + + $oldProgressPreference = $ProgressPreference^ + +^ + + try {^ + + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12^ + +^ + + # Turn off the progress bar to significantly reduce download times - see https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251165868^ + + $ProgressPreference = 'SilentlyContinue'^ + +^ + + Invoke-WebRequest -Uri $DownloadUrl -OutFile $JarPath ^| Out-Null^ + + } catch {^ + + $Message = $_.Exception.Message^ + +^ + + Write-Host -ForegroundColor Red "Downloading failed with error: $Message"^ + + exit 1^ + + } finally {^ + + $ProgressPreference = $oldProgressPreference^ + + }^ + +}^ + +^ + +function checkChecksum() {^ + + $localChecksum = (Get-FileHash -Algorithm 'SHA256' $JarPath).Hash.ToLower()^ + +^ + + if ($localChecksum -ne $expectedChecksum) {^ + + Write-Host -ForegroundColor Red "The downloaded version of Batect does not have the expected checksum. Delete '$JarPath' and then re-run this script to download it again."^ + + exit 1^ + + }^ + +}^ + +^ + +function createCacheDir() {^ + + if (-not (Test-Path $VersionCacheDir)) {^ + + New-Item -ItemType Directory -Path $VersionCacheDir ^| Out-Null^ + + }^ + +}^ + +^ + +function runApplication() {^ + + $java = findJava^ + + $javaVersion = checkJavaVersion $java^ + +^ + + if ($javaVersion.Major -ge 9) {^ + + $javaArgs = @("--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")^ + + } else {^ + + $javaArgs = @()^ + + }^ + +^ + + $combinedArgs = $javaArgs + @("-Djava.net.useSystemProxies=true", "-jar", $JarPath) + $args^ + + $env:HOSTNAME = $env:COMPUTERNAME^ + + $env:BATECT_WRAPPER_CACHE_DIR = $RootCacheDir^ + + $env:BATECT_WRAPPER_DID_DOWNLOAD = $DidDownload^ + +^ + + $info = New-Object System.Diagnostics.ProcessStartInfo^ + + $info.FileName = $java.Source^ + + $info.Arguments = combineArgumentsToString($combinedArgs)^ + + $info.RedirectStandardError = $false^ + + $info.RedirectStandardOutput = $false^ + + $info.UseShellExecute = $false^ + +^ + + $process = New-Object System.Diagnostics.Process^ + + $process.StartInfo = $info^ + + $process.Start() ^| Out-Null^ + + $process.WaitForExit()^ + +^ + + exit $process.ExitCode^ + +}^ + +^ + +function useJavaHome() {^ + + return ($env:JAVA_HOME -ne $null)^ + +}^ + +^ + +function findJava() {^ + + if (useJavaHome) {^ + + $java = Get-Command "$env:JAVA_HOME\bin\java" -ErrorAction SilentlyContinue^ + +^ + + if ($java -eq $null) {^ + + Write-Host -ForegroundColor Red "JAVA_HOME is set to '$env:JAVA_HOME', but there is no Java executable at '$env:JAVA_HOME\bin\java.exe'."^ + + exit 1^ + + }^ + +^ + + return $java^ + + }^ + +^ + + $java = Get-Command "java" -ErrorAction SilentlyContinue^ + +^ + + if ($java -eq $null) {^ + + Write-Host -ForegroundColor Red "Java is not installed or not on your PATH. Please install it and try again."^ + + exit 1^ + + }^ + +^ + + return $java^ + +}^ + +^ + +function checkJavaVersion([System.Management.Automation.CommandInfo]$java) {^ + + $versionInfo = getJavaVersionInfo $java^ + + $rawVersion = getJavaVersion $versionInfo^ + + $parsedVersion = New-Object Version -ArgumentList $rawVersion^ + + $minimumVersion = "1.8"^ + +^ + + if ($parsedVersion -lt (New-Object Version -ArgumentList $minimumVersion)) {^ + + if (useJavaHome) {^ + + Write-Host -ForegroundColor Red "The version of Java that is available in JAVA_HOME is version $rawVersion, but version $minimumVersion or greater is required."^ + + Write-Host -ForegroundColor Red "If you have a newer version of Java installed, please make sure JAVA_HOME is set correctly."^ + + Write-Host -ForegroundColor Red "JAVA_HOME takes precedence over any versions of Java available on your PATH."^ + + } else {^ + + Write-Host -ForegroundColor Red "The version of Java that is available on your PATH is version $rawVersion, but version $minimumVersion or greater is required."^ + + Write-Host -ForegroundColor Red "If you have a newer version of Java installed, please make sure your PATH is set correctly."^ + + }^ + +^ + + exit 1^ + + }^ + +^ + + if (-not ($versionInfo -match "64\-[bB]it")) {^ + + if (useJavaHome) {^ + + Write-Host -ForegroundColor Red "The version of Java that is available in JAVA_HOME is a 32-bit version, but Batect requires a 64-bit Java runtime."^ + + Write-Host -ForegroundColor Red "If you have a 64-bit version of Java installed, please make sure JAVA_HOME is set correctly."^ + + Write-Host -ForegroundColor Red "JAVA_HOME takes precedence over any versions of Java available on your PATH."^ + + } else {^ + + Write-Host -ForegroundColor Red "The version of Java that is available on your PATH is a 32-bit version, but Batect requires a 64-bit Java runtime."^ + + Write-Host -ForegroundColor Red "If you have a 64-bit version of Java installed, please make sure your PATH is set correctly."^ + + }^ + +^ + + exit 1^ + + }^ + +^ + + return $parsedVersion^ + +}^ + +^ + +function getJavaVersionInfo([System.Management.Automation.CommandInfo]$java) {^ + + $info = New-Object System.Diagnostics.ProcessStartInfo^ + + $info.FileName = $java.Source^ + + $info.Arguments = "-version"^ + + $info.RedirectStandardError = $true^ + + $info.RedirectStandardOutput = $true^ + + $info.UseShellExecute = $false^ + +^ + + $process = New-Object System.Diagnostics.Process^ + + $process.StartInfo = $info^ + + $process.Start() ^| Out-Null^ + + $process.WaitForExit()^ + +^ + + $stderr = $process.StandardError.ReadToEnd()^ + + return $stderr^ + +}^ + +^ + +function getJavaVersion([String]$versionInfo) {^ + + $versionLine = ($versionInfo -split [Environment]::NewLine)[0]^ + +^ + + if (-not ($versionLine -match "version `"([0-9]+)(\.([0-9]+))?.*`"")) {^ + + Write-Error "Java reported a version that does not match the expected format: $versionLine"^ + + }^ + +^ + + $major = $Matches.1^ + +^ + + if ($Matches.Count -ge 3) {^ + + $minor = $Matches.3^ + + } else {^ + + $minor = "0"^ + + }^ + +^ + + return "$major.$minor"^ + +}^ + +^ + +function combineArgumentsToString([Object[]]$arguments) {^ + + $combined = @()^ + +^ + + $arguments ^| %% { $combined += escapeArgument($_) }^ + +^ + + return $combined -join " "^ + +}^ + +^ + +function escapeArgument([String]$argument) {^ + + return '"' + $argument.Replace('"', '"""') + '"'^ + +}^ + +^ + +main @args^ + + + +if not exist "%cacheDir%" ( + mkdir "%cacheDir%" +) + +echo !script! > "%ps1Path%" + +set BATECT_WRAPPER_SCRIPT_DIR=%~dp0 + +rem Why do we explicitly exit? +rem cmd.exe appears to read this script one line at a time and then executes it. +rem If we modify the script while it is still running (eg. because we're updating it), then cmd.exe does all kinds of odd things +rem because it continues execution from the next byte (which was previously the end of the line). +rem By explicitly exiting on the same line as starting the application, we avoid these issues as cmd.exe has already read the entire +rem line before we start the application and therefore will always exit. + +rem Why do we set PSModulePath? +rem See issue #627 +set "PSModulePath=" +powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -File "%ps1Path%" %* && exit /b 0 || exit /b !ERRORLEVEL! + +rem What's this for? +rem This is so the tests for the wrapper has a way to ensure that the line above terminates the script correctly. +echo WARNING: you should never see this, and if you do, then Batect's wrapper script has a bug diff --git a/batect.yml b/batect.yml new file mode 100644 index 0000000..b414374 --- /dev/null +++ b/batect.yml @@ -0,0 +1,44 @@ +containers: + ruby: + build_directory: . + volumes: + - local: . + container: /mnt + options: cached + - type: cache + name: bundle-cache + container: /bundle-cache + working_directory: /mnt + environment: + BUNDLE_PATH: /bundle-cache + run_as_current_user: + enabled: true + home_directory: /home + +tasks: + update: + description: Update Ruby Gems + run: + container: ruby + command: bundle update + install: + description: Install Ruby Gems + run: + container: ruby + command: bundle install + preview: + description: Run a server so that the content can be seen in a browser + prerequisites: + - install + run: + container: ruby + command: bundle exec middleman + ports: + - 4567:4567 + build: + description: Build the HTML files and output to ./public + prerequisites: + - install + run: + container: ruby + command: bundle exec middleman build --build-dir=public/ --clean diff --git a/build.sbt b/build.sbt index da88093..f2ddf6c 100644 --- a/build.sbt +++ b/build.sbt @@ -3,17 +3,13 @@ import uk.gov.hmrc.sbtdistributables.SbtDistributablesPlugin.publishingSettings val appName = "vat-service-guide" lazy val microservice = Project(appName, file(".")) - .enablePlugins(play.sbt.PlayScala, SbtAutoBuildPlugin, SbtDistributablesPlugin) + .enablePlugins(play.sbt.PlayScala, SbtAutoBuildPlugin, SbtGitVersioning, SbtDistributablesPlugin) .settings( libraryDependencies ++= AppDependencies.compile ++ AppDependencies.test, - update / evictionWarningOptions := EvictionWarningOptions.default.withWarnScalaVersionEviction(false), + evictionWarningOptions in update := EvictionWarningOptions.default.withWarnScalaVersionEviction(false), majorVersion := 0, - scalaVersion := "2.12.12" + scalaVersion := "2.13.10" ) .settings( publishingSettings: _* ) - .settings( - resolvers += Resolver.bintrayRepo("hmrc", "releases"), - resolvers += Resolver.jcenterRepo - ) diff --git a/conf/application-json-logger.xml b/conf/application-json-logger.xml index e40586e..6628cd6 100644 --- a/conf/application-json-logger.xml +++ b/conf/application-json-logger.xml @@ -5,9 +5,9 @@ - + - + diff --git a/conf/application.conf b/conf/application.conf index edeea20..df59882 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -1,4 +1,4 @@ -# Copyright 2021 HM Revenue & Customs +# Copyright 2023 HM Revenue & Customs # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ play.application.loader = "uk.gov.hmrc.play.bootstrap.ApplicationLoader" # Primary entry point for all HTTP requests on Play applications play.http.requestHandler = "uk.gov.hmrc.play.bootstrap.http.RequestHandler" -# Provides an implementation of AuditConnector. Use `uk.gov.hmrc.play.bootstrap.AuditModule` or create your own. +# Provides an implementation of AuditConnector. Use `uk.gov.hmrc.play.audit.AuditModule` or create your own. # An audit connector must be provided. -play.modules.enabled += "uk.gov.hmrc.play.bootstrap.AuditModule" +play.modules.enabled += "uk.gov.hmrc.play.audit.AuditModule" # Provides an implementation of MetricsFilter. Use `uk.gov.hmrc.play.graphite.GraphiteMetricsModule` or create your own. # A metric filter must be provided @@ -39,8 +39,8 @@ play.modules.enabled += "uk.gov.hmrc.play.bootstrap.graphite.GraphiteMetricsModu # Additional play modules can be added here # Provides an implementation and configures all filters required by a Platform frontend microservice. -play.modules.enabled += "uk.gov.hmrc.play.bootstrap.FrontendModule" -play.http.filters = "uk.gov.hmrc.play.bootstrap.filters.FrontendFilters" +play.modules.enabled += "uk.gov.hmrc.play.bootstrap.frontend.FrontendModule" +play.http.filters = "uk.gov.hmrc.play.bootstrap.frontend.filters.FrontendFilters" # Session Timeout # ~~~~ @@ -49,12 +49,6 @@ play.http.filters = "uk.gov.hmrc.play.bootstrap.filters.FrontendFilters" # timeout 15 minutes after login (regardless of user activity). # session.maxAge=900 -# Secret key -# ~~~~~ -# The secret key is used to secure cryptographics functions. -# If you deploy your application to several instances be sure to use the same key! -play.crypto.secret="DUMMY" - # Session configuration # ~~~~~ application.session.httpOnly=false @@ -62,8 +56,8 @@ application.session.secure=false # The application languages # ~~~~~ -application.langs="en" -play.filters.headers.contentSecurityPolicy= "default-src 'unsafe-inline' 'self' localhost:9032 data: https://www.google-analytics.com https://www.googletagmanager.com; child-src https://*.youtube.com; script-src 'unsafe-inline' 'self' localhost:9032 https://www.google-analytics.com https://*.youtube.com data: https://www.googletagmanager.com https://tagmanager.google.com; font-src 'self' data: https://ssl.gstatic.com https://www.gstatic.com https://fonts.gstatic.com https://fonts.googleapis.com; img-src 'self' https://ssl.gstatic.com https://www.gstatic.com https://www.google-analytics.com https://www.googletagmanager.com data:; style-src 'self' 'unsafe-inline' https://tagmanager.google.com https://fonts.googleapis.com" +play.i18n.langs = ["en"] +play.filters.headers.contentSecurityPolicy= "default-src 'unsafe-inline' 'self' localhost:9032 data: https://www.google-analytics.com; child-src https://*.youtube.com; script-src 'unsafe-inline' 'self' localhost:9032 https://www.google-analytics.com data: https://www.googletagmanager.com https://tagmanager.google.com; font-src 'self' data: https://ssl.gstatic.com https://www.gstatic.com https://fonts.gstatic.com https://fonts.googleapis.com" # Router # ~~~~~ diff --git a/config.rb b/config.rb index c207d11..cfe012e 100644 --- a/config.rb +++ b/config.rb @@ -2,9 +2,20 @@ require 'govuk_tech_docs/table_of_contents/heading' require 'govuk_tech_docs/table_of_contents/headings_builder' require 'govuk_tech_docs/tech_docs_html_renderer' +require 'yaml' configure :build do - base_path = ENV['BASE_PATH'] || '/' # Note: please ensure BASE_PATH ends with a trailing '/' + + tech_docs = YAML.load_file('config/tech-docs.yml') + service_name = tech_docs['service_name'] + service_link = tech_docs['service_link'] + project_name = tech_docs['project_name'] + + base_path = service_link + # Note: ensure base_path ends with a trailing '/' + if base_path[-1, 1] != '/' + base_path += '/' + end activate :asset_host, host: base_path config[:http_prefix] = base_path diff --git a/config/tech-docs.yml b/config/tech-docs.yml index 5532c59..c9fc976 100644 --- a/config/tech-docs.yml +++ b/config/tech-docs.yml @@ -1,17 +1,28 @@ +# Human read-able name for this site, displayed in the header bar +service_name: VAT (MTD) end-to-end service guide + +# The route that will be used to access this site (with tailing slash) +service_link: /guides/vat-mtd-end-to-end-service-guide/ + +# ================================================ +# You shouldn't need to edit anything below here +# ================================================ + # Host to use for canonical URL generation (without trailing slash) -host: docs.developer.service.hmrc.gov.uk +host: developer.service.hmrc.gov.uk # Header-related options show_govuk_logo: true -service_name: HMRC Developer Hub -service_link: https://developer.service.hmrc.gov.uk/api-documentation # Links to show on right-hand-side of header header_links: - VAT (MTD) End-to-End Service Guide: /guides/vat-mtd-end-to-end-service-guide - Documentation: /api-documentation/docs/using-the-hub - Applications: /developer/applications - Support: /developer/support + Developer Hub: https://developer.service.hmrc.gov.uk + Documentation: https://developer.service.hmrc.gov.uk/api-documentation/docs/using-the-hub + Applications: https://developer.service.hmrc.gov.uk/developer/applications + Support: https://developer.service.hmrc.gov.uk/developer/support + +footer_links: + Accessibility statement: https://www.tax.service.gov.uk/accessibility-statement/hmrc-developer-hub # Enables search functionality. This indexes pages only and is not recommended for single-page sites. enable_search: false @@ -39,4 +50,3 @@ max_toc_heading_level: 2 prevent_indexing: false show_contribution_banner: false -github_repo: hmrc/vat-service-guide.git diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 626ac9f..8e6dba0 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -2,14 +2,17 @@ import play.sbt.PlayImport._ import sbt._ object AppDependencies { - val bootStrapPlayVersion = "5.7.0" + val bootStrapPlayVersion = "7.8.0" val compile: Seq[ModuleID] = Seq( ws, - "uk.gov.hmrc" %% "bootstrap-frontend-play-28" % bootStrapPlayVersion) + "uk.gov.hmrc" %% "bootstrap-frontend-play-28" % bootStrapPlayVersion, + ) val test: Seq[ModuleID] = Seq( - "com.vladsch.flexmark" % "flexmark-all" % "0.36.8" % "test", - "org.scalatest" %% "scalatest" % "3.2.9" % "test" + "uk.gov.hmrc" %% "bootstrap-test-play-28" % bootStrapPlayVersion % "test", + "org.pegdown" % "pegdown" % "1.6.0" % "test", + "com.vladsch.flexmark" % "flexmark-profile-pegdown" % "0.62.2" % "test", + "org.scalatest" %% "scalatest" % "3.2.11" % "test" ) } diff --git a/project/build.properties b/project/build.properties index 19479ba..563a014 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.2 +sbt.version=1.7.2 diff --git a/project/plugins.sbt b/project/plugins.sbt index 73aa7a3..3cc40b0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,8 +1,10 @@ -resolvers += "Typesafe Releases" at "https://repo.typesafe.com/typesafe/releases/" -resolvers += "HMRC-open-artefacts-maven" at "https://open.artefacts.tax.service.gov.uk/maven2" -resolvers += Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns) +resolvers ++= Seq( + Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns), + "HMRC-open-artefacts-maven" at "https://open.artefacts.tax.service.gov.uk/maven2") -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.3.0") -addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.1.0") - -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.9.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.2.0") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.18") +addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.2") diff --git a/source/documentation/partials/_give-feedback.erb b/source/documentation/partials/_give-feedback.erb new file mode 100644 index 0000000..e1282cd --- /dev/null +++ b/source/documentation/partials/_give-feedback.erb @@ -0,0 +1,7 @@ +<% content_for :head do %> + <%= stylesheet_link_tag 'give-feedback' %> +<% end %> + + diff --git a/source/stylesheets/give-feedback.css.scss b/source/stylesheets/give-feedback.css.scss new file mode 100644 index 0000000..8d7d84d --- /dev/null +++ b/source/stylesheets/give-feedback.css.scss @@ -0,0 +1,37 @@ +// Include only the bits of GOV.UK Frontend we need +@import "govuk/settings/all"; +@import "govuk/tools/all"; +@import "govuk/helpers/all"; + +.give-feedback { + padding: govuk-spacing(3); + margin-top: govuk-spacing(6); + margin-bottom: govuk-spacing(6); + background-color: $govuk-brand-colour; + color: govuk-colour("white"); + + @include govuk-media-query(tablet) { + padding: govuk-spacing(6); + } + + a:link, + a:visited { + &:not(:focus) { + color: inherit; + } + } + + a:active { + color: $govuk-link-active-colour; + } +} + +.page-expiry--expired { + display: none; + + padding: govuk-spacing(3); + margin-top: govuk-spacing(9); + border: govuk-spacing(1) solid $govuk-error-colour; + background-color: govuk-colour("white"); + color: $govuk-text-colour; +} diff --git a/test/BuildSpec.scala b/test/BuildSpec.scala index 1e4ce59..3b9e9ee 100644 --- a/test/BuildSpec.scala +++ b/test/BuildSpec.scala @@ -1,27 +1,17 @@ /* - * Copyright 2021 HM Revenue & Customs + * Copyright 2023 HM Revenue & Customs * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ import org.scalatest.matchers.should.Matchers -import org.scalatest.wordspec.AnyWordSpecLike +import org.scalatest.wordspec.AnyWordSpec +import scala.language.postfixOps import sys.process._ -class BuildSpec extends AnyWordSpecLike with Matchers { +class BuildSpec extends AnyWordSpec with Matchers { "Building the content" should { "produce static files" in { - val result = "bundle install" #&& Process("bundle exec middleman build --build-dir=public/ --clean", None, "BASE_PATH" -> "/guides/vat-mtd-end-to-end-service-guide/") ! + val result = "bundle install" #&& Process("bundle exec middleman build --build-dir=public/ --clean", None) ! result shouldBe 0 }