Skip to content

Commit

Permalink
chore: remove checking for timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
miszo committed Jun 10, 2024
1 parent 325d87d commit d45d9b5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .chezmoiversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.48.1
2.48.2
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chezmoi 2.48.1
chezmoi 2.48.2
6 changes: 3 additions & 3 deletions home/.chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ vaultName = {{ $opWorkVaultName | quote }}

[data.brew]
brewfilePath = {{ joinPath .chezmoi.homeDir ".config" "brew" "Brewfile" | quote }}
bundleTimestampPath = {{ joinPath .chezmoi.homeDir ".config" "brew" "brew_bundle_timestamp.txt" | quote }}
fallbackDate = "1970-01-01T00:00:00+0000"
dateFormat = "%Y-%m-%dT%H:%M:%S%z"
toolVersionsPath = {{ joinPath .chezmoi.homeDir ".tool-versions" | quote }}

[data.velja]
veljaFilePath = {{ joinPath .chezmoi.homeDir ".config" "velja" "Velja.plist" | quote }}

[data.gh]
accountId = {{ $opPersonalAccountId }}
vaultId = {{ $opPersonalVaultId }}
Expand Down
44 changes: 8 additions & 36 deletions home/.chezmoiscripts/darwin/run_after_install-packages.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,6 @@ function asdf_install() {

asdf reshim
}

function get_current_date_utc() {
date -u +{{ .brew.dateFormat | quote }}
}

function get_fallback_date_utc() {
echo {{ .brew.fallbackDate | quote }}
}

function set_bundle_fallback_timestamp() {
echo "Setting current timestamp in {{ .brew.bundleTimestampPath }}"
get_fallback_date_utc > {{ .brew.bundleTimestampPath | quote }}
}

function set_bundle_timestamp() {
echo "Setting current timestamp in {{ .brew.bundleTimestampPath }}"
get_current_date_utc > {{ .brew.bundleTimestampPath | quote }}
}

function get_bundle_timestamp() {
if ! [ -e {{ .brew.bundleTimestampPath | quote }} ]; then
set_bundle_fallback_timestamp
fi
date -r {{ .brew.bundleTimestampPath }} +{{ .brew.dateFormat | quote }}
}

function get_brewfile_timestamp() {
date -r {{ .brew.brewfilePath }} +{{ .brew.dateFormat | quote }}
}

function update_theme() {
echo "You can update syntax highliting theme by running:"
echo "fast-theme XDG:catppuccin-mocha"
Expand All @@ -60,14 +30,16 @@ function install_gh_extensions() {
{{ end -}}
}

function update_velja_settings() {
echo "Updating Velja settings..."
defaults import com.sindresorhus.Velja {{ .velja.veljaFilePath }}
}

function main() {
if [[ $(get_brewfile_timestamp) > $(get_bundle_timestamp) ]];
then
brew_bundle
asdf_install
set_bundle_timestamp;
fi
brew_bundle
asdf_install
install_gh_extensions
update_velja_settings
update_theme
}

Expand Down
10 changes: 0 additions & 10 deletions home/dot_config/zsh/dot_zsh_functions.zsh.tmpl
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
# vim: syntax=sh

function get_current_date_utc() {
date -u +{{ .brew.dateFormat | quote }}
}

function set_bundle_timestamp() {
echo "Setting current timestamp in {{ .brew.bundleTimestampPath }}"
get_current_date_utc > {{ .brew.bundleTimestampPath | quote }}
}

function brew_bundle() {
echo "Run brew bundle..."
brew bundle --no-lock --file={{ .brew.brewfilePath }}
set_bundle_timestamp;
}

function brew_update {
Expand Down
2 changes: 1 addition & 1 deletion home/dot_tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
chezmoi 2.48.1
chezmoi 2.48.2
rust 1.77.1
ruby 3.2.3
nodejs 20.12.1
Expand Down

0 comments on commit d45d9b5

Please sign in to comment.