Skip to content
justone edited this page Sep 10, 2012 · 5 revisions

Information on hacking dfm.

Getting started

Fork this repo and clone it on your system.

user@host:~$ git clone git@github.com:user/dfm.git
user@host:~$ cd dfm

If you'd like to try the code out on your own dotfiles, there are two ways of doing so.

Auto-detected dotfiles

If your dotfiles repository is either .dotfiles or dotfiles in your home directory, dfm will automatically detect that directory and use it for any processing.

user@host:~/dfm$ ls -d ~/.dotfiles
/home/user/.dotfiles
user@host:~/dfm$ ls -d ~/.dotfiles/.git
/home/user/.dotfiles/.git
user@host:~/dfm$ ./dfm status
# On branch master
nothing to commit (working directory clean)

DFM_REPO override

If your dotfiles repository is located somewhere else, setting the DFM_REPO environment variable to the full path of the repository and dfm will find it.

user@host:~/dfm$ ls -d ~/.mydots
/home/user/.mydots
user@host:~/dfm$ DFM_REPO=~/.mydots ./dfm status
# On branch master
nothing to commit (working directory clean)

Tests

Tests for dfm are in the t subdirectory. They are fairly comprehensive and are run on each commit by Travis.

The tests require a few modules from CPAN:

Contributing back to the main repo

Contributing back to the main repo for dfm can be done any of the following ways:

  • Github pull request (preferred)
  • Emailed patch ('nate' at the domain on my profile page)

why is dfm written in perl

dfm is written in perl for a few reasons:

  • perl 5.8.x (at least) is installed by default on every UNIX-like system.
  • Perl is great at this sort of thing
  • I use perl at my day job

Also, dfm doesn't use any modules other than those that ship with perl 5.8.x. This chief constraint means that dfm can run on any system without needing to first install dozens of modules. CPAN is a great resource for sharing reusable bundles of code, but not for this application. Having no other dependencies than what is core means that getting up and running on a new system requires two things: git and dfm.

It's OK to use CPAN modules in tests as it is understood that developing dfm usually only happens on one or two machines.