Git Product home page Git Product logo

Comments (6)

dvershinin avatar dvershinin commented on May 12, 2024 2

@virgilwashere you might just do this with the new version:

wget $(lastversion --pre --assets mautic/mautic)

Then it downloads both :)

file *.zip
2.15.2-beta-update.zip: Zip archive data, at least v2.0 to extract
2.15.2-beta.zip:        Zip archive data, at least v2.0 to extract

I see it somewhat useful now, for repos which for instance having md5 checksums in separate files.

from lastversion.

dvershinin avatar dvershinin commented on May 12, 2024

Good suggestions. I will implement them (some with lower priority though, because at least for me the main target is getting the last stable version and only that).

The default behavior is to just fetch HTML of releases page and parse that. Only if nothing is found there, the API call is attempted. The --nosniff option will directly use only in the GitHub API being used (no parsing), so it's more like a showcase how default GitHub API isn't working as expected.

from lastversion.

virgilwashere avatar virgilwashere commented on May 12, 2024

Thank you!

In combination with these shell functions, lastversion will simplify updating prerequisites for deployments!!

version_lte() { printf '%s\n%s' "${1}" "${2}" | $( command -v sort) -C -V; }
version_lt() { ! version_lte "${2}" "${1}"; }

Virgil

from lastversion.

virgilwashere avatar virgilwashere commented on May 12, 2024

--self would still be nice to have.

--self        	show the latest version of 'lastversion'

Or maybe --verbose --version actually checks github releases for dvershinin/lastversion ???

Thanks for 0.1.0 release!

from lastversion.

dvershinin avatar dvershinin commented on May 12, 2024

@virgilwashere I didn't (at least yet) add the --self because it makes parsing options code complex (for me : ) .

I'm using similar bash function in my scripts:

function version_gt() {
  test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
}

It occurred to me now that it might be useful to integrate version comparison into lastversion itself. As in maybe like this:

CURRENTLY_BUILT_VER=1.2.3 # stored somewhere, e.g. spec file in my case
LASTVER=$(lastversion repo/owner --newer-than $CURRENTLY_BUILT_VER)
if [ $? -eq 0 ]; then
  # LASTVER is newer, update and trigger build
  ....

With exit status 1 for version lookup failure and 2 for comparison failure if required to distinguish them.

from lastversion.

dvershinin avatar dvershinin commented on May 12, 2024

Got the self working as special value of repository argument, so it's not flag, e.g.

lastversion self

Another addition is being able to lookup by a single word (search API does not allow for good caching at all, so careful with rate limits), but it's quite fun seeing this work:

lastversion linux # > 5.2
lastversion linux --pre # > 5.3rc2
lastversion ngx_pagespeed # > 1.13.35.2 works even though argument does not match repo name, which is incubator-pagespeed-ngx

Or this, to check if you use latest Linux kernel:

NEWER_KERNEL=$(lastversion linux -gt $(uname -r | cut -d '-' -f 1))
if [ $? -eq 0 ]; then
  echo "I better update my kernel now, because ${KERNEL} is there"
else 
  echo "My kernel is latest and greatest."
fi

from lastversion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.