Skip to content
This repository
tag: 1.16.2
Fetching contributors…

Cannot retrieve contributors at this time

executable file 26 lines (14 sloc) 0.548 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/usr/bin/env bash

printf "\nBeginning snapshot of the current environment gem list into snapshot.gems\n"

file_name="snapshot.gems"

gems=($(gem list | sed 's#[\(|\)]##g' | sed 's#, #,#g' | \tr ' ' ';'))

for gem in "${gems[@]}" ; do

  name="${gem%%;*}"

  versions=${gem#*;}
  versions=(${versions/,/ })

  for version in "${versions[@]}" ; do

    echo "$name -v$version" >> "$file_name"

  done ; unset version versions

done ; unset file_name

printf "\nCompleted snapshot of the current environment gem list into snapshot.gems\n"

exit $?
Something went wrong with that request. Please try again.