Skip to content

Commit

Permalink
DP-3498: ensure auto-update-repositories plist is in sync (#97)
Browse files Browse the repository at this point in the history
This PR introduces enhancements to the test-or-install function within
our tool repositories setup script. The primary goal of these changes is
to ensure that the plist file
(com.includedhealth.auto-update-repositories.plist) is always kept in
sync with its source version located in the core library directory.
  • Loading branch information
pb-dod authored Jun 18, 2024
1 parent 57665e9 commit be80090
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.56
0.1.57
2 changes: 1 addition & 1 deletion formula/ih-core.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class IhCore < Formula
VERSION="0.1.56"
VERSION="0.1.57"
desc "Brew formula for installing core tools used at Included Health engineering."
homepage "https://github.com/ConsultingMD/homebrew-ih-public"
license "CC BY-NC-ND 4.0"
Expand Down
19 changes: 10 additions & 9 deletions lib/core/toolrepos/step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,19 @@ function ih::setup::core.toolrepos::test-or-install() {
git clone git@github.com:ConsultingMD/kore.git --filter=blob:limit=1m --depth=5 "${GR_HOME}/kore" || return
fi

local toolsrepo_src_path="$IH_CORE_LIB_DIR/core/toolrepos/default/10_toolrepos.sh"
local toolsrepo_tgt_path="$IH_DEFAULT_DIR/10_toolrepos.sh"

PLIST_FILE="$HOME/Library/LaunchAgents/com.includedhealth.auto-update-repositories.plist"
if [ ! -f "$PLIST_FILE" ]; then
local plist_src_path="$IH_CORE_LIB_DIR/core/toolrepos/autoupdate/com.includedhealth.auto-update-repositories.plist"
local plist_tgt_path="$HOME/Library/LaunchAgents/com.includedhealth.auto-update-repositories.plist"
if [ ! -f "$plist_tgt_path" ] || ! ih::file::check-file-in-sync "$plist_src_path" "$plist_tgt_path"; then
if [ "$1" == "test" ]; then
return 1
fi
cp -f "$plist_src_path" "$plist_tgt_path"
ih::log::info "Plist file updated."
ih::setup::core.toolrepos::set-auto-update-repositories-job
fi

local toolsrepo_src_path="$IH_CORE_LIB_DIR/core/toolrepos/default/10_toolrepos.sh"
local toolsrepo_tgt_path="$IH_DEFAULT_DIR/10_toolrepos.sh"
if ! ih::file::check-file-in-sync "$toolsrepo_src_path" "$toolsrepo_tgt_path"; then
if [ "$1" = "test" ]; then
return 1
Expand Down Expand Up @@ -101,11 +103,9 @@ manually in order to have pre-commit configured correctly."
}

function ih::setup::core.toolrepos::set-auto-update-repositories-job() {

local THIS_DIR="$IH_CORE_LIB_DIR/core/toolrepos/autoupdate"

PLIST_FILE="com.includedhealth.auto-update-repositories"
LAUNCH_AGENTS_PATH="${HOME}/Library/LaunchAgents/${PLIST_FILE}.plist"
local PLIST_FILE="com.includedhealth.auto-update-repositories"
local LAUNCH_AGENTS_PATH="${HOME}/Library/LaunchAgents/${PLIST_FILE}.plist"

# shellcheck disable=SC2001
GR_HOME_ESC=$(echo "$GR_HOME" | sed 's_/_\\/_g')
Expand All @@ -120,4 +120,5 @@ function ih::setup::core.toolrepos::set-auto-update-repositories-job() {

launchctl load "${LAUNCH_AGENTS_PATH}"

ih::log::info "Plist file loaded successfully: $LAUNCH_AGENTS_PATH"
}

0 comments on commit be80090

Please sign in to comment.