New slogan, reworked to use single packages.yml

This commit is contained in:
Joshua Sherman 2014-02-01 18:04:31 -05:00
parent f43c047a25
commit 76eb197abb
2 changed files with 74 additions and 102 deletions

174
.$
View file

@ -13,12 +13,12 @@
# .$ push # .$ push
# Commits and pushes local changes for the installed dotfiles # Commits and pushes local changes for the installed dotfiles
DOTMONEY=~/.dotmoney dotmoney=~/.dotmoney
# Checks that our directory exists, if not creates it # Checks that our directory exists, if not creates it
if [ ! -d $DOTMONEY ]; if [ ! -d $dotmoney ];
then then
mkdir $DOTMONEY mkdir $dotmoney
fi fi
# Checks that a repository is present on install or merge # Checks that a repository is present on install or merge
@ -31,24 +31,85 @@ then
fi fi
fi fi
install_dotfiles()
{
# Checks if we have a packages.yml
dotfiles=`cat $dotmoney/installed`
packages=$dotfiles/packages.yml
if [ -e $packages ];
then
cat $packages | while read package
do
if [[ $package =~ :$ ]];
then
manager=`echo $package | tr -d ':'`
# Installs `brew` if on OSX and it's not installed
if [[ `uname` == 'Darwin' && `which brew` == '' ]];
then
echo 'Installing `brew`...'
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
mkdir -p ~/Library/LaunchAgents
fi
echo "Installing \`$manager\` packages..."
else
package=`echo $package | sed -e 's/-//'`
case $manager in
'apt')
if [ -e /etc/debian_version ];
then
sudo aptitude install $package
fi
;;
'brew')
brew install $package
;;
# TODO
# 'composer')
# ;;
'gem')
sudo gem install $package
;;
'npm')
npm install -g $package
;;
*)
echo "Error: Unsupported package manager - $manager"
exit;
;;
esac
fi
done
fi
}
case $1 in case $1 in
'install') 'install')
CLONE=$DOTMONEY/$2 clone=$dotmoney/$2
if [ -d $CLONE ]; if [ -d $clone ];
then then
echo "Updating $2..."; echo "Updating $2...";
cd $CLONE cd $clone
git pull origin master git pull origin master
cd - cd - > /dev/null
else else
echo "Cloning $2..."; echo "Cloning $2...";
git clone git@github.com:$2.git $CLONE git clone git@github.com:$2.git $CLONE
fi fi
echo $CLONE > $DOTMONEY/installed echo $clone > $dotmoney/installed
# TODO Run the installer install_dotfiles
;; ;;
'merge') 'merge')
@ -57,16 +118,16 @@ case $1 in
'pull') 'pull')
echo "Updating $2..."; echo "Updating $2...";
cd $CLONE cd $clone
git pull origin master git pull origin master
cd - cd -
# TODO Run the installer install_dotfiles
;; ;;
'push') 'push')
echo "Pushing $2..."; echo "Pushing $2...";
cd $CLONE cd $clone
git push origin master git push origin master
cd - cd -
;; ;;
@ -81,92 +142,3 @@ case $1 in
echo ' push - pushes changes for the installed repo' echo ' push - pushes changes for the installed repo'
;; ;;
esac esac
exit
# Installs dotfiles
# Clones repo from github to ~/.dotfiles/username/repo
# Installs package managers and packages
# aptitude
if [ -e /etc/debian_version ];
then
APTFILE=${DOTFILES}apt
# Checks that we have an aptitude file
if [ -e $APTFILE ];
then
# Installs packages
echo 'Installing `aptitude` packages...'
cat $APTFILE | while read package
do
sudo aptitude install $package
done
fi
# brew
elif [ `uname` == 'Darwin' ];
then
BREWFILE=${DOTFILES}brew
# Checks that we have a brew file
if [ -e $BREWFILE ];
then
# Installs `brew` if not installed
if [ `which brew` == '' ];
then
echo 'Installing `brew`...'
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
mkdir -p ~/Library/LaunchAgents
fi
# Installs packages
echo 'Installing `brew` formulas...'
cat $BREWFILE | while read package
do
brew install $package
done
fi
fi
# TODO composer
# gem
GEMFILE=${DOTFILES}gem
# Checks that we have a gem file
if [ -e $GEMFILE ];
then
# Installs packages
echo 'Installing gems...'
cat $GEMFILE | while read package
do
sudo gem install $package
done
fi
# npm
NPMFILE=${DOTFILES}npm
# Checks that we have a gem file
if [ -e $NPMFILE ];
then
# Installs packages
echo 'Installing `npm` packages...'
cat $NPMFILE | while read package
do
npm install -g $package
done
fi
# TODO pip
# Symlinks files and directories or whatever we're going to do
# Merge dotfiles
# Clones repo from github to ~/.dotfiles/username/repo
# ...
# Merges stuff in?

View file

@ -1,4 +1,4 @@
dotmoney dotmoney
======== ========
You're so money and you don't even know it. This dotfiles package manager is so awesome that it doesn't even make cents.