aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-12-28 13:29:40 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-12-28 13:29:40 -0200
commit3f145c0dfe21cc3d9d477d980d2322a728732753 (patch)
tree3b3267120b51e960e500f1e06086dc9b6fd5205a
parent0c8cbbc0ea7c6ae56758f21c5678a44c1e1888f2 (diff)
downloadmetadot-3f145c0dfe21cc3d9d477d980d2322a728732753.tar.gz
metadot-3f145c0dfe21cc3d9d477d980d2322a728732753.tar.bz2
Enhancing 'update', adding 'clone' and 'create'
-rw-r--r--README.mdwn34
-rwxr-xr-xmetadot31
2 files changed, 53 insertions, 12 deletions
diff --git a/README.mdwn b/README.mdwn
index b3c0560..0eabca7 100644
--- a/README.mdwn
+++ b/README.mdwn
@@ -8,27 +8,39 @@ 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.
+It was 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
+ git clone 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:
+Then get some modules. You can get the whole standard module bundle with
- git clone --recursive git://git.sarava.org/rhatto/dotfiles.git ~/.dotfiles
+ metadot clone git://git.sarava.org/rhatto/dotfiles.git
-This bundle will hardly suit all your needs. You can fetch individual modules or even
-start your own bundle:
+Modules names as `dotfiles` have a special meaning and are handled like bundles
+and are cloned directly as `~/.dotfiles`.
- mkdir -p ~/.dotfiles/modules
- git clone --recursive git://git.sarava.org/rhatto/dotfiles/vim.git ~/.dotfiles/modules/vim
+Third-party bundled modules will hardly suit your needs, so you can fetch
+individual modules:
+
+ metadot clone git://git.sarava.org/rhatto/dotfiles/vim.git
+
+Or even start your own:
+
+ metadot create vim
+
+In both cases your `vim` module will be available at `~/.dotfiles/modules/vim`.
+
+You can use just one bundle at a time. While you can mixed a bundle with
+individual modules, it's more sane to just start your own bundle and keep
+modules as git submodules.
Usage
-----
@@ -45,7 +57,7 @@ Load all modules:
metadot load --all
-Update a module bundle:
+Update a module bundle or all individual modules:
metadot update
diff --git a/metadot b/metadot
index 47af6ac..1736c18 100755
--- a/metadot
+++ b/metadot
@@ -81,11 +81,40 @@ 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 )
+ ( cd $DOT && git pull origin master && git submodule update --init --recursive )
+ else
+ for module in `ls $MODULES`; do
+ ( cd $MODULES/$module && git pull origin master && git submodule update --init --recursive )
+ done
fi
elif [ "$OPT" == "backup" ]; then
shift
metadot_backup $1
+elif [ "$OPT" == "clone" ]; then
+ shift
+ if [ "`basename $1 .git`" == "dotfiles" ]; then
+ metadot_backup $DOT
+ git clone --recursive $1 $DOT
+ echo "Backups saved at $BACKUPS."
+ else
+ mkdir -p $MODULES
+ git clone --recursive $1 $MODULES/`basename $1 .git`
+ fi
+elif [ "$OPT" == "create" ]; then
+ shift
+ mkdir -p $MODULES/$1
+ (
+ cd $MODULES/$1
+ git init
+
+ echo "# $1 dotfile module" > README.mdwn
+ echo "" >> README.mdwn
+ echo "This is the repository for $1 configuration." >> README.mdwn
+ echo "More information at https://git.sarava.org/?p=metadot.git" >> README.mdwn
+
+ git add .
+ )
+ echo "Metadot skeleton module $1 created at $MODULES/$1"
elif [ "$OPT" == "load" ]; then
shift