/NMDM_book

A book for the numeracy, modelling and data management course.

Primary LanguageCSS

Numeracy, Modelling and Data Management

This book is written in support of a course offered to PhD students within the University of Edinburgh’s School of GeoSciences and across the Edinburgh E3 Doctoral Training Partnership.

1. How To generate the book

You will need to have Ruby installed on your computer, as well as RubyGems. You can learn how to install these in the appendices of this book (which you should be able to read in a text editor or on Github).

You then should install the ruby package bundler using

$ gem install bundler

You also need to clone the files into the directory of your choice from Github. Once you have bundler installed, you can build the book with:

$ bundler install
$ bundle exec rake book:build

This will build html and pdf versions of the book.

You can also build an html only version:

$ bundler install
$ bundle exec rake book:build_html
Warning
The build process will make a folder called images in the root directory, which on some systems must be deleted before new builds.

1.1. Quick build asciidoctor

You can also quickly generate the document by installing asciidoctor, and then running it on the LSDTT_Book.asc file:

$ gem install asciidoctor
$ asciidoctor NMDM.asc
Warning
This quick generation will give you the text and cross-linking, but the images will not be linked. For images to be properly linked you need to run bundle exec (see above).

2. If you are making changes to this book

You can ignore this unless you are helping write the book and have push permission.

I (SMM) do not want any messy merging conflicts! To avoid this please keep the master and gh-pages seperate on your computer!

  1. When checking out the code, check them out into two directories:

    $ git clone https://github.com/simon-m-mudd/NMDM_book.git master
    $ git clone https://github.com/simon-m-mudd/NMDM_book.git gh-pages
  2. In the gh-pages directory, check out the gh-pages branch and get rid of the master branch:

    $ cd gh-pages
    $ git checkout origin/gh-pages -b gh-pages
    $ git branch -d master
  3. Now, go back to the master branch, you can make changes there.

  4. When you commit changes to the master branch and you want to update the website, commit and push changes, then run bundle:

    $ pwd
    my/path/to/repo/NMDM_book/master/
    $ git commit -m "My latest commit" .
    $ git push -u origin master
    $ bundle exec rake book:build_html
  5. Now copy any new image files to the /images folder in the gh-pages branch (you will need to git add them), and rename NMDM.html to index.html and copy to the gh-pages folder.

    $ pwd
    my/path/to/repo/NMDM_book/gh-pages/
    $ cd images
    $ git add <filenames of new images>
    $ cd ..
    $ git commit "updating website" .
  6. Now push the changes to the gh-pages branch

    $ bundle exec rake book:build_html

    $ pwd
    my/path/to/repo/NMDM_book/gh-pages/
    $ git push -u origin gh-pages