Class: Homey::Tasks
Instance Method Summary
collapse
#absolutize_paths, #dotfiles_path, #home_file, #prepare_paths, #replace_home_char
Instance Method Details
#create_symlinks ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/homey/tasks.rb', line 22
def create_symlinks
opts = { flavor: options[:flavor], flavorized_attributes: %w(target) }
symlinks = Flavorizer::flavorize_group(home_file["sym_links"], opts)
symlinks.each do |sym|
target, link = prepare_paths(sym['target'], sym['link'])
FileUtils.rm_rf(link) if options[:force]
File.symlink target, link
end
end
|
#dotfiles(repo) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/homey/tasks.rb', line 9
def dotfiles(repo)
path = replace_home_char(options.fetch("path", "~/.dotfiles")).first
if !options[:local]
FileUtils.rm_rf(path) if options["force"]
command = "git clone [email protected]:#{repo}.git #{path}"
system command
end
File.open("#{ENV['HOME']}/.homey", 'w') { |f| f.write(path) }
end
|
#setup ⇒ Object
33
34
35
|
# File 'lib/homey/tasks.rb', line 33
def setup
home_file["commands"].each { |command| system command }
end
|