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.
|
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).
|
-
So the first thing you need to do is make a directory for your very own book. Lets call it
MyBook
. Go intoMyBook
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
-
Next, delete the
.git
folder inside themaster
folder. -
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" .
-
Now start a new repository on github without a readme.
-
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
andMYREPONAME
with the appropraite names. -
Refresh the github repositoy page. You should see all the files from the template.
-
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 usingcd ..
, and clone the gh-pages branch.$ cd .. $ git clone https://github.com/MYUSERNAME/MYREPONAME.git gh-pages
-
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
-
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!
-
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
-
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
-
Now, go back to the master branch, you can make changes there.
-
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
-
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" .
-
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