simon-m-mudd / Test_book

Test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A book template

This is a template for a book or website written with asciidoctor. If you want to make your own website or book just clone this repository. You will meed to install ruby, rubygems and [bundler] to get it working.

Install the ruby package bundler using

$ gem install bundler

1. Building the book

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 Book_template_top.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 want to set up your own book, and have an associated website

  1. So the first thing you need to do is make a directory for your very own book. Lets call it MyBook. Go into MyBook and clone this template into a folder called master:

    $ mkdir MyBook
    $ cd MyBook
    $ git clone https://github.com/simon-m-mudd/Book_template.git master
  2. Next, delete the .git folder inside the master folder.

  3. Now use git init to start a new repository and then add and commit the files.

    $ cd master
    $ git init
    $ git add .
    $ git commit -m "Added the files" .
  4. Now start a new repository on github without a readme.

  5. It will give you the remote name. Add it to the repository:

    $ git remote add origin https://github.com/MYUSERNAME/MYREPONAME.git
    $ git push origin master

    You will need to replace MYUSERNAME and MYREPONAME with the appropraite names.

  6. Refresh the github repositoy page. You should see all the files from the template.

  7. Now on the repository page, look above the files: you should see a tab for "Branches". Click on this and make a new branch called gh-pages. + Now got back into your terminal window, go down a level using cd .., and clone the gh-pages branch.

    $ cd ..
    $ git clone https://github.com/MYUSERNAME/MYREPONAME.git gh-pages
  8. Go into the gh-pages directory, check out the gh-pages branch, and delete the master branch (it will only delete the master branch form this directory).

    $ cd gh-pages
    $ git checkout origin/gh-pages -b gh-pages
    $ git branch -d master
  9. You gh-pages branch is still full of rubbish you don’t need. Remove it all. Then make a dummy index page.

    $ git rm -rf
    $ echo "My Page" > index.html
    $ git add index.html
    $ git commit -a -m "Added the index" .
    $ git push origin gh-pages

    == 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

About

Test


Languages

Language:CSS 98.1%Language:Ruby 1.9%