Get rid of tasks.sh Bump emacs.d for emacs jedi stuff

This commit is contained in:
Ivan Malison 2014-10-10 04:00:19 -07:00
parent f13874c9bf
commit 64688c0382
12 changed files with 163 additions and 193 deletions

2
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "dotfiles/emacs.d"]
path = dotfiles/emacs.d
url = git@github.com:IvanMalison/.emacs.d.git
url = https://github.com/IvanMalison/.emacs.d.git
[submodule "dotfiles/vim/bundle/vundle"]
path = dotfiles/vim/bundle/vundle
url = https://github.com/gmarik/Vundle.vim.git

View File

@ -3,4 +3,4 @@ dotfiles
To get started run:
``curl https://raw.githubusercontent.com/IvanMalison/dotfiles/master/web_start.sh | sh /dev/stdin``
``curl https://raw.githubusercontent.com/IvanMalison/dotfiles/master/start.sh | sh /dev/stdin``

@ -1 +1 @@
Subproject commit bb1807256fd065252eb8c90d2f291e07d042262e
Subproject commit 251dbaed92e52ad5b7322b50cd0b403d2e61ce6c

View File

@ -1,53 +0,0 @@
function install_python_packages() {
easy_install pip
ESSENTIAL=(ipdb ipython virtualenv)
FOR_EDITOR=(jedi pyflakes)
USEFUL=(
Flask
ddg
ouimeaux
readline
simplejson
tox
numpy
)
OPTIND=1
while getopts "uea" OPTCHAR;
do
case $OPTCHAR in
u)
sudo pip install $USEFUL
;;
e)
sudo pip install $FOR_EDITOR
;;
a)
sudo pip install $FOR_EDITOR
sudo pip install $USEFUL
install_pygame
install_powerline
;;
h)
echo "
-u Install useful but non essential python.
-e Install editor python packages.
-a Install all python utilities."
;;
esac
done
sudo pip install $ESSENTIAL
}
function install_pygame() {
sudo pip install numpy
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
/usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame
}
function install_powerline() {
hash pip 2>/dev/null || sudo easy_install pip
if test -z $(pip show Powerline | grep Location | awk '{print $2}');
then
sudo pip install --user git+git://github.com/Lokaltog/powerline
fi
}

View File

@ -1,5 +0,0 @@
readlink_command='readlink'
command -v greadlink > /dev/null && readlink_command="greadlink"
function dotfiles_abspath() {
echo "$(${readlink_command} -f "$BASH_SOURCE" | xargs dirname | xargs dirname)"
}

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
cd "dirname $BASH_SOURCE"
source brew.sh
source npm.sh

127
setup.sh
View File

@ -1,127 +0,0 @@
#!/usr/bin/env bash
cd `dirname $BASH_SOURCE` && source resources/bootstrapping.sh
source dotfiles/lib/shellrc/functions.sh
source dotfiles/lib/shellrc/brew.sh
source dotfiles/lib/shellrc/python.sh
source dotfiles/lib/shellrc/vim.sh
source resources/osx.sh
DOTFILES_DIRECTORY="$(dotfiles_abspath)/dotfiles"
function symlink_dotfiles() {
local overwrite=''
OPTIND=1
while getopts "o" OPTCHAR;
do
case $OPTCHAR in
o)
overwrite='yes'
;;
esac
done
cd $DOTFILES_DIRECTORY
[ -a ~/.dotfiles-backups ] && mv ~/.dotfiles-backups ~/.dotfiles-backups.old
mkdir ~/.dotfiles-backups
for filename in *; do
local link_destination="$HOME/.$filename"
local link_target=$(${readlink_command} -f $filename)
echo "linking $link_destination to $link_target"
# Using only test -e doesn't work here because it will return
# false if the destination of the symbolic link at does not exist.
test -e $link_destination || test -L $link_destination && test $overwrite && mv $link_destination ~/.dotfiles-backups && ln -si $link_target $link_destination
done
[ -a ~/.dotfiles-backups.old ] && mv ~/.dotfiles-backups.old ~/.dotfiles-backups/.dotfiles-backups
}
function apt-get() {
INSTALL="sudo apt-get -y install"
$INSTALL zsh
$INSTALL tmux
$INSTALL emacs24-nox
$INSTALL nmap
$INSTALL python2.7
$INSTALL python-pip python-dev
}
function setup_help() {
echo "setup Usage:
-a Install apt-get packages.
-o Run OSX configuration commands.
-s Symlink dotfiles to home directory.
-b Install brew packages.
-p Install python packages.
-v Setup vim.
-e Do absolutely everything with the most aggresive options.
-h display this help message."
}
function get_command_line_tools() {
hash gcc 2> /dev/null || xcode-select --install
}
function setup() {
if [[ $# -eq 0 ]] ; then
setup_help
exit 0
fi
while getopts "acosbpev" OPTCHAR;
do
local real_opt_ind=$OPTIND
case $OPTCHAR in
a)
source resources/apt-get.sh
;;
b)
get_command_line_tools
if get_brew; then
do_the_brew_help
read -p "Enter flags for brew package installation:
"
[[ $REPLY[0] != '-' ]] && REPLY="-$REPLY"
do_the_brew $REPLY
fi
;;
o)
sudo -v
osx_config
;;
s)
symlink_dotfiles -o
;;
p)
install_python_packages -h
read -p "Enter flags for python package installation"
if [[ $REPLY[0] != '-' ]]; then
REPLY="-$REPLY"
fi
install_python_packages $REPLY
;;
e)
case $(uname) in
Darwin)
get_command_line_tools
get_brew && do_the_brew -au
osx_config
;;
Linux)
apt-get
;;
esac
install_python_packages -a
symlink_dotfiles
vimstall
;;
v)
vimstall
;;
h)
setup_help
return
;;
esac
OPTIND=$real_opt_ind
done
}
setup $@

19
web_start.sh → start.sh Executable file → Normal file
View File

@ -1,8 +1,17 @@
#!/bin/bash
function fedora() {
yum install make automake gcc gcc-c++ kernel-devel
yum install
yum install python-pip
}
function debian() {
hash apt-get &>/dev/null || (echo 'apt-get is missing.' && exit)
sudo apt-get -y install build-essential
sudo apt-get -y install git
sudo apt-get -y install python
sudo apt-get install python-pip
}
function brew_for_multiple_users() {
@ -23,14 +32,21 @@ function osx() {
brew_for_multiple_users
brew update
brew install git
brew install python
easy_install pip
}
function go() {
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
git clone https://github.com/IvanMalison/dotfiles.git
cd dotfiles
./setup.sh -e
sudo pip install dotfiles
sudo pip install invoke
invoke setup
}
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
case `uname` in
'Darwin')
osx
@ -39,4 +55,5 @@ case `uname` in
debian
;;
esac
go

56
tasks/__init__.py Normal file
View File

@ -0,0 +1,56 @@
import os
import sys
from invoke import Collection, ctask
from . import osx
from . import linux
from .util import DOTFILES_DIRECTORY, RESOURCES_DIRECTORY
ns = Collection()
ns.add_collection(osx)
ns.add_collection(linux)
@ctask(default=True)
def setup(ctx):
ctx.config['run']['pty'] = False
ctx.config['run']['warn'] = True
if 'darwin' in sys.platform:
osx.all(ctx)
else:
linux.all(ctx)
dotfiles(ctx, '')
install_python_libraries(ctx)
@ctask
def dotfiles(ctx, flags):
ctx.run('hash dotfiles || sudo pip install dotfiles')
return ctx.run('dotfiles -sR{1} {0}'.format(DOTFILES_DIRECTORY, flags))
@ctask
def install_python_libraries(ctx):
ctx.run('sudo pip install -r {0}'.format(
os.path.join(RESOURCES_DIRECTORY, 'requirements.txt')
))
@ctask
def install_npm_libraries(ctx):
ctx.run('source {0}'.format(
os.path.join(RESOURCES_DIRECTORY, 'npm.sh')
))
@ctask
def vimstall(ctx):
ctx.run('vim +BundleInstall! +q +q')
ns.add_task(dotfiles)
ns.add_task(setup)
ns.add_task(install_python_libraries)
ns.add_task(vimstall)

14
tasks/linux.py Normal file
View File

@ -0,0 +1,14 @@
from invoke import ctask
@ctask(default=True)
def all(ctx):
apt_get(ctx)
linux_pacakges = ('zsh', 'tmux', 'emacs24-nox', 'nmap', 'scala', 'sbt')
@ctask
def apt_get(ctx):
install_command = 'sudo apt-get -y install'
for package in linux_pacakges:
ctx.run('{0} {1}'.format(install_command, package), pty=False)

60
tasks/osx.py Normal file
View File

@ -0,0 +1,60 @@
import os
from invoke import ctask
from .util import RESOURCES_DIRECTORY, command_exists
@ctask(default=True)
def all(ctx):
get_command_line_tools(ctx)
get_brew(ctx)
brew_install(ctx)
brew_cask(ctx)
osx_config(ctx)
ESSENTIAL = (
"emacs", "tmux", "python --with-brewed-openssl", "htop", "greadlink", "zsh", "make",
"macvim --override-system-vim --custom-system-icons --with-features=huge "
"--enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-cscope"
)
BASICS=(
"findutils", "coreutils", "binutils", "diffutils", "ed --default-names",
"gawk", "gnu-indent --default-names", "gnu-sed --default-names",
"gnu-tar --default-names", "gnu-which --default-names", "gnutls --default-names",
"grep --default-names", "gzip", "watch", "wdiff --with-gettext", "wget --enable-iri"
)
SHOULD_INSTALL = (
"nmap", "readline", "netcat", "reattach-to-user-namespace", "daemonize",
"ngrep", "gist", "gawk", "pstree", "ack", "hub", "tig", "heroku", "scala",
"sbt", "node", "npm"
)
MISC = ("file-formula", "less", "openssh --with-brewed-openssl",
"perl518", "rsync", "svn", "unzip")
CASKS = ('alfred', 'caffeine', 'flux', 'google-chrome', 'iterm2', 'spotify', 'vlc',)
@ctask
def osx_config(ctx):
ctx.run('source {0}; osx_config'.format(os.path.join(RESOURCES_DIRECTORY, 'osx.sh')))
@ctask
def brew_cask(ctx):
ctx.run('brew install caskroom/cask/brew-cask')
for cask in CASKS:
ctx.run('brew cask install {0}'.format(cask))
@ctask
def get_brew(ctx):
if not command_exists('brew'):
ctx.run('ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"')
@ctask
def brew_install(ctx):
for package_name in ESSENTIAL + BASICS + SHOULD_INSTALL + MISC:
ctx.run('brew install {0}'.format(package_name))
@ctask
def get_command_line_tools(ctx):
if not command_exists('gcc'):
ctx.run('xcode-select --install')

12
tasks/util.py Normal file
View File

@ -0,0 +1,12 @@
import os
from invoke import run
REPO_DIRECTORY = os.path.dirname(os.path.dirname(__file__))
DOTFILES_DIRECTORY = os.path.join(REPO_DIRECTORY, 'dotfiles')
RESOURCES_DIRECTORY = os.path.join(REPO_DIRECTORY, 'resources')
def command_exists(command, run=run):
return run("hash {0}".format(command), warn=True, hide=True).exited == 0