aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-12-27 14:47:22 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-12-27 14:47:22 -0200
commite95b8dbe6be571feb2691e838c340059d1401ab8 (patch)
tree3a30b4981521cf416a7dcaaa57bfcacf9f2b563a
parent03fdeb451b3bf1c63e3f2a725bf9bdb8e137f0a7 (diff)
downloaddotfiles-e95b8dbe6be571feb2691e838c340059d1401ab8.tar.gz
dotfiles-e95b8dbe6be571feb2691e838c340059d1401ab8.tar.bz2
Cleaning up metadot code
-rw-r--r--README.mdwn97
-rwxr-xr-xmetadot106
-rw-r--r--modules/profile/profile.dot.link2
3 files changed, 5 insertions, 200 deletions
diff --git a/README.mdwn b/README.mdwn
index 901c8be..9d4cb0a 100644
--- a/README.mdwn
+++ b/README.mdwn
@@ -1,94 +1,5 @@
-Metadot: modular dotfile management system
-==========================================
+Rhatto's dotfiles bundle
+========================
-Metadot allows you to easilly manage and reuse existing dotfiles repositories
-by simply cloning then to your `~/.dotfiles/modules` and renaming a few files.
-
-By being modular, it's possible to create modules for specific applications
-(vim, mutt, emcas, git, etc). By using git submodules, one can even create her
-own dotfile bundle.
-
-Inspired by [holman does dotfiles](https://github.com/holman/dotfiles) and many
-other initiatives but with a modular design to ease dotfile sharing as the
-`metadot` code is split from the dotfile folder.
-
-Instalation
------------
-
-Get the code:
-
- git clone --recursive git://git.sarava.org/metadot.git
-
-Save the metadot repository anywhere but make sure it's available in your `$PATH`.
-Then get some modules. You can get the whole standard module bundle with:
-
- git clone --recursive git://git.sarava.org/rhatto/dotfiles.git ~/.dotfiles
-
-This bundle will hardly suit all your needs. You can fetch individual modules or even
-start your own bundle:
-
- mkdir -p ~/.dotfiles/modules
- git clone --recursive git://git.sarava.org/rhatto/dotfiles/vim.git ~/.dotfiles/modules/vim
-
-Usage
------
-
-List existing modules:
-
- metadot ls
-
-Load a module:
-
- metadot load <module>
-
-Load all modules:
-
- metadot load --all
-
-Update a module bundle:
-
- metadot update
-
-Backups are made whenever a module is loaded.
-
-Layout
-------
-
-- ~/.dotfiles: where all dotfiles modules are stored
-- ~/.backups: backups of old config files
-- ~/.custom: some modules use this folder where custom configuration can override default parameters
-
-Module format
--------------
-
-Modules rest at ~/.dotfiles/modules and can be git submodules. File format is:
-
- [path/]<name>[.dot][.link]
-
-Which means files
-
-- with a .link extension are linked at $HOME.
-- with a .dot.link extension are converted to a dotfile: vimrc.dot.link is linked as ~/.vimrc.
-- with other extensions are ignored.
-
-Also,
-
-- file structure is preserved: file apps/scripts.link is linked as $HOME/apps/scripts.
-- nested structures are allowed: config.dot/awesome.link is linked as $HOME/.config/awesome
-
-TODO
-----
-
-- Split: metadot, dotfiles and modules should be separate repositories.
-- Profile: automatic $PATH inclusion for installed script repositories.
-- Check if module is correctly installed.
-- Track loaded modules.
-- Module descriptions and dependencies.
-- Module unloading and restoration.
-- Integration with scripts project.
-- More file types:
- - .sample: copied if no origin file exists
- - .sh: added to the profile
- - .mkdir: are simply created
- - .cp: are copied
- - .template: are copied and transformed according to environment or config variables
+This is the bundle repository for rhatto's dotfiles.
+More information at https://git.sarava.org/?p=metadot.git
diff --git a/metadot b/metadot
deleted file mode 100755
index 47af6ac..0000000
--- a/metadot
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/bash
-#
-# metadot: a dotfile management system
-#
-
-# Parameters
-OPT="$1"
-DATE="`date +%Y%m%d%I%M%S`"
-BASENAME="`basename $0`"
-DOT="$HOME/.dotfiles"
-MODULES="$DOT/modules"
-BACKUPS="$HOME/.backups/$DATE"
-
-# Backup a file
-function metadot_backup {
- local file="$HOME/$1"
-
- if [ -e "$file" ] || [ -h "$file" ]; then
- local folder="$BACKUPS/`dirname $1`"
-
- #echo "Backing up `basename $1`..."
- mkdir -p $folder
- mv $file $folder
- fi
-}
-
-# Find contents of a module
-function metadot_find {
- local module="$1"
- ( cd $MODULES/$module && find -name '*.link' -or -name '*.dot.link' ) | sed -e 's|./||'
-}
-
-# Load a module
-function metadot_load {
- local module="$1"
- local destname
- local dirname
-
- if [ -d "$MODULES/$module" ]; then
-
- echo "Loading module $module..."
-
- for file in `metadot_find $module`; do
- echo "Processing $file..."
-
- # Get the dirname, replacing string.dot with .string
- dirname="`echo $file | sed -e 's|\([^/]*\).dot/|.\1/|g'`"
- dirname="`dirname $dirname`"
-
- if echo $file | grep -q '.dot.link'; then
- destname=".`basename $file .dot.link`"
- else
- destname="`basename $file .link`"
- fi
-
- if [ "$dirname" != "." ]; then
- #echo "Creating $HOME/$dirname..."
- mkdir -p $HOME/$dirname
- else
- dirname=""
- fi
-
- metadot_backup "$dirname/$destname"
-
- #echo "Installing symlink $dirname/$destname..."
- ln -s $MODULES/$module/$file $HOME/$dirname/$destname
-
- done
- else
- echo "No such module $module"
- fi
-}
-
-# Parsing.
-if [ -z "$OPT" ]; then
- echo "usage: $BASENAME <option> [arguments]"
- exit 1
-elif [ "$OPT" == "ls" ]; then
- ls -1 $MODULES
-elif [ "$OPT" == "version" ]; then
- ( cd $DOT && git log -n 1 )
-elif [ "$OPT" == "update" ]; then
- if [ -d "$DOT/.git" ]; then
- ( cd $DOT && git pull origin master && git submodule update --init )
- fi
-elif [ "$OPT" == "backup" ]; then
- shift
- metadot_backup $1
-elif [ "$OPT" == "load" ]; then
- shift
-
- if [ -z "$1" ]; then
- echo "usage: $BASENAME load [module(s)|--all]"
- fi
-
- if [ "$1" == "--all" ]; then
- modules="`ls $MODULES`"
- else
- modules="$*"
- fi
-
- for module in $modules; do
- metadot_load $module
- done
- echo "Backups saved at $BACKUPS."
-fi
diff --git a/modules/profile/profile.dot.link b/modules/profile/profile.dot.link
index 5ef25df..cad7fd1 100644
--- a/modules/profile/profile.dot.link
+++ b/modules/profile/profile.dot.link
@@ -17,7 +17,7 @@ fi
# Set PATH
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
-export PATH=$PATH:$HOME/.dotfiles:$HOME/apps/scripts:$HOME/apps/brweather/brweather
+export PATH=$PATH:$HOME/apps/metadot:$HOME/apps/scripts:$HOME/apps/brweather/brweather
# See http://www.caliban.org/bash/#bashtips
export CDPATH=".:~:~/code:~/data:~/file:/var/www/data"