this is getting good

master
Jordan Orelli 2 years ago
parent 434ab9326f
commit 523bfdcdfb

@ -1,52 +1,61 @@
# items in the [home] section are copied into the home directory with the same
# relative location as they appear in the dotfiles repo
[home]
files:
# sync vim plugin directories but not all of .vim
.vim/ftplugin
.vim/pack
[run submodules]
cmd: git submodule init
# individual files to sync
[home bash-prefs]
when: host.has('bash')
files:
.bash_profile
.bashrc
[home vim]
when: host.has('vim')
files:
.vim/ftplugin
.vim/pack
.vimrc
cargo-config.toml > .cargo/config.toml
[run vim-plugins]
when: host.has('vim')
cmd: vim +PluginInstall +qall
[home cargo]
when: host.has('cargo')
files: cargo-config.toml > .cargo/config.toml
[home posix]
when: not host.is_windows
[home htop]
when: host.has('htop')
files: .config/htop/htoprc
files:
.screenrc
.tmux.conf
.config/lazydocker/config.yml
.config/htop/htoprc
[home lazydocker]
when: host.has('lazydocker')
files: .config/lazydocker/config.yml
[home screenrc]
when: host.has('screen')
files: .screenrc
nvim/init.vim > .config/nvim/init.vim
[home tmux]
when: host.has('tmux')
files: .tmux.conf
[home posix-nvim]
when: host.has('nvim') and not host.is_windows
files: nvim/init.vim > .config/nvim/init.vim
[home wsl]
when: host.is_wsl
files: scripts/winmode > bin/winmode
files:
scripts/winmode > bin/winmode
[link-files AppData]
when: host.is_windows
[link-files windows-neovim]
when: host.is_windows and host.has('nvim')
target_root: ~/AppData/Local
files:
nvim/lua
.vim/ftplugin > nvim/ftplugin
.vimrc > nvim/init.vim
Vundle.vim > nvim/bundle/Vundle.vim
.vim/ftplugin > nvim/ftplugin
packer.nvim > nvim-data/site/pack/packer/start/packer.nvim
[cargo-install]
crates:
just

@ -28,14 +28,14 @@ class Installer:
return parser
def run(self):
resources = []
for name in self.config.sections():
section = self.config[name]
if self.when(section):
r = Resource.from_section(name, section)
resources.append(r)
for r in resources:
r.run()
print(f"RUN [{name}]")
r.run()
else:
print(f"SKIP [{name}]")
def when(self, section):
if clause := section.get('when', None):

@ -1,9 +1,10 @@
from .home import Home
from .linker import LinkFiles
from .cargo import CargoInstall
from .run import Run
class Resource:
resource_types = [Home, LinkFiles, CargoInstall]
resource_types = [Home, LinkFiles, CargoInstall, Run]
@classmethod
def from_name(cls, name):

@ -0,0 +1,25 @@
import subprocess
import os
import shutil
from . import host
class Run:
resource_name = 'run'
def __init__(self, label, section):
self.label = label or None
self.cmd = section.get('cmd', '').split()
self.cwd = section.get('cwd', host.dotfiles_root)
self.shell = section.get('shell', False)
def run(self):
kwargs = {
"cwd": self.cwd,
"stdout": subprocess.PIPE,
"text": True,
"shell": self.shell,
}
with subprocess.Popen(self.cmd, **kwargs) as proc:
line = proc.stdout.read()
if line:
print(line)

@ -0,0 +1,2 @@
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
Loading…
Cancel
Save