https://github.com/richfitz/ghwiki
Tools for pushing files generated by R to a github wiki
https://github.com/richfitz/ghwiki
Last synced: over 1 year ago
JSON representation
Tools for pushing files generated by R to a github wiki
- Host: GitHub
- URL: https://github.com/richfitz/ghwiki
- Owner: richfitz
- License: other
- Created: 2014-05-09T03:11:25.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-21T10:02:19.000Z (about 12 years ago)
- Last Synced: 2025-02-02T18:25:00.579Z (over 1 year ago)
- Language: Shell
- Size: 168 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wiki Workflow
[](https://travis-ci.org/richfitz/ghwiki)
This package sets up a lab notebook on a GitHub wiki by running a series of R scripts and knitr documents, collecting figures and updating a wiki. It has grown out of a set of scripts, but is currently used across many of my (not-yet-open) research projects.
The wiki for [rodeint](https://github.com/richfitz/rodeint) is updated
using ghwiki. [This page](https://github.com/richfitz/rodeint/wiki/compiled) was
generated from [this script](https://github.com/richfitz/rodeint/blob/master/tutorial/compiled.R) and can be recomputed and updated by running a single command.
ghwiki needs to be used within a project that is a git repository. The git repository must have a github remote, and the *first* remote that has a github url will be used. The remote must *already* have a wiki.
Install with (from R)
```
devtools::install_github("richfitz/ghwiki")
```
Initialise with
```
Rscript -e "ghwiki::init()"
```
This will also clone the github wiki into a directory 'wiki' in the project root. If the command failed (e.g., the wiki was not initialised yet),
pull down the project wiki manually with:
```
make wiki_clone
```
Add names of `R` or `Rmd` scripts to the file `.wiki_scripts`. A template is generated by running the command above. Blank lines and lines beginning with "#" are ignored, and whitespace is trimmed. If `.md` files are added, they will be copied to the wiki, along with any figures named following the same conventions we convince knitr to follow. At the moment, any file *not* ending with `.R`, `.Rmd` or `.md` is simply ignored.
Run
```
make
```
to run all the scripts listed in `.wiki_scripts`, generating `md` files, figures etc. A bunch of knit tweaks are applied to normalise figure paths, improve default settings, etc.
Run
```
make wiki_update
```
to update the local copy of the wiki repo, and
```
make wiki_publish
```
to push it up. You're on your own with resolving conflicts. Other make targets:
* `make clean` -- clean up generated .md and .Rmd files.
* `make wiki_rollback` -- undo a commit in the wiki repo
* `make wiki_reset` -- destructively clean up an unclean state in the wiki repo
Other commands can be run via `./.ghwiki`:
* `./.ghwiki reset_to ` -- move the wiki to a particular SHA (can undo a rollback this way)
* `./.ghwiki git [commands]` -- run git commands in the wiki repo (e.g., `./.ghwiki git log`)
And yet more commands via `./.ghwiki scripts`
* `./.ghwiki scripts list` -- list of scripts that we know about
* `./.ghwiki scripts base` -- basename of the scripts (without extension)
* `./.ghwiki scripts generated_Rmd` -- `Rmd` files that are candidates for deletion during cleanup
* `./.ghwiki scripts targets` -- list of `md` files that will be generated by `make`.
If you get fed up with typing `./.ghwiki` (which gets tedious) run
```
Rscript -e "ghwiki:::install_scripts('~/bin')"
```
which will install the scripts `ghwiki` into "~/bin" (assuming that it exists!). If that is in your `$PATH` then you can run `ghwiki git log` and things like that. Note that these scripts just redirect to the true scripts within the package, so can be left in place through package upgrades -- the scripts that are run are those in the package.