Skip to content

Commit

Permalink
chore: prep 1.4.0 release (#28)
Browse files Browse the repository at this point in the history
- chore: Add setup_private_specs support script to enable easier local dev
  • Loading branch information
palpatim authored Jul 31, 2020
1 parent 4cfe81f commit 7320b31
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AppSyncRealTimeClient.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'AppSyncRealTimeClient'
s.version = '1.3.0'
s.version = '1.4.0'
s.summary = 'Amazon Web Services AppSync RealTime Client for iOS.'

s.description = 'AppSync RealTime Client provides subscription connections to AppSync websocket endpoints'
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AppSync RealTime Client for iOS

## Unreleased
## 1.4.0

### Bug fixes

Expand Down
108 changes: 108 additions & 0 deletions build-support/setup_private_specs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash

# This script generates a private spec repo in your $HOME/.aws-amplify
# directory, to enable `pod lib lint`. It also makes it easier to do
# development against unreleased versions of Amplify, at least until we start
# releasing nightly builds.

set -e

declare -r LOCAL_SPEC_GIT_ROOT="$HOME/.aws-amplify/aws-appsync-realtime-client-ios/aws-appsync-realtime-client-ios-podspecs.git"
declare -r LOCAL_SPEC_REPO_NAME="aws-appsync-realtime-client-ios-local-specs"
declare -r COCOAPODS_REPO_DIR="${HOME}/.cocoapods/repos/${LOCAL_SPEC_REPO_NAME}"

function init_spec_git_root {
# If directory exists, assume it's correctly set up; don't attempt any
# repairs or validation
if [[ -d "${LOCAL_SPEC_GIT_ROOT}" ]] ; then
return 0
fi

mkdir -p "${LOCAL_SPEC_GIT_ROOT}"
old_pwd="${PWD}"
cd "${LOCAL_SPEC_GIT_ROOT}"
git init --bare
cd "${old_pwd}"
}

function init_spec_repo {
# If repo exists, assume it's correctly set up; don't attempt any
# repairs or validation
if [[ -n "$(pod repo list | grep ${LOCAL_SPEC_REPO_NAME})" ]] ; then
return 0
fi

init_spec_git_root

pod repo add --silent "${LOCAL_SPEC_REPO_NAME}" "${LOCAL_SPEC_GIT_ROOT}"

old_pwd="${PWD}"
cd "${COCOAPODS_REPO_DIR}"
git commit --allow-empty -m "Empty commit"
git push
cd "${old_pwd}"

if [[ -z "$(pod repo list | grep ${LOCAL_SPEC_REPO_NAME})" ]] ; then
pod repo add --silent "${LOCAL_SPEC_REPO_NAME}" "${LOCAL_SPEC_GIT_ROOT}"
else
pod repo update --silent "${LOCAL_SPEC_REPO_NAME}"
fi
}

function update_spec_repo {
old_pwd="${PWD}"
cd "${COCOAPODS_REPO_DIR}"

git add .
git commit --allow-empty -m "Update specs"
git push

cd "${old_pwd}"
}

function write_munged_podspec {
declare -r src_file=$1
declare -r dst_file=$2
ruby -e "puts ARGF.read.gsub('$old_version', '$new_version').gsub!(/s.source *=.*?\}/m,'s.source = { :git => \'file://${src_dir}\' }')" "${src_file}" \
> "${dst_file}"
}

declare -r old_version="$1"
if [[ -z $old_version ]] ; then
echo "Must specify old_version" >&2
exit 1
fi

declare -r new_version="$2"
if [[ -z $new_version ]] ; then
echo "Must specify new_version" >&2
exit 1
fi

init_spec_repo

declare -r src_dir="$PWD"

podspec_file_names=()

while read -r podspec_file ; do
podspec_file_name=$( basename "$podspec_file" )
podspec_file_names+=("$podspec_file_name")
pod_name=$( basename "$podspec_file_name" .podspec )

dst_dir="${COCOAPODS_REPO_DIR}/${pod_name}/${new_version}"
dst_file="${dst_dir}/${podspec_file_name}"

mkdir -p "${dst_dir}"

write_munged_podspec "$podspec_file" "$dst_file"
done < <( find "${src_dir}" -maxdepth 1 -mindepth 1 -name "*.podspec" | sort --ignore-case )

update_spec_repo

echo "Done. You may now validate podspec files by running:"
for podspec_file_name in "${podspec_file_names[@]}" ; do
echo
echo "pod lib lint --sources=${LOCAL_SPEC_REPO_NAME},trunk ${podspec_file_name}"
done

0 comments on commit 7320b31

Please sign in to comment.