YADR can be installed to any directory and everything still works

This commit is contained in:
Kyle West
2012-01-25 02:04:37 -05:00
parent a658b815f5
commit 42104de0aa
9 changed files with 41 additions and 40 deletions

View File

@@ -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 File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -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