Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for dart #261

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions installer
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ if ! command_exists git; then
elif command_exists pacman; then
_a "Installing using pacman"
sudo pacman -S --noconfirm git 2>&1 | _log "Installing git"
elif command_exists brew; then
_a "Installing dart using brew"
brew tap dart-lang/dart 2>&1
brew install dart 2>&1 | _log "Installing dart"
else
case "$OSTYPE" in
darwin*)
Expand Down
3 changes: 3 additions & 0 deletions scripts/package/dump
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh"
##? * Python
##? * Volta.sh or NPM
##? * Winget
##? * Dart
##?
##? Usage:
##? dump
Expand All @@ -34,4 +35,6 @@ fi

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

platform::command_exists dart && package::dart_dump && output::answer "Dart apps dumped on $DART_DUMP_FILE_PATH"

output::write 'All packages dumped'
3 changes: 3 additions & 0 deletions scripts/package/import
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh"
##? * Brew
##? * Python
##? * Volta or NPM
##? * Dart
##?
##? Usage:
##? import
Expand All @@ -24,6 +25,8 @@ platform::command_exists pip3 && output::header "Importing Python apps from $PYT

platform::command_exists code && output::header "Importing VSCode extensions from $CODE_DUMP_FILE_PATH" && package::code_import

platform::command_exists dart && output::header "Importing Dart packages from $DART_DUMP_FILE_PATH" && package::dart_import

if platform::command_exists volta; then
output::header "Importing Volta apps from $VOLTA_DUMP_FILE_PATH" && package::volta_import
elif platform::command_exists npm; then
Expand Down
16 changes: 16 additions & 0 deletions scripts/package/src/dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PYTHON_DUMP_FILE_PATH="$DOTFILES_PATH/langs/python/requirements.txt"
SNAP_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/snap/packages.txt"
VOLTA_DUMP_FILE_PATH="$DOTFILES_PATH/langs/js/volta_dependencies.txt"
WINGET_DUMP_FILE_PATH="$DOTFILES_PATH/os/windows/winget.output"
DART_DUMP_FILE_PATH="$DOTFILES_PATH/langs/dart/packages.txt"

package::brew_dump() {
if platform::is_macos; then
Expand Down Expand Up @@ -124,3 +125,18 @@ package::pacman_import() {
yay -s "$(cat $PACMAN_DUMP_FILE_PATH)"
fi
}

package::dart_dump() {
mkdir -p "$DOTFILES_PATH/langs/dart"

dart pub global list > "$DART_DUMP_FILE_PATH"
}

package::dart_import() {
if [ -f "$DART_DUMP_FILE_PATH" ]; then
< $DART_DUMP_FILE_PATH | xargs -n 2 -0 | xargs -I{} sh -c 'V="{}"; dart pub global activate ${V% *} ${V#* }'
fi
}