Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

some clojure and vagrant stuff

  • Loading branch information...
commit e7a5e67013ddbd05394557274f1c943b5036fa81 1 parent 3371c82
Nick Lewis authored
2  .alias
@@ -19,7 +19,7 @@ iss () {
19 19
20 20 alias first='ruby -nae '\''puts $F.first'\'''
21 21
22   -alias sudo='sudo env PATH=$PATH RUBYLIB=$RUBYLIB'
  22 +alias sudo='sudo -E env PATH=$PATH RUBYLIB=$RUBYLIB'
23 23
24 24 alias car='pygmentize -g'
25 25
3  .bashrc
@@ -20,7 +20,8 @@ YELLOW="\[\e[33m\]"
20 20 RED="\[\e[31m\]"
21 21 NORMAL="\[\e[0m\]"
22 22 GREY="\[\e[37m\]"
23   -PS1="\$? \w$YELLOW\$(ps1_git) $RED[\$(ps1_rvm)] $GREY[\$(ps1_jobs)]$NORMAL \$ "
  23 +#PS1="\$? \w$YELLOW\$(ps1_git) $RED[\$(ps1_rvm)] $GREY[\$(ps1_jobs)]$NORMAL \$ "
  24 +PS1="\$? \w$YELLOW\$(ps1_git) $RED[\$(ps1_rvm)]$NORMAL \$ "
24 25
25 26 if [ -f ~/.git-completion.bash ]; then
26 27 . ~/.git-completion.bash
3  .gitconfig
@@ -23,3 +23,6 @@
23 23 lg = log --pretty=format:'%C(yellow)%h%C(reset) %s %C(cyan)%ar%C(reset) %C(blue)%an%C(reset) %C(green)%d%C(reset)' --graph --date-order
24 24 [core]
25 25 excludesfile = /Users/nicklewis/.gitignore_global
  26 + editor = vim
  27 +[rerere]
  28 + enabled = 1
2  .profile
@@ -9,7 +9,7 @@ PATH=$PATH:~/projects/facter/bin
9 9 RUBYLIB=~/projects/puppet/lib
10 10 RUBYLIB=$RUBYLIB:~/projects/facter/lib
11 11
12   -CDPATH=.:~/projects:~
  12 +#CDPATH=.:~/projects:~
13 13
14 14 export PATH
15 15 export RUBYLIB
22 .vimrc
@@ -79,6 +79,11 @@ function! GoToTheImplementation()
79 79 elseif match( expand("%:p"), "spec/unit" ) > -1
80 80 :e %:p:s?spec/unit\(.*\)_spec?lib/puppet\1?
81 81 endif
  82 + elseif match( expand("%:p"), "test" ) > -1
  83 + " First test becomes src, others go away
  84 + let filename = substitute( expand("%:p"), "test", "src", "")
  85 + let filename = join( filter( split( filename, "/", 1 ), "v:val != 'test'"), "/")
  86 + execute "edit " . filename
82 87 end
83 88 endfunc
84 89
@@ -88,6 +93,20 @@ function! GoToTheTest()
88 93 :A
89 94 elseif match( expand("%:p"), "lib/puppet" ) > -1
90 95 :e %:p:s?lib/puppet\(.*\)\.rb?spec/unit\1_spec.rb?
  96 + elseif match( expand("%:p"), "src" ) > -1
  97 + let all_pieces = split( expand("%:p"), "/" )
  98 + let prefix = [""] + all_pieces[0 : index( all_pieces, "src" ) - 1] + ["test"]
  99 + let relative_pieces = all_pieces[len(prefix)-1:]
  100 + echo relative_pieces
  101 + " Omit the last choice, because it foo/bar/file.clj/test can't work
  102 + for i in range(len(relative_pieces)-1)
  103 + " Replace src with test, and try each potential directory
  104 + let filename = join( prefix + relative_pieces[:i] + ["test"] + relative_pieces[i+1:], "/" )
  105 + if filereadable(filename)
  106 + execute "edit " . filename
  107 + break
  108 + endif
  109 + endfor
91 110 endif
92 111 end
93 112 endfunc
@@ -128,11 +147,12 @@ let vimfiles = $HOME . "/.vim"
128 147 let classpath = ".:src:src/main/clojure:src/main/resources:src/com/puppetlabs:src/com/puppetlabs/cmdb:src/com/puppetlabs/cmdb/*:test:src/test/clojure:src/test/resources:classes:classes/*:target/classes:lib:lib/*:lib/dev/*:bin:" . vimfiles . "/lib/*"
129 148
130 149 " Settings for VimClojure
131   -let vimclojureRoot = vimfiles . "/bundle/vimclojure-2.2.0"
  150 +let vimclojureRoot = vimfiles . "/bundle/vimclojure-2.3.1"
132 151 let vimclojure#HighlightBuiltins = 1
133 152 let vimclojure#HighlightContrib = 1
134 153 let vimclojure#DynamicHighlighting = 1
135 154 let vimclojure#ParenRainbow = 1
  155 +let vimclojure#FuzzyIndent = 1
136 156 let vimclojure#WantNailgun = 1
137 157 let vimclojure#NailgunClient = vimclojureRoot."/lib/nailgun/ng"
138 158
3  bin/irc
... ... @@ -1,3 +1,2 @@
1 1 #!/bin/bash
2   -ssh -t shell.puppetlabs.com "export TERM='xterm'; screen -Dr irc"
3   -# || ssh -t nick@shell.puppetlabs.com "export TERM='xterm'; export TZ='PST8PDT'; screen -S irc /usr/bin/irssi"
  2 +autossh -M 28734 -t shell.puppetlabs.com "export TERM='xterm'; screen -Dr irc"
49 bin/vagrant-environment
... ... @@ -0,0 +1,49 @@
  1 +#!/usr/bin/env ruby
  2 +
  3 +require 'rubygems'
  4 +require 'erb'
  5 +require 'pathname'
  6 +
  7 +def generate_name
  8 + words = File.read('/usr/share/dict/words').split.map(&:chomp)
  9 + words.delete_if {|word| word !~ /^[a-z]{6,}$/}
  10 +
  11 + words[rand(words.length)]
  12 +end
  13 +
  14 +name = ARGV.first || generate_name
  15 +
  16 +working_dir = Pathname.new(File.expand_path '~/vagrant/auto_generated_vms')
  17 +working_dir.mkpath
  18 +
  19 +Dir.chdir(working_dir)
  20 +
  21 +vagrant_dir = Pathname.new(name)
  22 +vagrant_dir.mkpath
  23 +
  24 +ip = nil
  25 +
  26 +File.open('ips', 'a+') do |f|
  27 + f.rewind
  28 + ip = f.read.split.map(&:chomp).map(&:to_i).sort.last.next
  29 + f.puts ip
  30 +end
  31 +
  32 +files = %w[Vagrantfile provision.sh]
  33 +
  34 +dirs = %w[shared]
  35 +
  36 +files.each do |filename|
  37 + erb = File.read("#{filename}.erb")
  38 +
  39 + File.open(vagrant_dir + filename, 'w') do |f|
  40 + f.print ERB.new(erb).result(binding)
  41 + end
  42 +end
  43 +
  44 +dirs.each do |dirname|
  45 + Dir.mkdir(vagrant_dir + dirname)
  46 +end
  47 +
  48 +puts name
  49 +exit 0
9 bin/vagrant-spawn
... ... @@ -0,0 +1,9 @@
  1 +#!/usr/bin/env bash
  2 +
  3 +NAME=`vagrant-environment`
  4 +
  5 +echo "Spawning vagrant environment for $NAME"
  6 +
  7 +cd ~/vagrant/auto_generated_vms/$NAME
  8 +
  9 +vagrant up

0 comments on commit e7a5e67

Please sign in to comment.
Something went wrong with that request. Please try again.