Skip to content

Commit

Permalink
shorten key names in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
femnad committed Dec 27, 2023
1 parent 14f9861 commit 27e9163
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 71 deletions.
30 changes: 15 additions & 15 deletions base/fup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ type UserInGroupSpec map[string][]entity.Group
type Config struct {
file string
isRemote bool
AcceptHostKeys []string `yaml:"accept_host_keys"`
AptRepos []entity.AptRepo `yaml:"apt_repos"`
Archives []Archive `yaml:"archives"`
Binaries []entity.Binary `yaml:"binaries"`
AcceptHostKeys []string `yaml:"host_key"`
AptRepos []entity.AptRepo `yaml:"apt_repo"`
Archives []Archive `yaml:"archive"`
Binaries []entity.Binary `yaml:"binary"`
Cargo []CargoPkg `yaml:"rust"`
DnfRepos []entity.DnfRepo `yaml:"dnf_repos"`
EnsureDirs []string `yaml:"ensure_dirs"`
EnsureLines []LineInFile `yaml:"ensure_lines"`
DnfRepos []entity.DnfRepo `yaml:"dnf_repo"`
EnsureDirs []string `yaml:"dir"`
EnsureLines []LineInFile `yaml:"line"`
Flatpak entity.Flatpak `yaml:"flatpak"`
GithubUserKey UserKey `yaml:"github_user_keys"`
GithubUserKey UserKey `yaml:"github_key"`
Go []GoPkg `yaml:"go"`
Packages PackageSpec `yaml:"packages"`
Packages PackageSpec `yaml:"package"`
PostflightTasks []Task `yaml:"postflight"`
PreflightTasks []Task `yaml:"preflight"`
Python []PythonPkg `yaml:"python"`
RemotePackages RemotePackageSpec `yaml:"remote_packages"`
RepoGroups []entity.RepoGroup `yaml:"repos"`
Services []Service `yaml:"services"`
RemotePackages RemotePackageSpec `yaml:"remote_package"`
RepoGroups []entity.RepoGroup `yaml:"repo"`
Services []Service `yaml:"service"`
Settings settings.Settings `yaml:"settings"`
SnapPackages []entity.Snap `yaml:"snap"`
Tasks []Task `yaml:"tasks"`
Tasks []Task `yaml:"task"`
Templates []Template `yaml:"template"`
UserInGroup UserInGroupSpec `yaml:"user_in_group"`
UnwantedDirs []string `yaml:"unwanted_dirs"`
UserInGroup UserInGroupSpec `yaml:"user_group"`
UnwantedDirs []string `yaml:"rmdir"`
}

func (c Config) IsRemote() bool {
Expand Down
80 changes: 33 additions & 47 deletions contrib/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,26 @@ settings:
versions:
gh: 2.29.0

preflight:
- task: Enable RPM Fusion
when: is-fedora
steps:
- name: shell
cmd: dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo: true
unless:
cmd: dnf list --installed rpmfusion-free-release
- task: Add Spotify repo
when: is-ubuntu
unless:
stat: /etc/apt/sources.list.d/spotify.list
steps:
- name: shell
sudo: true
cmd: |
curl -sS https://download.spotify.com/debian/pubkey_5E3C45D7B312C643.gpg | sudo apt-key add -
echo 'deb http://repository.spotify.com stable non-free' | sudo tee /etc/apt/sources.list.d/spotify.list
apt update
apt_repo:
- when: os "ubuntu"
gpg_key: https://download.docker.com/linux/ubuntu/gpg
name: docker
repo: https://download.docker.com/linux/ubuntu

archives:
dnf_repo:
- when: os "fedora"
name: rpmfusion
packages:
- rpmfusion-free-release
- rpmfusion-free-release
url:
- https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${version_id}.noarch.rpm
- https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${version_id}.noarch.rpm
- when: os "fedora"
name: docker-ce
repo: https://download.docker.com/linux/fedora/docker-ce.repo

archive:
- url: https://github.com/cli/cli/releases/download/v${version}/gh_${version}_linux_amd64.tar.gz
name: gh
unless:
Expand All @@ -43,7 +41,7 @@ archives:
link:
- gh_${version}_linux_amd64/bin/gh

packages:
package:
- pkg:
- pass
- when: os "ubuntu"
Expand All @@ -52,17 +50,17 @@ packages:
- when: os "fedora"
pkg:
- dnf-automatic

unwanted_packages:
ubuntu:
- when: os "ubuntu"
pkg:
- snapd
absent: true

cargo:
rust:
- name: alacritty
unless:
cmd: alacritty --version

tasks:
task:
- task: Install Mullvad app
when: is-ubuntu
unless:
Expand Down Expand Up @@ -95,7 +93,7 @@ python:
unless:
cmd: qmk -V

services:
service:
- name: grobi
unit:
exec: grobi watch -v
Expand All @@ -117,32 +115,20 @@ template:
dest: /etc/apt/apt.conf.d/50unattended-upgrades
when: is-ubuntu

postflight:
# Useful if Go binaries were installed before GOPATH was set
- task: Move go dir
when: gopath-set
unless:
stat: ${GOPATH}
steps:
- name: rename
src: ~/go
target: ${GOPATH}

github_user_keys:
# Not a user
github_key:
user: cli

ensure_dirs:
dir:
- ~/taxes

accept_host_keys:
host_key:
- github.com
- gitlab.com

unwanted_dirs:
rmdir:
- ~/snap

repos:
repo:
- clone:
- name: cli/cli
- name: https://gitlab.com/gitlab-org/cli/
Expand All @@ -151,11 +137,11 @@ repos:
remotes:
upstream: https://github.com/zsa/qmk_firmware.git

user_in_group:
user_group:
foo:
- name: video

ensure_lines:
line:
- name: replace
file: /etc/dnf/automatic.conf
replace:
Expand Down
2 changes: 1 addition & 1 deletion provision/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func NewProvisioner(cfg base.Config, filter []string) (Provisioner, error) {
{"archive", p.extractArchives},
{"binary", p.downloadBinaries},
{"package", p.installPackages},
{"hosts", p.acceptHostKeys},
{"host", p.acceptHostKeys},
{"github", p.githubUserKey},
{"go", p.goInstall},
{"python", p.pythonInstall},
Expand Down
8 changes: 4 additions & 4 deletions tests/config/test-remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ settings:
versions:
chezmoi: 2.42.2

apt_repos:
apt_repo:
- when: os "ubuntu"
gpg_key: https://download.docker.com/linux/ubuntu/gpg
name: docker
repo: https://download.docker.com/linux/ubuntu

packages:
package:
- pkg:
- docker-ce
- neovim
when: pkg "apt"

archives:
archive:
- url: https://github.com/twpayne/chezmoi/releases/download/v${version}/chezmoi_${version}_linux_amd64.tar.gz
name: chezmoi
unless:
cmd: chezmoi --version
post: split 2 | cut 1 | cut -1

tasks:
task:
- task: Clone chezmoi
unless:
stat: ~/.local/share/chezmoi
Expand Down
8 changes: 4 additions & 4 deletions tests/config/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ settings:
versions:
chezmoi: 2.42.2

apt_repos:
apt_repo:
- when: os "ubuntu"
gpg_key: https://download.docker.com/linux/ubuntu/gpg
name: docker
repo: https://download.docker.com/linux/ubuntu

packages:
package:
- pkg:
- docker-ce
- neovim
when: pkg "apt"

archives:
archive:
- url: https://github.com/twpayne/chezmoi/releases/download/v${version}/chezmoi_${version}_linux_amd64.tar.gz
name: chezmoi
unless:
cmd: chezmoi --version
post: split 2 | cut 1 | cut -1

tasks:
task:
- task: Clone chezmoi
unless:
stat: ~/.local/share/chezmoi
Expand Down

0 comments on commit 27e9163

Please sign in to comment.