Skip to content
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

Add bump command #412

Open
pereorga opened this issue Jul 23, 2023 · 1 comment
Open

Add bump command #412

pereorga opened this issue Jul 23, 2023 · 1 comment
Assignees

Comments

@pereorga
Copy link

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

@theseer theseer self-assigned this Jul 24, 2023
@pereorga
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants