Skip to content

Instantly share code, notes, and snippets.

@toch
Created April 26, 2016 15:42
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
a Bash script to generate docset for Zeal from a group of gems
#!/bin/bash
# rubygem is required
# yard is required: gem install yard
# doc_to_dash is required: gem install doc_to_dash
GEM_NAME_PREFIX=$1
DOCSET_DIR=$2
TMP_DIR=$(mktemp -d)
for GEM_NAME in $(gem search --local $GEM_NAME_PREFIX | sed -e "/^$/d" -e "s/ \(.*\)$//"); do
GEM_DIR=$(find $GEM_HOME -type d -name "$GEM_NAME-[0-9]*" | grep $GEM_NAME_PREFIX | sort -r | head -1)
mkdir -p $TMP_DIR/$GEM_NAME
yardoc --title $GEM_NAME --readme --protected --private --embed-mixins --output-dir $TMP_DIR/$GEM_NAME $GEM_DIR
doc_to_dash -n $GEM_NAME -i $GEM_NAME_PREFIX.png -o $DOCSET_DIR $TMP_DIR/$GEM_NAME
cat <<EOF > $DOCSET_DIR/$GEM_NAME.docset/meta.json
{
"name": "$GEM_NAME",
"title": "$GEM_NAME"
}
EOF
done
rm -Rv $TMP_DIR
@OuttaSpaceTime
Copy link

can you provide some details on how to use this shell script and how to add in zeal aftewards?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment