From c53a63accaa33e1d5a726a3903768e98dfd0f73d Mon Sep 17 00:00:00 2001 From: Yegor Jbanov Date: Tue, 17 Nov 2015 22:09:19 -0800 Subject: [PATCH] chore(build): spin off pub_prepare.sh from pub_publish.sh --- scripts/publish/pub_prepare.sh | 25 +++++++++++++++++++++++++ scripts/publish/pub_publish.sh | 7 +------ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100755 scripts/publish/pub_prepare.sh diff --git a/scripts/publish/pub_prepare.sh b/scripts/publish/pub_prepare.sh new file mode 100755 index 0000000000..6d7a681e8b --- /dev/null +++ b/scripts/publish/pub_prepare.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# This script prepares build artifacts for upload to pub. +# +# Usage: +# +# scripts/publish/pub_prepare.sh PACKAGE_NAME + +set -ex +shopt -s extglob + +NAME=$1 +ROOT_DIR=$(cd $(dirname $0)/../..; pwd) +cd $ROOT_DIR + +PKG_DIR=$ROOT_DIR/dist/pub +FILES='!(e2e_test|pubspec.lock)' + +PUBLISH_DIR=$PKG_DIR/$NAME +rm -fr $PUBLISH_DIR +mkdir -p $PUBLISH_DIR + +cp -RP $ROOT_DIR/dist/dart/$NAME/$FILES $PUBLISH_DIR + +node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml diff --git a/scripts/publish/pub_publish.sh b/scripts/publish/pub_publish.sh index 404d2673b1..627d7851cf 100755 --- a/scripts/publish/pub_publish.sh +++ b/scripts/publish/pub_publish.sh @@ -21,17 +21,12 @@ gulp build.dart.material PKG_DIR=$ROOT_DIR/dist/pub rm -fr $PKG_DIR -FILES='!(e2e_test|pubspec.lock)' function publishModule { NAME=$1 PUBLISH_DIR=$PKG_DIR/$NAME - rm -fr $PUBLISH_DIR - mkdir -p $PUBLISH_DIR - cp -RP $ROOT_DIR/dist/dart/$NAME/$FILES $PUBLISH_DIR - - node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml + scripts/publish/pub_prepare.sh $NAME if [[ "$DRY_RUN" == "false" ]]; then (cd $PUBLISH_DIR && pub publish -f)