From b775752068d5de5e64c1e65f34b489ca627dc83d Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 9 Nov 2014 22:18:16 -0800 Subject: [PATCH] Tweaks, add rvm add other things to bootstrap. --- dotfiles/bash_profile | 2 +- dotfiles/bashrc | 3 +++ dotfiles/cider/bootstrap.json | 3 +++ dotfiles/emacs.d | 2 +- dotfiles/lib/python/wifi_auto_switch.py | 7 ++++-- dotfiles/lib/shellenv.sh | 33 +++++++++++++++++++++++++ dotfiles/slate.js | 20 ++++++++------- dotfiles/zshenv | 31 +---------------------- dotfiles/zshrc | 2 ++ tasks/osx.py | 5 ++++ 10 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 dotfiles/lib/shellenv.sh diff --git a/dotfiles/bash_profile b/dotfiles/bash_profile index ea05214a..86795d70 100644 --- a/dotfiles/bash_profile +++ b/dotfiles/bash_profile @@ -1 +1 @@ -source ~/.bashrc \ No newline at end of file +source ~/.bashrc diff --git a/dotfiles/bashrc b/dotfiles/bashrc index 3394cbc0..b287fb90 100644 --- a/dotfiles/bashrc +++ b/dotfiles/bashrc @@ -1,2 +1,5 @@ +source ~/.lib/shellenv.sh source ~/.lib/shellrc.sh source ~/.lib/bash.sh + +export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting diff --git a/dotfiles/cider/bootstrap.json b/dotfiles/cider/bootstrap.json index 0bcc5602..9f75e8a9 100644 --- a/dotfiles/cider/bootstrap.json +++ b/dotfiles/cider/bootstrap.json @@ -82,6 +82,9 @@ "icu4c", "intltool", "jpeg", + "rvm", + "bundler", + "foreman", "less", "libevent", "libffi", diff --git a/dotfiles/emacs.d b/dotfiles/emacs.d index 30d80f49..fe9a06ee 160000 --- a/dotfiles/emacs.d +++ b/dotfiles/emacs.d @@ -1 +1 @@ -Subproject commit 30d80f4998d74155818e6db48bc5c8d17c4926ae +Subproject commit fe9a06eebcc31f846251c4a11b04526ff0bd7e01 diff --git a/dotfiles/lib/python/wifi_auto_switch.py b/dotfiles/lib/python/wifi_auto_switch.py index dadcc123..22523497 100644 --- a/dotfiles/lib/python/wifi_auto_switch.py +++ b/dotfiles/lib/python/wifi_auto_switch.py @@ -139,6 +139,7 @@ class WiFiAutoSwitcher(object): if 'SSID' in status_dict: network = self._networks.get(status_dict['SSID']) if network is None: + # Don't do anything if the current network is not recognized return if not network or network.should_switch(status_dict): log.debug("Attempting to switch networks from {0}, ".format( @@ -171,12 +172,14 @@ if __name__ == '__main__': log_util.enable_logger(__name__) parser = argparse.ArgumentParser() parser.add_argument('-n', '--network', nargs='+', type=str, action='append', dest='networks') - network_pairs = parser.parse_args().networks + parser.add_argument('-s', '--sleep-time', type=int, dest='sleep_time') + args = parser.parse_args() + network_pairs = args.networks for network_pair in network_pairs: assert len(network_pair) == 2 auto_switcher = WiFiAutoSwitcher( [Network(*ssid_password) for ssid_password in network_pairs] ) while True: - time.sleep(4) + time.sleep(args.sleep_time) auto_switcher.switch_if_necessary() diff --git a/dotfiles/lib/shellenv.sh b/dotfiles/lib/shellenv.sh new file mode 100644 index 00000000..5846f33b --- /dev/null +++ b/dotfiles/lib/shellenv.sh @@ -0,0 +1,33 @@ +source ~/.lib/shellrc/functions.sh +function add_to_front_of_path { + export PATH=$@:$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||") +} + +function add_to_back_of_path { + export PATH=$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||"):$@ +} + +add_to_back_of_path "$HOME/.local/lib/python2.6/site-packages" +add_to_back_of_path "$HOME/.rvm/bin" +hash brew 2>/dev/null && add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin" +add_to_front_of_path "/usr/local/bin" +hash brew 2>/dev/null && add_to_front_of_path "$(brew --prefix emacs)/libexec/gnubin" + +if is_osx; then + export CFLAGS=-Qunused-arguments + export CPPFLAGS=-Qunused-arguments + add_to_back_of_path "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/" + export JAVA_HOME="$(find /Library/Java/JavaVirtualMachines -depth 1 | head -n 1)/Contents/Home" + # Access gnu man pages. + hash brew 2> /dev/null && export MANPATH="$(brew --prefix)/opt/coreutils/libexec/gnuman:$MANPATH" +else + export JAVA_HOME="$(update-alternatives --config java | get_cols ' -1' | head -n 1)" + is_osx && export VISUAL="which emacsclient -c -n" +fi + +add_to_front_of_path "$JAVA_HOME/bin" + +add_to_back_of_path "$(dotfiles_directory)/resources/python" +add_to_back_of_path "/usr/local/sbin" + +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* diff --git a/dotfiles/slate.js b/dotfiles/slate.js index 32f54a34..30512dee 100644 --- a/dotfiles/slate.js +++ b/dotfiles/slate.js @@ -1,3 +1,13 @@ +slate.configAll({ + windowHintsIgnoreHiddenWindows: false, + windowHintsShowIcons: true, + windowHintsSpread: true, + switchShowTitles: true, + windowHintsSpreadSearchHeight: 100, + windowHintsSpreadSearchWidth: 100, + windowHintsSpreadPadding: 40 +}); + var hint = slate.op("hint", { "characters" : "ASDFGHJKLQWERTYUIOPCVBN" }); @@ -16,8 +26,6 @@ function quarterCorner(corner) { }); } -slate.bindAll({"esc:cmd": hint, "space:alt": grid}); - var hyper = ":ctrl;shift;alt;cmd"; function hyperBindAll(mapping) { console.log(_.object(_.map( @@ -83,10 +91,4 @@ hyperBindAll({ // return [asString, slate.op("activate-snapshot", {"name": name})]; // }) // )); - -slate.configAll({ - windowHintsIgnoreHiddenWindows: false, - windowHintsShowIcons: true, - windowHintsSpread: true, - switchShowTitles: true -}); \ No newline at end of file +slate.bindAll({"esc:cmd": hint, "space:alt": grid}); diff --git a/dotfiles/zshenv b/dotfiles/zshenv index 4a7b1cad..21fe1f91 100644 --- a/dotfiles/zshenv +++ b/dotfiles/zshenv @@ -1,30 +1 @@ -source ~/.lib/shellrc/functions.sh -function add_to_front_of_path { - export PATH=$@:$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||") -} - -function add_to_back_of_path { - export PATH=$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||"):$@ -} - -add_to_back_of_path "$HOME/.local/lib/python2.6/site-packages" -hash brew 2>/dev/null && add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin" -add_to_front_of_path "/usr/local/bin" -hash brew 2>/dev/null && add_to_front_of_path "$(brew --prefix emacs)/libexec/gnubin" - -if is_osx; then - export CFLAGS=-Qunused-arguments - export CPPFLAGS=-Qunused-arguments - add_to_back_of_path "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/" - export JAVA_HOME="$(find /Library/Java/JavaVirtualMachines -depth 1 | head -n 1)/Contents/Home" - # Access gnu man pages. - hash brew 2> /dev/null && export MANPATH="$(brew --prefix)/opt/coreutils/libexec/gnuman:$MANPATH" -else - export JAVA_HOME="$(update-alternatives --config java | get_cols ' -1' | head -n 1)" - is_osx && export VISUAL="which emacsclient -c -n" -fi - -add_to_front_of_path "$JAVA_HOME/bin" - -add_to_back_of_path "$(dotfiles_directory)/resources/python" -add_to_back_of_path "/usr/local/sbin" +source ~/.lib/shellenv.sh \ No newline at end of file diff --git a/dotfiles/zshrc b/dotfiles/zshrc index b7c7a2f0..9cca5b27 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -1,3 +1,5 @@ source ~/.lib/shellrc.sh source ~/.lib/zsh.sh test -r ~/custom.zsh && source ~/custom.zsh + +export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting diff --git a/tasks/osx.py b/tasks/osx.py index e17c5761..3fadb804 100644 --- a/tasks/osx.py +++ b/tasks/osx.py @@ -12,6 +12,7 @@ def all(ctx): cider_install(ctx) enable_access_for_assistive_devices(ctx) enable_hyper(ctx) + install_rvm(ctx) osx_config(ctx) @@ -135,6 +136,10 @@ def get_command_line_tools(ctx): if not util.command_exists('gcc'): ctx.run('xcode-select --install') +@ctask +def install_rvm(ctx): + ctx.run('\curl -sSL https://get.rvm.io | bash -s stable') + @ctask def enable_locate(ctx): ctx.run('sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist')