-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse for minor release number #36
base: develop
Are you sure you want to change the base?
Changes from 5 commits
ee5e69a
6527d0f
12289cf
92450cf
14c6565
9e113d7
ebbbcd4
2261408
aa375ac
44f10ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,15 @@ download() { | |
fi | ||
} | ||
|
||
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then | ||
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then | ||
WP_TESTS_TAG="branches/$WP_VERSION" | ||
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
WP_TESTS_TAG="tags/$WP_VERSION" | ||
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then | ||
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x | ||
WP_TESTS_TAG="branches/${WP_VERSION%??}" | ||
else | ||
WP_TESTS_TAG="tags/$WP_VERSION" | ||
fi | ||
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then | ||
WP_TESTS_TAG="trunk" | ||
else | ||
|
@@ -59,6 +64,22 @@ install_wp() { | |
else | ||
if [ $WP_VERSION == 'latest' ]; then | ||
local ARCHIVE_NAME='latest' | ||
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then | ||
# https serves multiple offers, whereas http serves single. | ||
download https://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix indentation here. |
||
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then | ||
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x | ||
WP_VERSION=${WP_VERSION%??} | ||
else | ||
# otherwise, scan the releases and get the most up to date minor version of the major release | ||
local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` | ||
LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' /tmp/wp-latest.json | sed 's/"version":"//' | head -1) | ||
fi | ||
if [[ -z "$LATEST_VERSION" ]]; then | ||
local ARCHIVE_NAME="wordpress-$WP_VERSION" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation. |
||
else | ||
ARCHIVE_NAME="wordpress-$LATEST_VERSION" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation. |
||
fi | ||
else | ||
local ARCHIVE_NAME="wordpress-$WP_VERSION" | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code is duplicated below in
install_wp()
. it looks like all this section should be doing is deciding whether theWP_TESTS_TAG
should usebranches/
ortags/
.I would change this code section to the following and put it right at the top. it'll eliminate the need to over-complicate the rest of the logic in the other two functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the
WP_TESTS_TAG
variable is only used in theinstall_test_suite()
function, you could also move this section into there, as opposed to leaving it in the main body.