HFAM
Hidden Files Are Manageable - Manage, source and reload you dotfiles in a specific directory
- You create/clone your
dotfiles
. - You edit a
dotfiles/.hfamconfig
file with its intuitive DSL. - You call
hfam
.
The main advantage of this tool is that you can easily move your dotfiles
from a machine to another one. Then, with only one command, you can configure your environment.
Prerequisites
you need to install ruby
:
?> \curl -sSL https://get.rvm.io | bash -s stable
?> rvm install ruby-head
Check if ruby
is installed:
?> ruby --version
Install
?> gem install hfam
I recommend you to put all your dotfiles
in a Git repository named dotfiles
.
clone your repo and add a file named .hfamconfig
.
Usage
Example
~/
|- dotfiles/
|- gitconfig
|- zshrc
|- .hfamconfig
Options
Option -h --help
Display the usage:
?> hfam --help
HFAM - Hidden Files Are Manageable
Centralize your dotfiles in one directory and manage them using some basic operations (symlink, source, ...)
This tool attempts to locate a ~/dotfiles/.hfamconfig file. Then it executes a set of commands
listed in the config file.
For further information: https://github.com/mehdi-farsi/hfam
USAGE:
hfam [-h|--help] [-p|--path]
OPTIONS:
-h # help
-p # change the default dotfiles path
Option -p --path
Change the default dotfiles path.
?> hfam --path /Users/zoidberg/Documents/dotfiles
Symlink: ln -s /Users/mehdi/Documents/dotfiles/testpath /Users/zoidberg/Documents/dotfiles/.testpath
The path set by --path option is the default symlink target path. use the DSL symlink option
:dest
to override this path.
Hfamconfig
hfam
works with a .hfamconfig
file. This config file provide an intuitive DSL for managing your dotfiles.
Only the files defined in
.hfamconfig
will be treated.
For the following examples, let's say that the following environment variables are set with the following values:
HOME=/Users/zoidberg
SHELL=/bin/zsh
Now, let's have look to the .hfamconfig
DSL.
Symlink
The symlink
command creates a symlink with the source file passed as argument. The symlink target is created in $HOME/.target
.
Example:
In $HOME/dotfiles/.hfamconfig
symlink "gitconfig" # you can add a comment using '#'
Then
?> hfam
Symlink: ln -s /Users/zoidberg/dotfiles/gitconfig /Users/zoidberg/.gitconfig
?> ls -l $HOME/.gitconfig
/Users/zoidberg/.gitconfig -> /Users/zoidberg/dotfiles/gitconfig
The symlink
command accepts another argument to specify the destination's directory. This arguments is named dest
.
Example:
symlink "gitignore", dest: "/Users/zoidberg/apps/my_app/.gitignore"
Then
?> hfam
Symlink: ln -s /Users/mehdi/dotfiles/gitignore /Users/zoidberg/apps/my_app/.gitignore
/!\ If the source file is not a dotfile, the prefix
.
is automatically prepended to the target file?> ls -l $HOME/.gitconfig lrwxr-xr-x 1 lol cat 27B Nov 11 16:35 .gitconfig -> /Users/zoidberg/dotfiles/gitconfig
Source
The source
command creates a symlink using the file passed as argument and source the symlink target. The symlink target file is defined at $HOME/.target
.
Example:
In $HOME/dotfiles/.hfamconfig
source "zshrc"
Then
?> hfam
Symlink: ln -s /Users/zoidberg/dotfiles/zshrc /Users/zoidberg/.zshrc
Source: /bin/zsh -c 'source /Users/zoidberg/.zshrc'
?>
/!\ The SHELL env variable is used to defined the current shell. If the default shell is
dash
, then it uses the '.' command to source the file. Else, it uses thesource
command. If the SHELL is a symlink to another shell, then it reach the real shell targeted by the symlink: for further information
Development
After checking out the repo, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/mehdi-farsi/activerecord-search.
We have a lot of idea that we put in the issue list. Feel free to have a look to it.
License
The gem is available as open source under the terms of the MIT License.
Please, feel free to star the project if you like it ! :)