This package contains materials for the Nice R Code blog, run by Rich FitzJohn and Daniel Falster. The site is constructed using Octopress. The git repo is private, hosted on bitbucket. The site is deployed on github at http://nicercode.github.com/. All edits are in bitbucket repo. The only thing that happens on github is to deploy.
Using a small modification to the pagination plug-in described here post can be excluded from the front page by marking them draft (see _config.yaml for the list of categories to be shown or excluded on front page).
Draft posts can then be viewed at http://nicercode.github.io/blog/categories/draft/
Rmd files should be kept in the _drafts
directory, as they cause problems when posted in the _posts
directory. The function knit_post
function can is used to publish suitable md and associated image files from the _drafts
to over to the _posts
directory.
source("knit_post.R")
# Setting publish = FALSE will produce files in the _drafts directory, for review
knit_post("trial.Rmd", publish=FALSE)
# Setting publish = TRUE will publish post to _posts, figures to _images and delete corresponding files from the drafts directory
knit_post("trial.Rmd", publish=TRUE)
Here are summary instructions for setting up on a new machine. For more info see octopress documentation.
git clone git@bitbucket.org:richfitz/nicercode.git
git clone git://github.com/sstephenson/rbenv.git .rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
make sure .rbenv is in path. Bash users follow std instructions at link above. For zshell users, make sure following lines are in .zshrc
path=(/Users/dfalster/bin /Users/dfalster/.rbenv/bin $path)
export path
eval "$(rbenv init -)"
Then in new terminal window
rbenv install 1.9.3-p194 # to install newer version of ruby
rbenv rehash
sudo gem install bundler
rbenv rehash # If you use rbenv, rehash to be able to run the bundle
command bundle install
curl get.pow.cx | sh
.
pow creates a local webserver. Give your page a local name, viewable in web browser on your machine,e.g.
cd ~/.pow
ln -s path/to/nicercode/gitrepo nicercode
rake setup_github_pages
git@github.com:nicercode/nicercode.github.com.git
rake new_post\["Trial"\]
edit file produced, e.g. edit source/_posts/2013-03-07-trial.markdown
Preview post using rake preview
#makes viewable in web-browser at
localhost:4000
or nicercode.dev
(if you are using pow)
Other ways to preview are
a. rake generate
#to build site
b. rake watch
#starts process that watches for file updates and
rebuilds.
commit,push to bitbucket
rake deploy
deploys to github
see the Octopress Plugin index for the full list of Octopress plugins.
Use the blockquotes package to format author, source, link for a quote
{% blockquote [author[, source]] [link] [source_link_title] %}
Quote string
{% endblockquote %}
Easily embed gists in your posts or pages using gist Tag package
{% gist 996818 %}