Andrey Hihlovskiy

Professional blog on groovy, gradle, Java, Javascript and other stuff.

Category Archives: git

How to install and use Gollum on vanilla Debian/Ubuntu/Mint machine

Suppose you have a vanilla Debian/Ubuntu/Mint machine and you want to use Gollum – wiki system, built on top of Git and used internally by Gihub wiki pages. Here are the necessary steps:

  1. Install required components from OS repositories:
      sudo apt-get install ruby ruby-dev libz-dev libicu-dev build-essential
      

  2. Install Gollum from gems repository:

      sudo gem install gollum
      

  3. Create test git repository and run Gollum on it:

      mkdir testwiki
      cd testwiki
      git init
      gollum
      

Check: you should see messages like this:

user@host:~/Projects/testwiki$gollum
[2014-05-19 18:58:02] INFO WEBrick 1.3.1
[2014-05-19 18:58:02] INFO ruby 1.9.3 (2012-04-20) [x86_64-linux]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2014-05-19 18:58:02] INFO WEBrick::HTTPServer#start: pid=27319 port=4567

that means: Gollum is up and running on port 4567.

Now you can launch you favourite browser, enter addresss http://localhost:4567 and start editing wiki pages:

Gollum editing home page

Whenever you save a page, Gollum commits it to git repository. Optionally you can add a message to commit.

It is worth noting, that Gollum supports many important markup languages: AsciiDoc, Creole, Markdown, MediaWiki, Org-mode, Pod, RDoc, reStructuredText, Textile.

When wiki pages are ready to be presented to the world, you push them to github wiki pages. Instructions on pushing to a remote repository are found here.

Automated git-pull

Suppose you have 20 git-repositories, which you actively pull and push from/to central location (e.g. github). Don’t you think pulling them by hand is too mechanical? And what if you forget to pull some?

I wrote little gradle script capable of automated git-pull:


buildscript {
repositories { mavenCentral() }
dependencies { classpath 'org.ajoberstar:gradle-git:0.5.0' }
}
import org.ajoberstar.gradle.git.tasks.*
def onEachGitFolder(File folder, Closure closure) {
File gitServiceFolder = new File(folder, ".git")
if(gitServiceFolder.exists() && gitServiceFolder.isDirectory())
closure(folder)
else
folder.eachDir { subFolder ->
onEachGitFolder(subFolder, closure);
}
}
task pull
onEachGitFolder projectDir, { folder ->
def taskName = folder.name + "_pull"
project.task (taskName, type: GitPull) {
setRepoPath folder.absolutePath
}
project.tasks.pull.dependsOn project.tasks[taskName]
}
defaultTasks "pull"

view raw

git-pull.gradle

hosted with ❤ by GitHub

You drink morning coffee and the machine does the job for you.

Credits come to the creators of excellent gradle-git plugin:

https://github.com/ajoberstar/gradle-git