-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
44 lines (37 loc) · 1.19 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
require 'erb'
require 'rake'
require 'yaml'
task :default => :install
task :cp_example_conf => [ :setup ] do
system("cp ./personal.yml.example ./.personal.yml")
end
task :setup do
system("mkdir -p ./work")
end
task :install_static_files do
Dir[ '*rc', 'bash_profile', 'gitignore' ].each do |file|
fname = File::basename(file)
system("cp #{file} ./work/.#{fname}")
system("ln -fs #{Dir.pwd}/work/.#{fname} ~/.#{fname}")
end
end
task :install_generated_files do
Dir[ '*.erb' ].each do |template|
fname = File::basename(template, ".erb")
system("touch ./work/.#{fname}")
@config = OpenStruct.new(YAML.load_file("./.personal.yml"))
File.open("./work/.#{fname}", "w") do |out|
out.write ERB.new(File.read(template)).result(binding)
end
system("ln -fs #{Dir.pwd}/work/.#{fname} ~/.#{fname}")
end
end
task :install_janus_overrides do
Dir[ 'vimrc.*' ].each do |file|
fname = File::basename(file)
system("cp #{file} ./work/.#{fname}")
system("ln -fs #{Dir.pwd}/work/.#{fname} ~/.#{fname}")
end
end
desc "generate and link files to home directory"
task :install => %w{ setup install_static_files install_generated_files install_janus_overrides }