-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.rb
More file actions
executable file
·102 lines (87 loc) · 2.91 KB
/
setup.rb
File metadata and controls
executable file
·102 lines (87 loc) · 2.91 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/ruby
# frozen_string_literal: true
require 'fileutils'
DOTFILES_PATH = "#{ENV['HOME']}/dotfiles"
CONFIG_PATH = ENV['XDG_CONFIG_HOME'] || "#{ENV['HOME']}/.config"
def command_installed?(command)
`which #{command} > /dev/null 2>&1`
end
def bin
puts 'copy bin/ to ~/.local/bin'
FileUtils.mkdir_p("#{ENV['HOME']}/.local/bin")
`ln -sf #{DOTFILES_PATH}/bin/* ~/.local/bin`
end
def astronvim
puts 'setup astronvim'
`unlink #{CONFIG_PATH}/nvim` if File.symlink?("#{CONFIG_PATH}/nvim")
`ln -sf #{DOTFILES_PATH}/config/astronvim #{CONFIG_PATH}/nvim`
end
def zsh
puts 'setup zsh (with sheldon)'
`ln -sf #{DOTFILES_PATH}/config/zsh/.zshrc ~/.zshrc`
`ln -sf #{DOTFILES_PATH}/config/zsh/.zshenv ~/.zshenv`
sheldon_path = "#{CONFIG_PATH}/sheldon"
FileUtils.mkdir_p(sheldon_path) unless Dir.exist?(sheldon_path)
`ln -sf #{DOTFILES_PATH}/config/zsh/sheldon.plugins.toml #{sheldon_path}/plugins.toml`
end
def ideavim
puts 'setup ideavim'
`ln -sf #{DOTFILES_PATH}/config/ideavim/.ideavimrc ~/.ideavimrc`
end
def aws
puts 'setup aws'
FileUtils.mkdir_p("#{ENV['HOME']}/.aws/cli")
`ln -sf #{DOTFILES_PATH}/config/aws/cli/alias ~/.aws/cli/alias`
end
def git
puts 'setup git'
FileUtils.mkdir_p("#{CONFIG_PATH}/git")
`ln -sf #{DOTFILES_PATH}/config/git/ignore #{CONFIG_PATH}/git/ignore`
`ln -sf #{DOTFILES_PATH}/config/git/config #{CONFIG_PATH}/git/config`
end
def starship
puts 'setup starship'
`ln -sf #{DOTFILES_PATH}/config/starship/starship.toml #{CONFIG_PATH}/starship.toml`
end
def zellij
puts 'setup zellij'
`cargo install --locked zellij` unless command_installed?('zellij')
FileUtils.mkdir_p("#{CONFIG_PATH}/zellij")
`ln -sf #{DOTFILES_PATH}/config/zellij/config.kdl #{CONFIG_PATH}/zellij/config.kdl`
layout_path = "#{CONFIG_PATH}/zellij/layouts"
`ln -sf #{DOTFILES_PATH}/config/zellij/layouts #{layout_path}` unless Dir.exist?(layout_path)
end
def ghostty
puts 'setup ghostty'
FileUtils.mkdir_p("#{CONFIG_PATH}/ghostty")
`ln -sf #{DOTFILES_PATH}/config/ghostty/config #{CONFIG_PATH}/ghostty/config`
end
def claude
puts 'setup claude'
FileUtils.mkdir_p("#{ENV['HOME']}/.claude")
`ln -sf #{DOTFILES_PATH}/config/claude/settings.json #{ENV['HOME']}/.claude/settings.json`
`ln -sf #{DOTFILES_PATH}/config/claude/CLAUDE.md #{ENV['HOME']}/.claude/CLAUDE.md`
FileUtils.mkdir_p("#{ENV['HOME']}/.claude/commands")
`ln -sf #{DOTFILES_PATH}/config/claude/commands/* #{ENV['HOME']}/.claude/commands/`
FileUtils.mkdir_p("#{CONFIG_PATH}/claude/scripts")
`ln -sf #{DOTFILES_PATH}/config/claude/scripts/notify.sh #{CONFIG_PATH}/claude/scripts/notify.sh`
end
def peco
puts 'setup peco'
FileUtils.mkdir_p("#{CONFIG_PATH}/peco")
`ln -sf #{DOTFILES_PATH}/config/peco/config.json #{CONFIG_PATH}/peco/config.json`
end
if __FILE__ == $PROGRAM_NAME
FileUtils.mkdir(CONFIG_PATH) unless Dir.exist?(CONFIG_PATH)
bin
astronvim
zsh
ideavim
aws
git
starship
zellij
ghostty
claude
peco
end