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 [run submodules]
# relative location as they appear in the dotfiles repo cmd: git submodule init
[home]
files:
# sync vim plugin directories but not all of .vim
.vim/ftplugin
.vim/pack
# individual files to sync [home bash-prefs]
when: host.has('bash')
files:
.bash_profile .bash_profile
.bashrc .bashrc
[home vim]
when: host.has('vim')
files:
.vim/ftplugin
.vim/pack
.vimrc .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] [home htop]
when: not host.is_windows when: host.has('htop')
files: .config/htop/htoprc
files: [home lazydocker]
.screenrc when: host.has('lazydocker')
.tmux.conf files: .config/lazydocker/config.yml
.config/lazydocker/config.yml
.config/htop/htoprc [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] [home wsl]
when: host.is_wsl when: host.is_wsl
files: scripts/winmode > bin/winmode
files: [link-files windows-neovim]
scripts/winmode > bin/winmode when: host.is_windows and host.has('nvim')
[link-files AppData]
when: host.is_windows
target_root: ~/AppData/Local target_root: ~/AppData/Local
files: files:
nvim/lua nvim/lua
.vim/ftplugin > nvim/ftplugin
.vimrc > nvim/init.vim .vimrc > nvim/init.vim
Vundle.vim > nvim/bundle/Vundle.vim Vundle.vim > nvim/bundle/Vundle.vim
.vim/ftplugin > nvim/ftplugin
packer.nvim > nvim-data/site/pack/packer/start/packer.nvim packer.nvim > nvim-data/site/pack/packer/start/packer.nvim
[cargo-install] [cargo-install]
crates: crates:
just just

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

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