Skip to content

Commit 86fbc0c

Browse files
committed
Merge branch 'main_upstream'
* main_upstream: style: fix linter feat: add support for 'asdf' sdk manager (CodelyTV#240) fix(npm): remove sudo from npm install command in update_all function (CodelyTV#277) ci: upgrade macos version (CodelyTV#279) ci: upgrade Ubuntu version (CodelyTV#278) feat: ensure default branch name for dotfiles repository (CodelyTV#242) fix: correct find -perm option for macos (CodelyTV#272) fix: restore script with -c option leads to infinite loop (CodelyTV#243) # Conflicts: # scripts/package/dump # scripts/package/import # scripts/package/src/dump.sh
2 parents 771b4f4 + e381c55 commit 86fbc0c

8 files changed

Lines changed: 54 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
os:
16-
- macos-12
17-
- ubuntu-20.04
16+
- macos-26
17+
- ubuntu-24.04
1818

1919
steps:
2020
- uses: actions/checkout@v2

installer

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ DOTFILES_PATH="${DOTFILES_PATH:-$HOME/.dotfiles}"
7171
DOTFILES_PATH="$(eval echo "$DOTFILES_PATH")"
7272
export DOTFILES_PATH="$DOTFILES_PATH"
7373

74+
DOTFILES_BRANCH=${DOTFILES_BRANCH:-main}
75+
7476
dotly_inner_path="modules/dotly"
7577
export DOTLY_PATH="$DOTFILES_PATH/$dotly_inner_path"
7678

@@ -140,7 +142,7 @@ if ! command_exists curl; then
140142
fi
141143

142144
_a "Initializing your dotfiles git repository"
143-
git init 2>&1 | _log "Initializing repository"
145+
git init --initial-branch="$DOTFILES_BRANCH" 2>&1 | _log "Initializing repository"
144146

145147
_a "Cloning dotly"
146148
git submodule add -b "$DOTLY_BRANCH" "https://github.com/$DOTLY_REPOSITORY.git" "$dotly_inner_path" 2>&1 | _log "Adding dotly submodule"

restorer

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ EOF
4545
;;
4646
--continue | -c)
4747
continue=true
48+
break
4849
;;
4950
*) ;;
5051

scripts/core/dot.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ dot::list_scripts() {
2525
}
2626

2727
dot::list_scripts_path() {
28-
dotly_contexts=$(find "$DOTLY_PATH/scripts" -maxdepth 2 -perm /+111 -type f | grep -v "$DOTLY_PATH/scripts/core")
29-
dotfiles_contexts=$(find "$DOTFILES_PATH/scripts" -maxdepth 2 -perm /+111 -type f)
28+
if platform::is_macos; then
29+
dotly_contexts=$(find "$DOTLY_PATH/scripts" -maxdepth 2 -perm -111 -type f | grep -v "$DOTLY_PATH/scripts/core")
30+
dotfiles_contexts=$(find "$DOTFILES_PATH/scripts" -maxdepth 2 -perm -111 -type f)
31+
else
32+
dotly_contexts=$(find "$DOTLY_PATH/scripts" -maxdepth 2 -perm /+111 -type f | grep -v "$DOTLY_PATH/scripts/core")
33+
dotfiles_contexts=$(find "$DOTFILES_PATH/scripts" -maxdepth 2 -perm /+111 -type f)
34+
fi
3035

3136
printf "%s\n%s" "$dotly_contexts" "$dotfiles_contexts" | sort -u
3237
}

scripts/package/dump

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh"
1111
##? * Python
1212
##? * Volta.sh or NPM
1313
##? * Winget
14+
##? * asdf
1415
##?
1516
##? Usage:
1617
##? dump
@@ -34,6 +35,8 @@ fi
3435

3536
platform::command_exists winget.exe && package::winget_dump && output::answer "Windows apps dumped on $WINGET_DUMP_FILE_PATH"
3637

38+
platform::command_exists asdf && package::asdf_dump && output::answer "asdf SDKs dumped on $ASDF_DUMP_FILE_PATH"
39+
3740
platform::command_exists sdk && package::sdkman_dump && output::answer "SDKMAN candidates dumped on $SDKMAN_DUMP_FILE_PATH"
3841

3942
output::write 'All packages dumped'

scripts/package/import

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ fi
3232

3333
platform::command_exists winget.exe && output::header "Importing Winget apps from $WINGET_DUMP_FILE_PATH" && package::winget_import
3434

35+
platform::command_exists asdf && output::header "Importing Asdf apps from $ASDF_DUMP_FILE_PATH" && package::asdf_import
36+
3537
platform::command_exists sdk && output::header "Importing SDKMAN candidates from $SDKMAN_DUMP_FILE_PATH" && package::sdkman_import
3638

3739
output::solution 'All packages imported'

scripts/package/src/dump.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ PYTHON_DUMP_FILE_PATH="$DOTFILES_PATH/langs/python/requirements.txt"
1414
SNAP_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/snap/packages.txt"
1515
VOLTA_DUMP_FILE_PATH="$DOTFILES_PATH/langs/js/volta_dependencies.txt"
1616
WINGET_DUMP_FILE_PATH="$DOTFILES_PATH/os/windows/winget.output"
17+
ASDF_DUMP_FILE_PATH="$DOTFILES_PATH/langs/sdk/asdf.txt"
1718
SDKMAN_DUMP_FILE_PATH="$DOTFILES_PATH/os/mac/sdk/candidates.txt"
1819

1920
package::brew_dump() {
@@ -126,6 +127,40 @@ package::pacman_import() {
126127
fi
127128
}
128129

130+
package::asdf_dump() {
131+
mkdir -p "$DOTFILES_PATH/langs/sdk"
132+
echo -n >$ASDF_DUMP_FILE_PATH
133+
134+
for plug in $(asdf plugin-list); do
135+
for ver in $(asdf list $plug | awk '{print $1; }'); do
136+
if [ -z "$ver" ]; then
137+
echo "No versions installed for $plug"
138+
else
139+
echo "$plug $ver" >>$ASDF_DUMP_FILE_PATH
140+
fi
141+
done
142+
done
143+
}
144+
145+
package::asdf_import() {
146+
if [ -f "$ASDF_DUMP_FILE_PATH" ]; then
147+
for plug in $(cat $ASDF_DUMP_FILE_PATH | awk '{ print $1 }' | uniq); do
148+
echo "asdf plugin-add $plug"
149+
done
150+
while read -r line; do
151+
plug=$(echo $line | awk '{print $1; }')
152+
ver=$(echo $line | awk '{print $2; }')
153+
if [[ $ver == \** ]]; then
154+
ver=${ver:1}
155+
echo "asdf install $plug $ver"
156+
echo "asdf global $plug $ver"
157+
else
158+
echo "asdf install $plug $ver"
159+
fi
160+
done <$ASDF_DUMP_FILE_PATH
161+
fi
162+
}
163+
129164
package::sdkman_dump() {
130165
mkdir -p "$DOTFILES_PATH/os/mac/sdk"
131166

scripts/package/src/package_managers/npm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm::update_all() {
1717
output::write "$url"
1818
output::empty_line
1919

20-
sudo npm install --location=global "$package" 2>&1 | log::file "Updating npm app: $package"
20+
npm install --location=global "$package" 2>&1 | log::file "Updating npm app: $package"
2121
done
2222
else
2323
output::answer "Already up-to-date"

0 commit comments

Comments
 (0)