-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall.rb
More file actions
64 lines (55 loc) · 1.32 KB
/
install.rb
File metadata and controls
64 lines (55 loc) · 1.32 KB
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
#!/usr/bin/env ruby
require 'fileutils'
require 'pathname'
class String
def red; "\e[31m#{self}\e[0m" end
def green; "\e[32m#{self}\e[0m" end
def yellow; "\e[33m#{self}\e[0m" end
def un_dot; self.sub(/^\./, '') end
end
HOME = ENV['HOME']
DOTFILES_DIR = File.expand_path(File.dirname(__FILE__))
PATHS = %w[
.config/aliases.sh
.config/bash
.config/bat
.config/dircolors
.config/eza
.config/ghostty
.config/git
.config/ideavim
.config/irb
.config/jj
.config/kitty
.config/lazygit
.config/nvim
.config/p10k.zsh
.config/powerlevel10k
.config/prettierdrc.toml
.config/tmux
.config/wezterm
.config/zsh
.config/current-theme-env.zsh
.config/current-theme.lua
.config/LS_COLORS.sh
.hushlogin
.zshrc
.claude/CLAUDE.md
]
conflicts = PATHS.filter_map do |path|
target_path = File.join(HOME, path)
target_path if File.exist?(target_path) && !File.symlink?(target_path)
end
if conflicts.any?
puts "Conflicts found! Remove these before running install:".red
conflicts.each { |path| puts " #{path}".yellow }
exit 1
end
PATHS.each do |path|
source_path = File.join(DOTFILES_DIR, path.un_dot)
target_path = File.join(HOME, path)
FileUtils.mkdir_p(File.dirname(target_path))
FileUtils.ln_sf(source_path, target_path)
puts "Linked #{target_path}".green
end
puts "Setup complete!".green