Peridot
Peridot let's you manage your dotfiles with rake
and you should love rake
!
Seriously!
Installation
Install it yourself via:
$ gem install peridot
Usage
In your Rakefile require Peridot. If run inside rake, it will automagically include Peridot module:
require 'peridot'
After this, copy the following to a fresh Rakefile:
require 'rubygems'
require 'peridot'
After this Peridot provides you with 2 standard tasks:
$ rake -T
rake dotfiles # Runs all your task in the dotfiles namespace
rake watch # Watches for changes and reruns rake
Peridot runs every task under dotfiles
namespace if you run the dotfiles
task.
Features
Peridot gives you some methods for interacting with your dotfiles.
Path helpers
There are #repo_file
and #home_file
to give you the full paths to your
files.
ERB
There is a convenience method to generate a regular files from erb input.
generate_file repo_file('gitconfig.erb'), home_file('.gitconfig')
Watch for changes
You can add a special task watch
to your rake command to have Peridot
watch for changes and rerun your rake command.
Ignoring files
With #ignored_files
there is a standard list of files and filetypes
which can be matched (regexp) again certain files with #ignored?(file)
.
ignored_files << 'README'
link_file(from, to) unless ignored?('README')
FileUtils
All methods from FileUtils
are included in the global namespace and can be
used for mastering your dotfiles.
Configuration
If you need to have some configuration in place you are free to use environment variables. Dotenv can also be used by making it a dependency of your task.
require 'dotenv/tasks'
task :zsh => :dotenv do …
You can even raise an exception if a required configuration file is missing.
require 'dotenv'
Dotenv.load! '~/.env'
Examples in the wild
Special Thanks
- Daniel Bayerlein (@danielbayerlein) - For support, code review and much more
- Jim Weirich (@jimweirich) - for creating Rake
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright
Copyright (c) 2014 Sven Winkler. See LICENSE for details.