-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (55 loc) · 2.15 KB
/
Makefile
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
SHELL = /bin/bash
DOTFILES_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
OS := $(shell bin/is-supported bin/is-macos macos linux)
PATH := $(DOTFILES_DIR)/bin:$(PATH)
NVM_DIR := $(HOME)/.nvm
export XDG_CONFIG_HOME := $(HOME)/.config
export STOW_DIR := $(DOTFILES_DIR)
.PHONY: test
all: $(OS)
macos: sudo core-macos packages-macos link
linux: core-linux packages-linux link
core-macos: brew bash git npm ruby
core-linux:
sudo apt update && sudo apt upgrade -y
stow-macos:
is-executable stow || brew install stow
stow-linux:
is-executable stow || apt -y install stow
sudo:
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
packages-linux: apt-packages node-packages
packages-macos: brew-packages cask-apps node-packages
link: stow-$(OS)
for FILE in $$(\ls -A runcom); do if [ -f $(HOME)/$$FILE -a ! -h $(HOME)/$$FILE ]; then mv -v $(HOME)/$$FILE{,.bak}; fi; done
mkdir -p $(XDG_CONFIG_HOME)
stow -t $(HOME) runcom
stow -t $(XDG_CONFIG_HOME) config
unlink: stow-$(OS)
stow --delete -t $(HOME) runcom
stow --delete -t $(XDG_CONFIG_HOME) config
for FILE in $$(\ls -A runcom); do if [ -f $(HOME)/$$FILE.bak ]; then mv -v $(HOME)/$$FILE.bak $(HOME)/$${FILE%%.bak}; fi; done
brew:
is-executable brew || curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install
bash: BASH=/usr/local/bin/bash
bash: SHELLS=/private/etc/shells
bash: brew
if ! grep -q $(BASH) $(SHELLS); then brew install bash bash-completion@2 pcre && sudo append $(BASH) $(SHELLS) && chsh -s $(BASH); fi
git: brew
brew install git git-extras
npm:
if ! [ -d $(NVM_DIR)/.git ]; then git clone https://github.com/creationix/nvm.git $(NVM_DIR); fi
. $(NVM_DIR)/nvm.sh; nvm install --lts
apt-packages:
sudo apt install -y bats
brew-packages: brew
brew bundle --file=$(DOTFILES_DIR)/install/Brewfile
cask-apps: brew
brew bundle --file=$(DOTFILES_DIR)/install/Caskfile
defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua"
for EXT in $$(cat install/Codefile); do code --install-extension $$EXT; done
node-packages: npm
. $(NVM_DIR)/nvm.sh; npm install -g $(shell cat install/npmfile)
test:
bats test/*.bats