Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 71 lines (61 sloc) 1.455 kB
2797c3c @joshuaclayton Fix Rakefile by moving methods into a class
authored
1 class Installer
2 def symlink(target, link)
3 if File.symlink?(link)
4 unlink(link)
5 elsif File.exist?(link)
6 puts "ERROR: File exists: #{link}"
7 exit 1
8 end
9 puts "Symlinking #{link} => #{target}"
10 File.symlink(target, link)
bac28ac Move around a bunch of files, following Elijah Miller's idea of
Joshua Clayton authored
11 end
12
2797c3c @joshuaclayton Fix Rakefile by moving methods into a class
authored
13 def delete_symlink(link)
14 unlink(link) if File.symlink?(link)
15 end
9819969 @joshuaclayton Use Pathogen for easier vim management.
authored
16
2797c3c @joshuaclayton Fix Rakefile by moving methods into a class
authored
17 def unlink(link)
18 if File.exist?(link)
19 descriptor = File.symlink?(link) ? "symlink" : "file"
20 puts "Deleting #{descriptor} #{link}"
21 File.unlink(link)
22 end
1c4b442 @joshuaclayton Use a manifest to manage files, clean up submodule work a bit
authored
23 end
9819969 @joshuaclayton Use Pathogen for easier vim management.
authored
24 end
25
1c4b442 @joshuaclayton Use a manifest to manage files, clean up submodule work a bit
authored
26 def pwd; File.dirname(__FILE__); end
27 def target_path(file)
28 File.join(ENV["HOME"], ".#{file}")
29 end
30
31 files = File.new(File.join(pwd, "MANIFEST"), "r").read.split("\n")
9819969 @joshuaclayton Use Pathogen for easier vim management.
authored
32
bac28ac Move around a bunch of files, following Elijah Miller's idea of
Joshua Clayton authored
33 desc "Install all dotfiles"
1c4b442 @joshuaclayton Use a manifest to manage files, clean up submodule work a bit
authored
34 task :install => [:init_submodules, :update_submodules] do
9819969 @joshuaclayton Use Pathogen for easier vim management.
authored
35 files.each do |file|
2797c3c @joshuaclayton Fix Rakefile by moving methods into a class
authored
36 Installer.new.symlink(File.join(pwd, file), target_path(file))
9819969 @joshuaclayton Use Pathogen for easier vim management.
authored
37 end
38 end
bac28ac Move around a bunch of files, following Elijah Miller's idea of
Joshua Clayton authored
39
9819969 @joshuaclayton Use Pathogen for easier vim management.
authored
40 desc "Remove all dotfies"
41 task :uninstall do
42 files.each do |file|
2797c3c @joshuaclayton Fix Rakefile by moving methods into a class
authored
43 Installer.new.unlink(target_path(file))
bac28ac Move around a bunch of files, following Elijah Miller's idea of
Joshua Clayton authored
44 end
45 end
1c4b442 @joshuaclayton Use a manifest to manage files, clean up submodule work a bit
authored
46
47 desc "Install submodules"
48 task :init_submodules do
49 puts "Installing submodules"
50 `git submodule init`
51 end
52
53 desc "Update submodules"
54 task :update_submodules do
55 puts "Updating submodules"
56 `git submodule update`
57 end
9ac89ee @joshuaclayton Pull in vim submodules
authored
58
59 desc "Pull in new vim submodules"
60 task :pull_vim_submodules do
61 puts "Pull vim submodules"
62 system(%{
63 for x in vim/bundle/*; do
64 echo $x
65 cd $x
66 git co master && git pull
67 cd ../../..
68 done
69 })
70 end
Something went wrong with that request. Please try again.