New slogan, reworked to use single packages.yml
This commit is contained in:
parent
f43c047a25
commit
76eb197abb
2 changed files with 74 additions and 102 deletions
174
.$
174
.$
|
@ -13,12 +13,12 @@
|
|||
# .$ push
|
||||
# Commits and pushes local changes for the installed dotfiles
|
||||
|
||||
DOTMONEY=~/.dotmoney
|
||||
dotmoney=~/.dotmoney
|
||||
|
||||
# Checks that our directory exists, if not creates it
|
||||
if [ ! -d $DOTMONEY ];
|
||||
if [ ! -d $dotmoney ];
|
||||
then
|
||||
mkdir $DOTMONEY
|
||||
mkdir $dotmoney
|
||||
fi
|
||||
|
||||
# Checks that a repository is present on install or merge
|
||||
|
@ -31,24 +31,85 @@ then
|
|||
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
|
||||
'install')
|
||||
CLONE=$DOTMONEY/$2
|
||||
clone=$dotmoney/$2
|
||||
|
||||
if [ -d $CLONE ];
|
||||
if [ -d $clone ];
|
||||
then
|
||||
echo "Updating $2...";
|
||||
cd $CLONE
|
||||
cd $clone
|
||||
git pull origin master
|
||||
cd -
|
||||
cd - > /dev/null
|
||||
else
|
||||
echo "Cloning $2...";
|
||||
git clone git@github.com:$2.git $CLONE
|
||||
fi
|
||||
|
||||
echo $CLONE > $DOTMONEY/installed
|
||||
echo $clone > $dotmoney/installed
|
||||
|
||||
# TODO Run the installer
|
||||
install_dotfiles
|
||||
;;
|
||||
|
||||
'merge')
|
||||
|
@ -57,16 +118,16 @@ case $1 in
|
|||
|
||||
'pull')
|
||||
echo "Updating $2...";
|
||||
cd $CLONE
|
||||
cd $clone
|
||||
git pull origin master
|
||||
cd -
|
||||
|
||||
# TODO Run the installer
|
||||
install_dotfiles
|
||||
;;
|
||||
|
||||
'push')
|
||||
echo "Pushing $2...";
|
||||
cd $CLONE
|
||||
cd $clone
|
||||
git push origin master
|
||||
cd -
|
||||
;;
|
||||
|
@ -81,92 +142,3 @@ case $1 in
|
|||
echo ' push - pushes changes for the installed repo'
|
||||
;;
|
||||
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?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue