Archive

Posts Tagged ‘redgit’

Redmine Command Line Interface – redlist

May 27th, 2013 subogero Comments off

redupload, redupdate, redshow, and now redlist. The new one prints the list of issues in plain text, project-wise or globally.

$ redlist -p test localhost/redmine
# Tracker Status      Subject      Assignee      Due date   
2 Feature In Progress Test Feature Szabó Gergely            
1 Bug     In Progress Test Issue   Szabó Gergely 2013-05-26

Uploading files? Check.
Creating or updating issues? Check.
Showing issue details? Check.
Listing issues? Check.

Redlist uses the CSV export feature of Redmine. As Text::CSV is not part of the standard Perl library, I decided to write my own CSV parser. It seemed easy until I tried it on an old mine, 0.9.3 to be precise. In which case it fell apart as the bastard puts each and every existing attribute into the CSV, including the multiline Description. What started with two simple regular expressions, ended up with five, plus a state-machine.

There was some trouble with encoding too. For best results, set your terminal’s locale to utf-8, as well as Redmine’s csv-encoding. On Debian, the yml files are in /usr/share/redmine/config/locales/ for each language. Look for

   general_csv_encoding: UTF-8

Bot the old mine’s output is still too wide for a terminal. Until you define your personal filters, that is. Create ~/.redgit and add

[redlist]
Created
Updated
Description
Parent task
Estimated time

Whatever. It’s still on Github: http://github.com/subogero/redgit

Redmine Command Line Interface – redupdate

May 19th, 2013 subogero Comments off

We love Redmine. It’s everyone’s favourite integrated bug-tracker-wiki-gantt-roadmap-web-app running on Rails. It has everything. Except a decent command line interface.

There are some half-baked attempts on the internet, usually having suffered a few years’ time of bitrot and featuring loads of undocumented Ruby-related dependencies, so-called gems in Ruby-speak. I tried to install a few, but not being a hard-core Rubyist, I had to give up.

Long ages of desperation followed. Until I looked into Redmine’s email interface. Which, it turns out, is a command-line interface in disguise. I decided to leave Exim4 well alone, and write a user friendly command line wrapper around the obvious

/usr/share/redmine/extra/mail_handler/rdm-mailhandler.rb

My first attempt was a server-side only shell-script. But then I realized that any self-respecting person who uses the command-line has some sort of shell access to the Redmine server anyway, which also accommodates the central-ish git repos. So I added an option to run via SSH.

Ladies and Gentlemen: redupdate

Please find it on Github along with a few other scripts:
https://github.com/subogero/redgit

The other scripts include:

  • redupload: upload files to Redmine
  • redshow: view issues in plain text format
  • gitcreate: create bare repo, add HTTP access, optional email notification upon pushes