Using Redmine with RStudio
Redmine is a great tool for tracking project progress and bugs. With a little configuration it can integrate git repositories and integrate with R program / package development. The following assumes that Redmine, R and RStudio server are all configured and working.
Linking a repository to Redmine
Without changing file permissions, Redmine cannot interact directly with git repositories created in RStudio server. A simple workaround is to clone the repository. In this example we'll create a clone for a repository under ~/codes/redmine_demo
1# ~/git_redmine_clones is a directory to hold the clones
2cd ~/git_redmine_clones
3
4# clone the repository
5git clone --mirror ~/codes/redmine_demo
6
7# set folder content permissions
8chmod a+r -R redmine_demo.git
This repository can now be added to a Redmine project through Settings->Repository. The path to the repository needs to be filled out in full.
Updating clone via cron job
One caveat to this approach is that as changes are made to the repository they are not reflected in Redmine. This can be overcome by adding a cron job that automatically fetches any new commits and updates the clone. Changes are visible in Redmine when the clone is updated.
1# use nano as the cron editor
2export EDITOR=nano
3
4# edit crontab file
5crontab -e
The following line should be aded to the crontab file:
*/5 * * * * cd ~/git_redmine_clones/redmine_demo.git && git fetch -q --all –p
This states that the active directory should be changed to ~/git_redmine_clones/redmine_demo.git and then a git fetch command is run. The timing in the crontab file dictates that this will be run every 5 minutes.