feat: add profile awareness
This commit is contained in:
parent
63d1aba020
commit
98890b34d2
3 changed files with 29 additions and 14 deletions
15
README.md
15
README.md
|
@ -5,7 +5,7 @@ Environment tweaks for everyday happiness.
|
|||
## Setup
|
||||
|
||||
```bash
|
||||
git clone git@github.com:mcataford/env.git <path-of-your-choosing> | . ./bootstrap.sh
|
||||
git clone git@github.com:mcataford/env.git <path-of-your-choosing> | ./bootstrap.sh
|
||||
```
|
||||
|
||||
The setup script will look for pre-existing managed blocks and will not update the file if one is found.
|
||||
|
@ -16,6 +16,11 @@ Since the managed blocks only `source` the files in this repository, pulling in
|
|||
new tweaks you want to apply. If changes are made to the managed blocks, you will need to first remove them from where
|
||||
they live and rerun the setup script.
|
||||
|
||||
## Profiles
|
||||
|
||||
A profile must be provided via `$ENV_PROFILE`. This can be used by steps to determine variants of a file to copy over.
|
||||
Files with profile specificity should be named `file.<profile>.<extension>`.
|
||||
|
||||
## Structure
|
||||
|
||||
The package is structured as such:
|
||||
|
@ -27,17 +32,11 @@ env/
|
|||
shell_extras # Functions, aliases and exports for the shell.
|
||||
extras.vim # Common config for neovim.
|
||||
git_config # Configuration commands for git
|
||||
starship.toml # Starship prompt configuration
|
||||
... Other configuration templates
|
||||
```
|
||||
|
||||
Adding code to `shell_extras` will add code that gets executed on shell-start.
|
||||
|
||||
### Adding steps
|
||||
|
||||
Each step is defined as a function in `steps.sh` and should start with a call to `pre_step` to ensure that a header gets
|
||||
echo'ed out. Additionally, the function should be called from `bootstrap` in `bootstrap.sh` and the `TOTAL_STEPS` should
|
||||
be updated to reflect the number of steps.
|
||||
|
||||
## Contributing
|
||||
|
||||
I'm not currently looking for contributions since this is mainly about standardizing my own setup across machines.
|
||||
|
|
26
bootstrap.sh
26
bootstrap.sh
|
@ -183,7 +183,7 @@ install_gh_plugins() {
|
|||
gh extension install nektos/gh-act
|
||||
|
||||
gh extension install dlvhdr/gh-dash
|
||||
copy_file ./files/gh-dash_config.yml ~/.config/gh-dash/config.yml
|
||||
copy_file ./files/gh-dash_config.$ENV_PROFILE.yml ~/.config/gh-dash/config.yml
|
||||
|
||||
gh extension upgrade --all
|
||||
}
|
||||
|
@ -249,10 +249,9 @@ inject_vim_configuration() {
|
|||
#
|
||||
###########################################################
|
||||
|
||||
bootstrap_home() {
|
||||
TOTAL_STEPS=10
|
||||
|
||||
# Refer to steps.sh for step definition.
|
||||
bootstrap() {
|
||||
# System updates
|
||||
ensure_apt_up_to_date
|
||||
ensure_apt_dependencies
|
||||
|
@ -271,5 +270,22 @@ bootstrap() {
|
|||
inject_vim_configuration
|
||||
}
|
||||
|
||||
bootstrap
|
||||
return
|
||||
bootstrap_work() {
|
||||
TOTAL_STEPS=4
|
||||
|
||||
install_gh_plugins
|
||||
|
||||
install_omz
|
||||
install_and_configure_starship
|
||||
|
||||
inject_shell_configuration
|
||||
inject_vim_configuration
|
||||
}
|
||||
|
||||
if [[ $ENV_PROFILE == "home" ]]; then
|
||||
bootstrap_home
|
||||
elif [[ $ENV_PROFILE == "work" ]]; then
|
||||
bootstrap_work
|
||||
else
|
||||
echo "Unknown \$ENV_PROFILE. :shrug:"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue