[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/maintenance/resources/ -> update-oojs.sh (source)

   1  #!/usr/bin/env bash
   2  
   3  if [ -n "$2" ]
   4  then
   5      # Too many parameters
   6      echo >&2 "Usage: $0 [<version>]"
   7      exit 1
   8  fi
   9  
  10  REPO_DIR=$(cd "$(dirname $0)/../.."; pwd) # Root dir of the git repo working tree
  11  TARGET_DIR="resources/lib/oojs" # Destination relative to the root of the repo
  12  NPM_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'update-oojs') # e.g. /tmp/update-oojs.rI0I5Vir
  13  
  14  # Prepare working tree
  15  cd "$REPO_DIR" &&
  16  git reset $TARGET_DIR && git checkout $TARGET_DIR && git fetch origin &&
  17  git checkout -B upstream-oojs origin/master || exit 1
  18  
  19  # Fetch upstream version
  20  cd $NPM_DIR
  21  if [ -n "$1" ]
  22  then
  23      npm install "oojs@$1" || exit 1
  24  else
  25      npm install oojs || exit 1
  26  fi
  27  
  28  OOJS_VERSION=$(node -e 'console.log(JSON.parse(require("fs").readFileSync("./node_modules/oojs/package.json")).version);')
  29  if [ "$OOJS_VERSION" == "" ]
  30  then
  31      echo 'Could not find OOjs version'
  32      exit 1
  33  fi
  34  
  35  # Copy file(s)
  36  rsync --force ./node_modules/oojs/dist/oojs.jquery.js "$REPO_DIR/$TARGET_DIR" || exit 1
  37  
  38  # Clean up temporary area
  39  rm -rf "$NPM_DIR"
  40  
  41  # Generate commit
  42  cd $REPO_DIR || exit 1
  43  
  44  COMMITMSG=$(cat <<END
  45  Update OOjs to v$OOJS_VERSION
  46  
  47  Release notes:
  48   https://git.wikimedia.org/blob/oojs%2Fcore.git/v$OOJS_VERSION/History.md
  49  END
  50  )
  51  
  52  # Stage deletion, modification and creation of files. Then commit.
  53  git add --update $TARGET_DIR && git add $TARGET_DIR && git commit -m "$COMMITMSG" || exit 1


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1