-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
68 lines (61 loc) · 2.03 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'pathname'
dotfiles = FileList[
".bashrc",
".bashrc.d/gitcircling.bash",
".bashrc.d/ruby-envs.bash",
".bashrc.d/haskell.bash",
".bashrc.d/perlbrew.bash",
".bashrc.d/ssh-completion.bash",
".bash_profile",
".gitconfig",
".gitignore",
".git-completion.bash",
".irssi/config",
".mrconfig",
".offlineimaprc",
".rvm/gemsets/default.gems",
".sup/config.yaml",
".sup/colors.yaml",
".sup/hooks/before-add-message.rb",
".signature",
".msmtprc",
".gnupg/gpg.conf",
".gnupg/gpg-agent.conf",
".vim/after/ftplugin/c.vim",
".vim/ftdetect/puppet.vim",
".vim/syntax/puppet.vim",
".vimrc",
].map do |dotfile_path|
full_path = Pathname.new "~/" + dotfile_path
full_path.expand_path
end
dotfiles_dir = Pathname.new "~/dotfiles"
dotfiles_dir = dotfiles_dir.expand_path
home_dir = dotfiles_dir.parent
if not dotfiles_dir == Pathname.getwd
raise "bad base dir. Using #{dotfiles_dir} by convention"
end
dotfiles.each do |source|
local_copy = source.sub(home_dir.to_s, dotfiles_dir.to_s)
file local_copy => source do
unless local_copy.parent.directory?
mkdir local_copy.parent
end
cp source, local_copy, :verbose => true
end
desc "imports dotfiles from home into the dotfiles repo"
task :import => local_copy
end
desc "updates home with the dotfiles dir content"
task :export_to_homedir do
dotfiles.each do |target|
local_copy = target.sub(home_dir.to_s, dotfiles_dir.to_s)
unless target.parent.directory?
mkdir_p target.parent
end
cp local_copy, target, :verbose => true
end
end
task :bootstrap_devel_env do
sh 'bash -c "$(curl http://rvm.beginrescueend.com/releases/rvm-install-head)"'
end