website icon indicating copy to clipboard operation
website copied to clipboard

Request adding a static "lastest" version single file download link

Open samej71 opened this issue 6 years ago • 6 comments

Right now it is possible to download the current (3.1.1.) version of the single-file ack using the following URL: https://beyondgrep.com/ack-v3.1.1 and in a similar fashion, older versions can be downloaded, too, such as: https://beyondgrep.com/ack-v3.1.0

Please consider adding a static URL such as https://beyondgrep.com/ack-latest that always points to the latest version, no matter what version that might be, so it can be coded into an install script knowing it will grab the latest version. So today, that URL would server up the 3.1.1 version, but when the next version is released, it will then point to whatever that newer version is.

Thank you for ack and for considering adding this feature to the website.

samej71 avatar Sep 23 '19 14:09 samej71

Would ack-latest download it directly, or would it redirect to ack-v3.whatever?

petdance avatar Sep 23 '19 14:09 petdance

It would cause less complications for users of the link if it directly served the file vs. a redirect.

For example, curl needs the -L parameter to follow the redirect and would require it to be added to your example install line: curl -L https://beyondgrep.com/ack-latest > ~/bin/ack && chmod 0755 ~/bin/ack

Overall, though, I think you can choose what works best for you as far as automating your deployments.

samej71 avatar Sep 23 '19 14:09 samej71

coded into an install script knowing it will grab the latest version.

Tell me more about this install script you're thinking of. When does it get used?

petdance avatar Sep 23 '19 14:09 petdance

For me, my installer is in my dotfiles repository setup. Any time I spin up a new linux VM, I clone the git project and execute my setup script, which sets up my bash environment and installs git submodules and installs other external tools (like ack) to my liking so I have a single environment with all my preferences everywhere I go with only a git clone <mydotfilereposurl> followed by a ./dotfiles/setup.

samej71 avatar Sep 23 '19 15:09 samej71

Hi,

Hoping someone may find this useful; I parse the changelog to figure out the latest version.

LOCALVERSION=$(/opt/foo/bin/ack --version | head -1 | awk '{ print $2 }')
REMOTEVERSION=$(curl https://beyondgrep.com/changes.txt | grep -E '^v.* (CDT|CST) ' | head -1 | awk '{ print $1 }')

if [[ $LOCALVERSION != $REMOTEVERSION ]]; then
	curl -L https://beyondgrep.com/ack-${REMOTEVERSION} -o /opt/foo/bin/ack
	chmod 755 /opt/foo/bin/ack
fi

unclefreddie70 avatar Feb 17 '20 16:02 unclefreddie70

Just FYI, an easier way to do

grep -E '^v.* (CDT|CST) ' | head -1 | awk '{ print $1 }'

with ack would be

ack '^(v\S+).+ C[DS]T' -1 --output='$1'

I know, you're trying to install ack and so don't have ack handy. I just wanted to point out some handy ack features.

petdance avatar Feb 17 '20 16:02 petdance