Open pereorga opened 1 year ago
FWIW, this is what I'm doing in bash (GNU/BSD sed/grep):
##############################################################################
# Updates phive, installs newest versions of PHIVE packages, and bumps versions.
# Arguments:
# None
##############################################################################
update_phive() {
yes | php -d memory_limit=256M tools/phive selfupdate
yes | php -d memory_limit=256M tools/phive update --force-accept-unsigned
# Bump versions
local -r xml_file=".phive/phars.xml"
while read -r line; do
if [[ "${line}" =~ ^[[:space:]]*\<phar ]]; then
local name version installed updated_line
name=$(echo "${line}" | sed -E 's/.*name="([^"]+)".*/\1/')
version=$(echo "${line}" | sed -E 's/.*version="([^"]+)".*/\1/')
installed=$(echo "${line}" | sed -E 's/.*installed="([^"]+)".*/\1/')
updated_line=$(echo "${line}" | sed "s/version=\"${version}\"/version=\"^${installed}\"/")
if [[ "${line}" != "${updated_line}" ]]; then
sed -i'.original' -e "s|${line}|${updated_line}|" "${xml_file}"
rm "${xml_file}.original"
echo "Updated ${name}: ${version} -> ${installed}"
fi
fi
done < "${xml_file}"
}
It is not exactly the same as the composer bump
command, this just copies the installed version to the required version.
The
bump
command would increase the lower limit of the phar tools to the currently installed versions.For example, see
composer bump
command: https://getcomposer.org/doc/03-cli.md#bump