Skip to content

Instantly share code, notes, and snippets.

@uglyrobot
Last active September 14, 2017 07:28
Show Gist options
  • Save uglyrobot/e872d1a9efc122b6bae2 to your computer and use it in GitHub Desktop.
Save uglyrobot/e872d1a9efc122b6bae2 to your computer and use it in GitHub Desktop.

Revisions

  1. uglyrobot revised this gist Sep 22, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion package-plugin
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ fi

    #check that the plugin/theme version number matches what you provided. Note if multiple root php files have a "Version" header
    # line it will only grab the first it finds. Also if a theme and you have a php file in root with "Version" could cause mismatch.
    HEADERVERSION=`grep -m 1 --include={*.php,style.css} "^Version" * | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'`
    HEADERVERSION=`grep -m 1 --include={*.php,style.css} "Version" * | sed -e 's/^[ \t]*//' | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'`
    if [ "$VERSION" != "$HEADERVERSION" ]; then echo "Version doesn't match the plugin/theme header. Exiting...."; exit 2; fi

    #get the changelog message
  2. uglyrobot revised this gist Jun 19, 2014. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions package-plugin
    Original file line number Diff line number Diff line change
    @@ -8,19 +8,20 @@ fi

    if [[ -z "$VERSION" ]] ; then
    echo "Sorry, I need a version number!"
    exit 0
    exit 1
    fi

    #check that the plugin/theme version number matches what you provided
    #check that the plugin/theme version number matches what you provided. Note if multiple root php files have a "Version" header
    # line it will only grab the first it finds. Also if a theme and you have a php file in root with "Version" could cause mismatch.
    HEADERVERSION=`grep -m 1 --include={*.php,style.css} "^Version" * | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'`
    if [ "$VERSION" != "$HEADERVERSION" ]; then echo "Version doesn't match the plugin/theme header. Exiting...."; exit 1; fi
    if [ "$VERSION" != "$HEADERVERSION" ]; then echo "Version doesn't match the plugin/theme header. Exiting...."; exit 2; fi

    #get the changelog message
    echo "Enter your multiline changelog then ctrl-d on a new line when done:"
    MSG=$(cat)
    if [[ -z "$MSG" ]] ; then
    echo "Sorry, I need a changelog for this release!"
    exit 0
    exit 3
    fi

    #get plugin slug/name from current directory
  3. uglyrobot revised this gist Jun 14, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions package-plugin
    Original file line number Diff line number Diff line change
    @@ -15,13 +15,15 @@ fi
    HEADERVERSION=`grep -m 1 --include={*.php,style.css} "^Version" * | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'`
    if [ "$VERSION" != "$HEADERVERSION" ]; then echo "Version doesn't match the plugin/theme header. Exiting...."; exit 1; fi

    #get the changelog message
    echo "Enter your multiline changelog then ctrl-d on a new line when done:"
    MSG=$(cat)
    if [[ -z "$MSG" ]] ; then
    echo "Sorry, I need a changelog for this release!"
    exit 0
    fi

    #get plugin slug/name from current directory
    NAME=${PWD##*/}

    git tag -a $VERSION -m "$MSG"
  4. uglyrobot revised this gist Jun 14, 2014. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions package-plugin
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,10 @@ if [[ -z "$VERSION" ]] ; then
    exit 0
    fi

    #check that the plugin/theme version number matches what you provided
    HEADERVERSION=`grep -m 1 --include={*.php,style.css} "^Version" * | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'`
    if [ "$VERSION" != "$HEADERVERSION" ]; then echo "Version doesn't match the plugin/theme header. Exiting...."; exit 1; fi

    echo "Enter your multiline changelog then ctrl-d on a new line when done:"
    MSG=$(cat)
    if [[ -z "$MSG" ]] ; then
  5. uglyrobot revised this gist Jun 13, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion package-plugin
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ if [[ -z "$VERSION" ]] ; then
    exit 0
    fi

    echo "Enter your multiline changelog and ctrl-d on a new line when done:"
    echo "Enter your multiline changelog then ctrl-d on a new line when done:"
    MSG=$(cat)
    if [[ -z "$MSG" ]] ; then
    echo "Sorry, I need a changelog for this release!"
  6. uglyrobot renamed this gist Jun 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. uglyrobot revised this gist Jun 13, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion plugin-package.sh
    Original file line number Diff line number Diff line change
    @@ -22,5 +22,5 @@ NAME=${PWD##*/}

    git tag -a $VERSION -m "$MSG"
    git push origin $VERSION
    git-archive-all --prefix $NAME/ ~/Desktop/$NAME-$VERSION.zip
    git-archive-all --force-submodules --prefix $NAME/ ~/Desktop/$NAME-$VERSION.zip
    echo "Tagged in bitbucket and Packaged as $NAME-$VERSION.zip on your desktop."
  8. uglyrobot created this gist Jun 13, 2014.
    26 changes: 26 additions & 0 deletions plugin-package.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/bin/bash
    if [[ $# -eq 0 ]] ; then
    echo "Please enter a version number:"
    read VERSION
    else
    VERSION=$1
    fi

    if [[ -z "$VERSION" ]] ; then
    echo "Sorry, I need a version number!"
    exit 0
    fi

    echo "Enter your multiline changelog and ctrl-d on a new line when done:"
    MSG=$(cat)
    if [[ -z "$MSG" ]] ; then
    echo "Sorry, I need a changelog for this release!"
    exit 0
    fi

    NAME=${PWD##*/}

    git tag -a $VERSION -m "$MSG"
    git push origin $VERSION
    git-archive-all --prefix $NAME/ ~/Desktop/$NAME-$VERSION.zip
    echo "Tagged in bitbucket and Packaged as $NAME-$VERSION.zip on your desktop."