diff --git a/installer b/installer index dc284abf..dba7287f 100755 --- a/installer +++ b/installer @@ -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*) diff --git a/scripts/package/dump b/scripts/package/dump index 9b203019..d7b22ae0 100755 --- a/scripts/package/dump +++ b/scripts/package/dump @@ -11,6 +11,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh" ##? * Python ##? * Volta.sh or NPM ##? * Winget +##? * Dart ##? ##? Usage: ##? dump @@ -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' diff --git a/scripts/package/import b/scripts/package/import index f9f8cdce..980dd9b7 100755 --- a/scripts/package/import +++ b/scripts/package/import @@ -7,6 +7,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh" ##? * Brew ##? * Python ##? * Volta or NPM +##? * Dart ##? ##? Usage: ##? import @@ -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 diff --git a/scripts/package/src/dump.sh b/scripts/package/src/dump.sh index 604c00bc..7ad23a9a 100644 --- a/scripts/package/src/dump.sh +++ b/scripts/package/src/dump.sh @@ -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 @@ -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 +} + + + \ No newline at end of file