Skip to content
Browse files

Move around a bunch of files, following Elijah Miller's idea of

separating files into subdirectories and then requiring/sourcing them
all.  Added rake task to quickly symlink all necessary files so repo can
be maintained and modified quickly and easily
  • Loading branch information...
1 parent 38ff866 commit bac28ac8049bea33e121719340561a42947912eb Joshua Clayton committed
View
27 Rakefile
@@ -0,0 +1,27 @@
+def stop_error(message)
+ puts "ERROR: #{message}"
+ exit(1)
+end
+
+def symlink(target, link)
+ puts "Linking #{link} => #{target}"
+ if File.symlink?(link)
+ puts " * deleting existing symlink #{link}"
+ File.unlink(link)
+ elsif File.exist?(link)
+ stop_error("File exists: #{link}")
+ end
+ File.symlink(target, link)
+ puts
+end
+
+desc "Install all dotfiles"
+task :install do
+ home = ENV['HOME'] + "/test"
+ pwd = File.dirname(__FILE__)
+
+ %w(ackrc dir_colors gemrc vimrc vim irbrc irbrc.d bash_profile bash_profile.d).each do |file|
+ symlink("#{pwd}/#{file}", "#{home}/.#{file}")
+ end
+end
+
View
10 bash_profile
@@ -0,0 +1,10 @@
+export SVN_EDITOR=vi
+export DISPLAY=:0.0
+export CLICOLOR=1
+export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/Developer/SDKs/flex_sdk_3/bin:$PATH"
+
+PS1='[\u \w$(__git_ps1 " | %s")]\$ '
+
+for a in `ls $HOME/.bash_profile.d/*.sh`; do
+ source $a
+done
View
11 bash_profile.sh → bash_profile.d/alias.sh
@@ -1,6 +1,3 @@
-export SVN_EDITOR=vi
-export DISPLAY=:0.0
-export CLICOLOR=1
alias ss="script/server"
alias sc='script/console'
alias ga='git add'
@@ -22,8 +19,6 @@ alias start_mysql='sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql
alias myip="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\ -f2"
-PS1='[\u \w$(__git_ps1 " | %s")]\$ '
-
-source ~/.git-sexy.sh
-
-export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/Developer/SDKs/flex_sdk_3/bin:$PATH"
+reset_profile() {
+ source ~/.bash_profile
+}
View
0 bash_colors.sh → bash_profile.d/bash_colors.sh
File renamed without changes.
View
0 git-completion.sh → bash_profile.d/git-completion.sh
File renamed without changes.
View
9 git-sexy.sh → bash_profile.d/git-sexy.sh
@@ -1,6 +1,3 @@
-source ~/.git-completion.sh
-source ~/.bash_colors.sh
-
git_prompt_color() {
if [ -n "$(git_prompt_info)" ]; then
if [ "changed" = $(git_status) ]; then
@@ -33,8 +30,4 @@ git_status() {
fi
}
-reset_profile() {
- source ~/.bash_profile
-}
-
-PROMPT_COMMAND='git_prompt_color'
+PROMPT_COMMAND='git_prompt_color'
View
10 irbrc
@@ -1,7 +1,11 @@
require 'rubygems'
-Dir[File.join(File.dirname(__FILE__), ".irb_scripts", "*")].each do |f|
- require f
+def require_rb_files_from(dir)
+ Dir.glob(File.join(dir, '*.rb')) do |file|
+ require file
+ end
end
-IRB.conf[:PROMPT_MODE] = :SIMPLE
+require_rb_files_from(File.join(ENV['HOME'], '.irb_scripts.d'))
+
+IRB.conf[:PROMPT_MODE] = :SIMPLE
View
0 irb_scripts/completion.rb → irbrc.d/completion.rb
File renamed without changes.
View
0 irb_scripts/core_extensions.rb → irbrc.d/core_extensions.rb
File renamed without changes.
View
0 irb_scripts/helpers.rb → irbrc.d/helpers.rb
File renamed without changes.
View
0 irb_scripts/history.rb → irbrc.d/history.rb
File renamed without changes.
View
0 irb_scripts/snip.rb → irbrc.d/snip.rb
File renamed without changes.

0 comments on commit bac28ac

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