Adding Download Links to the Website

This article outlines how to update the NautDrafter website when a new version of the application is released.

Getting the Source

The website source is hosted on Bitbucket in the nautdrafter.bitbucket.org repo, which you'll need to clone to your local machine. You will need to be a member of the NautDrafter team to access the repo.

Even thought the repo is private, everything in it is served up publicly by Bitbucket at nautdrafter.bitbucket.org, so sensitive files should not be stored in the repo.

Setting up the Environment

The readme.md file in the root of the repo outlines the steps to follow for installing the required Ruby Gems.

When modifying any part of the website, ensure you are editing files in the /src/ directory. Everything in the /nautdrafter/ directory will be overwritten when the site is generated.

Once you have finished making modifications, run bundle exec jekyll build from the /src/ folder to build the site to the /nautdrafter/ folder (if you have been live-serving the site with bundle exec jekyll serve --watch this is not necessary, as the site will have already been build to /nautdrafter/ when you last made a change).

Downloads Page Data

The download.html file in the /src/ folder does not contain any actual information about the available downloads or previous releases. This data is all stored as Jekyll "posts" in the /src/downloads/_posts/ folder. See the Jekyll Documentation for more about posts.

Each post should be named in the format YYYY-MM-DD-title.md. The date should be the date that the release was made on. The title in the file name is not currently used on the website, but it's helpful when looking at the files in the future. The most recent post (as determined by the date in the file name) will be displayed as the Latest Release.

Although the posts are Markdown, the majority of the information about the release is stored in the YAML front matter. The code block below is an annotated example of a post:

YAML Data
---
title: Version 0.2.0 	# Title of the release
version: 0.2.0 			# Version number
releaseNotes: https://kbmaster.atlassian.net/wiki/display/NAUTW/Version+0.2.0+Release+Notes 		# URL for the release notes

downloads: 				# Each item here will be given a collapsible section on the downloads page
 - title: Windows			# Title displayed for the section
   type: windows			# Platform the section corresponds to. One of windows linux or osx. This is added as a style class to the section and used when deciding which section to expand by default, based on the user's platform (see the JS in download.html)
   downloads:				# Each item here will be given a button with the section
    - title: 64bit				# Title to show on the button
      url: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-windows-x64-installer.exe		# URL of the full installer
      updaterUrl: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-windows-x64-updater.exe	# URL of the update installer  (optional)
    - title: 32bit
      url: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-windows-installer.exe
      updaterUrl: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-windows-updater.exe
 - title: Mac OSX
   type: osx
   downloads:
    - title: 64bit
      url: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-osx-installer.app.zip
      updaterUrl: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-osx-updater.app.zip
 - title: Linux
   type: linux
   downloads:
    - title: 64bit
      url: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-linux-x64-installer.run
      updaterUrl: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-linux-x64-updater.run
    - title: 32bit
      url: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-linux-installer.run
      updaterUrl: https://bitbucket.org/nautdrafter/nautdrafter/downloads/NautDrafter-0.2.0-linux-updater.run
---
   
Markdown formatted description of the release goes here

Adding a new Release to the Downloads Page

The easiest way to add a new release is to simply copy the most recent post file and change its data.

  1. Make a copy the post file for the latest release
  2. Rename the copy to have the correct date and title in the file name
  3. Open the file in a text editor
  4. Change the titleversion and releaseNotes values to the correct values
  5. For each of the downloads items, change the URLs to the appropriate values. If the Installers were generated according to Creating the Installers and uploaded to Bitbucket, this should just be a matter of changing the version number in each of the URLs.

Checking it all works:

  1. From the /src/ folder, run bundle exec jekyll serve --watch.
  2. In your web browser, navigate to the address the local site is being served on (probably http://0.0.0.0:4000/nautdrafter/download/ by default)

If everything is working, make a commit (from the root of the repo) and push to the remote Bitbucket repo. The live site should now display the updated data.