Skip to content

Instantly share code, notes, and snippets.

@mfdj
Last active December 3, 2015 23:10
Show Gist options
  • Select an option

  • Save mfdj/d42883545f5f7434322f to your computer and use it in GitHub Desktop.

Select an option

Save mfdj/d42883545f5f7434322f to your computer and use it in GitHub Desktop.
atom package manager install is not lazy (it always does a fresh install of a package), but with some shell magic you can make it lazy
#!/usr/bin/env bash
apm_lazy_install() {
for package in $@; do
apm list | grep $package > /dev/null ||
apm install $pacakge
done
}
apm_lazier_install() {
for package in $@; do
ls -l ~/.atom/packages | grep $package > /dev/null ||
apm list | grep $package > /dev/null ||
apm install $package
done
}
echo && echo lazy install
time apm_lazy_install \
atom-beautify atom-handlebars editorconfig emmet file-types language-gherkin \
language-gitignore language-haml pretty-json seti-syntax seti-ui
echo && echo lazier install
time apm_lazier_install \
atom-beautify atom-handlebars editorconfig emmet file-types language-gherkin \
language-gitignore language-haml pretty-json seti-syntax seti-ui
echo && echo 'normal install (ouch)'
time apm install \
atom-beautify atom-handlebars editorconfig emmet file-types language-gherkin \
language-gitignore language-haml pretty-json seti-syntax seti-ui
lazy install
real 0m5.888s
user 0m5.192s
sys 0m0.717s
lazier install
real 0m0.040s
user 0m0.022s
sys 0m0.029s
normal install (ouch)
Installing atom-beautify to …/.atom/packages ✓
Installing atom-handlebars to …/.atom/packages ✓
Installing editorconfig to …/.atom/packages ✓
Installing emmet to …/.atom/packages ✓
Installing file-types to …/.atom/packages ✓
Installing language-gherkin to …/.atom/packages ✓
Installing language-gitignore to …/.atom/packages ✓
Installing language-haml to …/.atom/packages ✓
Installing pretty-json to …/.atom/packages ✓
Installing seti-syntax to …/.atom/packages ✓
Installing seti-ui to …/.atom/packages ✓
real 0m49.144s
user 0m39.446s
sys 0m16.270s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment