Skip to content

Add check-update to wp cli to check for latest version II.#1386

Merged
danielbachhuber merged 5 commits intowp-cli:masterfrom
szepeviktor:cli-version
Sep 10, 2014
Merged

Add check-update to wp cli to check for latest version II.#1386
danielbachhuber merged 5 commits intowp-cli:masterfrom
szepeviktor:cli-version

Conversation

@szepeviktor
Copy link
Contributor

No description provided.

@szepeviktor
Copy link
Contributor Author

How to test it??

I'm not sure we can without some hacking. I'll give it some thought.

<?php
header( 'Content-Type: application/json; charset=utf-8' );
echo '[
  {
    "tag_name": "v<VERSION_TO_TEST>"
  }
]';
// or include('some-file.txt');

And start the PHP built-in webserver

echo '127.0.0.1 api.github.com' >> /etc/hosts
apt-get -y install stunnel4
make-ssl-cert generate-default-snakeoil --force-overwrite
cat /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/certs/ssl-cert-snakeoil.pem > /etc/stunnel/stunnel.pem

php -S 127.0.0.1:8443 script.php &
SERVER_PID=$!
# php has no SSL
stunnel3 -d 127.0.0.1:443 -r 8443 -p /etc/stunnel/stunnel.pem
wp cli check-update --major
# maybe kill -9 $SERVER_PID; killall -9 stunnel4 ## not stunnel3 !

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call this update_type to be specific.

@danielbachhuber
Copy link
Member

How to test it??

I'd say skip CI testing right now. From my manual testing:

salty-wordpress ➜  .wp-cli  wp cli version
WP-CLI 0.13.0
salty-wordpress ➜  .wp-cli  wp cli check-update
+---------+-------+-------------------------------------------------------------------------------+
| version | type  | package_url                                                                   |
+---------+-------+-------------------------------------------------------------------------------+
| 0.16.0  | major | https://github.com/wp-cli/wp-cli/releases/download/v0.16.0/wp-cli.phar        |
| 0.15.1  | major | https://github.com/wp-cli/wp-cli/releases/download/v0.15.1/wp-cli-0.15.1.phar |
| 0.15.0  | major | https://github.com/wp-cli/wp-cli/releases/download/v0.15.0/wp-cli-0.15.0.phar |
| 0.14.1  | major | https://github.com/wp-cli/wp-cli/releases/download/v0.14.1/wp-cli-0.14.1.phar |
| 0.14.0  | major | https://github.com/wp-cli/wp-cli/releases/download/v0.14.0/wp-cli-0.14.0.phar |
+---------+-------+-------------------------------------------------------------------------------+

Can we only show the latest version for each "major" version? e.g. drop 0.14.0 and 0.15.0 because 0.14.1 and 0.15.1 are already available.

Lastly, the semantics of semver are MAJOR.MINOR.PATCH. Our "major" needs to be "minor", and "minor" needs to be "patch"

@szepeviktor
Copy link
Contributor Author

Ready. Added another function to skip earlier minors.

@danielbachhuber danielbachhuber added this to the next milestone Sep 10, 2014
@danielbachhuber
Copy link
Member

👍

danielbachhuber added a commit that referenced this pull request Sep 10, 2014
Add `check-update` to `wp cli` to check for latest version II.
@danielbachhuber danielbachhuber merged commit ff7fa44 into wp-cli:master Sep 10, 2014
@danielbachhuber
Copy link
Member

One last Q: If WP-CLI is up to date and --format=table, should we include "Success: WP-CLI is at the latest version" ?

@szepeviktor
Copy link
Contributor Author

Yes. Please do that yourself! I am doing core check-update
And I don't know how to determine --format's value.

@danielbachhuber
Copy link
Member

And I don't know how to determine --format's value.

40b233b

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants