Closed ElliotFriend closed 10 years ago
Most definitely! That's a feature I wanted to add from the start. I asked the YNAB guys if it would be OK and didn't hear a response, so I'll take that as a tacit "sure thing". Go right ahead and add it :)
Nothing better than a silent head nod haha
My first effort was to fetch the download page and search through it using a regex for the version number, and download link. Most definitely not a sustainable way to do that. I thought to myself, if YNAB automatically checks for the most recent version, they must have implemented some kind of page that YNAB gets to check the date.
I finally found this JSON page, which should be much easier and less error-prone: http://www.youneedabudget.com/dev/ynab4/liveCaptive/Win/releaseNotesData.js
I reached out to the YNAB peeps, too, concerning this. Haven't heard back from them, either lol
That link sure makes this easier! The one thing I want to avoid is using non-standard Perl modules. Anything bundled with 5.10+ if fair game though. Alternatively you could check to see if they have the command-line tools "curl" or "wget" installed and use which ever they have. I suppose to be complete you could check to see if they have LWP installed (if it's not bundled yet, I haven't checked) and then fall back to command-line.
Let me know if you get stuck. I'd be happy to take a look.
Jeremy
Thanks, Jeremy!
At first, I was playing with LWP (which was available on my distro, but I'll check what's bundled with 5.10. I'm a perl novice, so I definitely appreciate the pointers.
It's relatively easy to check to see if a module exists (if you haven't figured this out already): eval("use LWP"); if ($@) {
} else {
}
That might just be the easiest way to go actually.
Seems good to me. In fact, aside from a couple Arch and one LFS install, I've never come across a distro that doesn't ship with both wget and curl.
Thanks!
Evidently, I spoke too soon. My freshly installed Mint 16 has wget, but not curl... weird. I'll probably check for wget first, and then fall back to curl if wget is not available. Does that sound good? Should I swap those around?
I heard back from Ian, and I got an implied "go ahead." He also pointed me to a more to-the-point page to request current version from: http://www.youneedabudget.com/dev/ynab4/liveCaptive/Win/update.xml
Here's the support case, if anyone's interested: https://ynab.fogbugz.com/default.asp?94401_ka45pfmc4usb5dmn
Nice work! And a handy MD5 to boot :)
I don't think the order you check for wget/curl matters so long as you check for both. If they don't have LWP/wget/curl there's not much we can do for them :)
Everything looks like it's working (at least for me haha): e74cf924f4b3ffcbf201cb75d00ca940b086fae7
Would you mind taking a look? Let me know your thoughts, and you might just have yourself a pull request :-D
I was having trouble using the Digest::MD5 module, which is bundled with 5.10+. For now, I've just made a system call to md5sum, but is that always available?
Thanks!
Here's a link to the whole file from that commit: https://github.com/ElliotFriend/YNABLinuxInstall/blob/e74cf924f4b3ffcbf201cb75d00ca940b086fae7/YNAB4_LinuxInstall.pl
I spoke too soon about Digest::MD5: 4c39193e2471cbd6a23e400e0d45fe5f604e0d3f
That's one less thing I'm worried about :)
Hey, WolverineFan!
First, I love your script! Second, I had a thought the other day about a cool feature I'd like to see in it, where the script can download the most up-to-date YNAB4 installer automatically.
I started coding on a branch, and I'm pretty confident I can make that happen on my own. Before I get too far down the rabbit hole, though, I wanted to check with you to see if you'd even be interested in a feature like that.
Thanks! ElliotFriend