Permalink
Browse files

Merged kylewest auto install, tweaked the zshrc install

  • Loading branch information...
1 parent c0119dc commit eedab148e6609bfea7ab4ea4e91329e50c42a139 @skwp committed with Yan Pritzker Jan 26, 2012
Showing with 287 additions and 241 deletions.
  1. 0 .yadr
  2. +29 −57 README.md
  3. +70 −0 Rakefile
  4. +2 −0 bin/yadr/default_libs.rb
  5. +2 −2 bin/yadr/yadr
  6. +1 −1 bin/yadr/yadr-init-plugins
  7. +2 −2 bin/yadr/yadr-vim-add-plugin
  8. +3 −4 bin/yadr/yadr-vim-update-plugins
  9. +112 −0 git/gitconfig
  10. +32 −0 git/gitignore
  11. +0 −112 gitconfig
  12. +1 −0 gitconfig
  13. +0 −32 gitignore_global
  14. +1 −0 gitignore_global
  15. +1 −0 vim/vim
  16. +5 −2 zsh/aliases
  17. +0 −23 zsh/oh_my_zsh_zshrc
  18. +1 −0 zsh/oh_my_zsh_zshrc
  19. +25 −6 zsh/zshrc
View
0 .yadr
No changes.
View
@@ -8,8 +8,8 @@
# Yet Another Dotfile Repo v0.8
# Alpha Release Please Report Bugs
- git clone https://github.com/skwp/dotfiles ~/.dotfiles
- ~/.dotfiles/bin/yadr/yadr init-plugins
+ git clone https://github.com/skwp/dotfiles ~/.yadr
+ cd ~/.yadr && rake install
# Your dotfiles are safe! YADR will not
# overwrite anything. Please read on for
@@ -109,28 +109,29 @@ gem install awesome_print
## Installation
-This project uses git submodules for its plugins, but this is handled
-for you by the `yadr` command. Please run:
+Installation is automated via `rake` and the `yadr` command. To get
+started please run:
```bash
-git clone https://github.com/skwp/dotfiles ~/.dotfiles
-~/.dotfiles/bin/yadr/yadr init-plugins
+git clone https://github.com/skwp/dotfiles ~/.yadr
+cd ~/.yadr && rake install
```
-NOTE: by default, YADR will not touch any of your files. You have to manually
-activate each of its components, if you choose, by following the sections below.
-Eventually these will be automated.
+Note: YADR will not destroy any of your files unless you tell it to.
-If you pull new changes, be sure to run this to init all the submodules:
+
+## Upgrading
+
+Upgrading is easy.
```bash
-yadr init-plugins
+cd ~/.yadr
+git pull origin master
+rake install
```
-After you install yadr shell aliases, you can use the *yip* alias to do the same.
-
-### Setup for ZSH
+### ZSH
After a lifetime of bash, I am now using ZSH as my default shell because of its awesome globbing
and autocomplete features (the spelling fixer autocomplete is worth the money alone).
@@ -141,72 +142,50 @@ restores the only feature that I felt was 'broken' which is the Ctrl-R reverse h
While I am not going to support bash out of the box here, YADR _should_ work with bash if
you just source the _aliases_ file. However, you soul will sing if you install zsh. I promise.
-**Install zsh pain free, automatically:**
-
-```bash
-curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
-```
-
-Place this as the last line in your ~/.zshrc created by oh-my-zsh:
-
- source ~/.dotfiles/zsh/zshrc
-
-Or, to make things simpler you can just use the YADR-provided zsh/oh_my_zsh_zshrc
-Please note that this relies on the skwp fork of oh-my-zsh which contains skwp.theme
-
-```bash
-ln -sf ~/.dotfiles/zsh/oh_my_zsh_zshrc ~/.zshrc
-```
-
Lots of things I do every day are done with two or three character
mnemonic aliases. Please feel free to edit them:
ae # alias edit
ar # alias reload
-**Customized zsh provided by ~/.dotfiles/zshrc:**
+**ZSH Customizations**
* Vim mode
* Bash style ctrl-R for reverse history finder
* Fuzzy matching - if you mistype a directory name, tab completion will fix it
-### Setup for Pry
+### Pry
+
Pry (http://pry.github.com/) offers a much better out of the box IRB experience
with colors, tab completion, and lots of other tricks. You should:
+#### Install the gem
+
```bash
gem install pry
gem install awesome_print
-ln -s ~/.dotfiles/irb/pryrc ~/.pryrc
-ln -s ~/.dotfiles/irb/aprc ~/.aprc
```
-**Use pry**
+#### Use pry
* as irb: `pry`
- * as rails console: script/console --irb=pry
+ * as rails console: `script/console --irb=pry`
-**Pry customizations:**
+#### Pry Customizations:
* `clear` command to clear screen
* `sql` command to execute something (within a rails console)
* all objects displayed in readable format (colorized, sorted hash keys) - via awesome_print
* a few color modifications to make it more useable
* type `help` to see all the commands
+### Git
-### Setup for Git
-
-**To use the gitconfig (some of the git bash aliases rely on my git aliases)**
-
-```bash
-ln -s ~/.dotfiles/gitconfig ~/.gitconfig
-```
-
-Since the gitconfig doesn't contain the user info, I recommend using env variables.
+#### User Info
-**Put the following in your ~/.secrets file which is automatically referenced by the provided zshrc:**
+Since the gitconfig doesn't contain the user info, I recommend using env variables. Put the following in
+your `~/.secrets` file which is automatically referenced by the provided zshrc:
# Set your git user info
export GIT_AUTHOR_NAME='Your Name'
@@ -218,7 +197,7 @@ Since the gitconfig doesn't contain the user info, I recommend using env variabl
export GITHUB_USER='your_user_name'
export GITHUB_TOKEN='your_github_token'
-**Some of the customizations provided include:**
+#### Git Customizations:
* `git l` - a much more usable git log
* `git b` - a list of branches with summary of last commit
@@ -232,14 +211,7 @@ Since the gitconfig doesn't contain the user info, I recommend using env variabl
* `git unstage` (remove from index) and `git uncommit` (revert to the time prior to the last commit - dangerous if already pushed) aliases
-### Setup for Vim
-
-To use the vim files:
-
-```bash
-ln -s ~/.dotfiles/vimrc ~/.vimrc
-ln -s ~/.dotfiles/vim ~/.vim
-```
+### Vim
The .vimrc is well commented and broken up by settings. I encourage you
to take a look and learn some of my handy aliases, or comment them out
View
@@ -0,0 +1,70 @@
+require 'rake'
+
+desc "Hook our dotfiles into system-standard positions."
+task :install => :submodules do
+ # this has all the linkables from this directory.
+ linkables = []
+ linkables += Dir.glob('git/*') if want_to_install?('git')
+ linkables += Dir.glob('irb/*') if want_to_install?('irb/pry')
+ linkables += Dir.glob('{vim,vimrc}') if want_to_install?('vim')
+ linkables += Dir.glob('zsh/zshrc') if want_to_install?('zsh')
+
+ skip_all = false
+ overwrite_all = false
+ backup_all = false
+
+ linkables.each do |linkable|
+ file = linkable.split('/').last
+ source = "#{ENV["PWD"]}/#{linkable}"
+ target = "#{ENV["HOME"]}/.#{file}"
+
+ puts "--------"
+ puts "file: #{file}"
+ puts "source: #{source}"
+ puts "target: #{target}"
+
+ if File.exists?(target) || File.symlink?(target)
+ unless skip_all || overwrite_all || backup_all
+ puts "File already exists: #{target}, what do you want to do? [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all"
+ case STDIN.gets.chomp
+ when 'o' then overwrite = true
+ when 'b' then backup = true
+ when 'O' then overwrite_all = true
+ when 'B' then backup_all = true
+ when 'S' then skip_all = true
+ end
+ end
+ FileUtils.rm_rf(target) if overwrite || overwrite_all
+ `mv "$HOME/.#{file}" "$HOME/.#{file}.backup"` if backup || backup_all
+ end
+ `ln -fs "#{source}" "#{target}"`
+ end
+ success_msg("installed")
+end
+
+desc "Init and update submodules."
+task :submodules do
+ sh('git submodule update --init')
+end
+
+task :default => 'install'
+
+
+private
+
+def want_to_install? (section)
+ puts "Would you like to install configuration files for: #{section}? [y]es, [n]o"
+ STDIN.gets.chomp == 'y'
+end
+
+def success_msg(action)
+ puts ""
+ puts " _ _ _ "
+ puts " | | | | | | "
+ puts " | |___| |_____ __| | ____ "
+ puts " |_____ (____ |/ _ |/ ___) "
+ puts " _____| / ___ ( (_| | | "
+ puts " (_______\_____|\____|_| "
+ puts ""
+ puts "YADR has been #{action}. Please restart your terminal and vim."
+end
View
@@ -1,2 +1,4 @@
Dir[File.join(File.dirname(__FILE__),"lib/**/lib")].each {|dir| $LOAD_PATH << dir}
require 'git-style-binary/command'
+
+$yadr = `find -L ~ -type file -maxdepth 2 -name .yadr | head | sed 's:\.yadr\/::'`.chomp
View
@@ -2,10 +2,10 @@
require File.join(File.dirname(__FILE__), 'default_libs')
# GitStyleBinary.primary do
-#
+#
# end
# GitStyleBinary.command do
-# version "yadr 1.0"
+# version "yadr 1.0"
# banner <<-EOS
# Welcome to YADR, Yet Another Dotfile Repo Manager
# Usage: yadr #{all_options_string}
@@ -6,7 +6,7 @@ GitStyleBinary.command do
short_desc "Initialize all submodules. Run this every time you pull a new yadr version."
run do |command|
- system("cd ~/.dotfiles && git submodule init && git submodule update")
+ `cd "#{$yadr}" && git submodule update --init`
end
end
@@ -2,7 +2,7 @@
require File.join(File.dirname(__FILE__), 'default_libs')
GitStyleBinary.command do
- version "yadr-add-vim-plugin 1.0"
+ version "yadr-add-vim-plugin 1.0"
short_desc "Add a vim plugin from a github repo"
opt :url, "Github url (http:// or git://)", :type => String
@@ -14,7 +14,7 @@ GitStyleBinary.command do
begin
repo=command[:url]
bundle_path=repo.gsub("https://github.com/","").gsub(".git","").gsub("/","-").gsub(".vim","")
- system("cd ~/.dotfiles && git submodule add #{repo} vim/bundle/#{bundle_path}")
+ system("cd #{$yadr} && git submodule add #{repo} vim/bundle/#{bundle_path}")
rescue
puts "Sorry, couldn't parse your path: #{$!}"
end
@@ -2,12 +2,11 @@
require File.join(File.dirname(__FILE__), 'default_libs')
GitStyleBinary.command do
- version "yadr-vim-update-plugins 1.0"
-
-short_desc "Update all vim plugins to latest versions from github"
+ version "yadr-vim-update-plugins 1.0"
+ short_desc "Update all vim plugins to latest versions from github"
run do |command|
- system("cd ~/.dotfiles && git submodule foreach git pull origin master")
+ `cd "#{$yadr}" && git submodule foreach git pull origin master`
end
end
Oops, something went wrong.

0 comments on commit eedab14

Please sign in to comment.