GM Script Update Control

By Sylvain Comte Last update May 28, 2009 — Installed 1,827 times.

Instead of Copy'n'paste...

in
Subscribe to Instead of Copy'n'paste... 9 posts, 2 voices



IzzySoft Scriptwright

...you can just include it with the Metadata using @require - I just tested, and it works. But for this there are some little changes to the script required:

  • the function must not be called automatically from inside your script - but rather from the script @requiring it ("parent script")
  • the "parent script" needs to define the "script values", so your script should just hold the "fallback defaults" - which excludes script ID, version, and release date
  • it should be up to the "parent script" whether and when to call the update check. I always have some tabs open doing auto-refresh (e.g. mail check), causing a bunch of popups on a new version. Letting the script decide, one could even put it to "manual check" via GM menu. You could provide a function "GSMUCautoCheck()" to do the automated check, if the author of the "parent script" decides to call it.

Thanx so far - and I hope you find this input useful. There are some clear advantages for the @require method:

  • the "parent script" code stays more clear
  • one does not need multiple copies of your code
  • if your script gets updated, the "parent script" would automatically include the latest code

All the best,
Izzy.

 
Sylvain Comte Script's Author

Well, thanks for your post. In fact, I initially wanted to do so, but the @require meta has some limitation which is making this idea not so efficient.
As said on Greasespot wiki the @required script is installed once only at first parent install : updating the parent script will not cause the @required script to be refreshed. So users will have to uninstall and reinstall parent in order to have the whole up-to-date.
However, when I have a second for it, i'll try to enable a version that could be easier to @require...

cheers,

Sylvain
 
IzzySoft Scriptwright

Thank you for your answer - that in fact explains something (in a different issue as well, which I had with another script). I wish you good luck meanwhile, and look forward to your success (I monitor this thread, so if you update it here I will see).

All the best,
Izzy.

 
Sylvain Comte Script's Author

Hi Izzy, at the end, I managed to find a way to make the @require method work without killing the

copy-paste method. Still a bit experimental, but I made it work on this testing script.
I released some explanation, using tips and warnings on the new homepage of the script (very much easy for me to manage there)...

best regards,

Sylvain

 
IzzySoft Scriptwright

Comes the question: Is there a way to handle the @require script update? I mean, if there's a new version of that script, to grab it and replace it into the main scripts folder - together with or even independent from the main script?

 
Sylvain Comte Script's Author

I thinks it's a bit tricky for me and I didn't want to explore Greasemonkey guts too far.
I have been thinking about it before updating and may have a softer solution (I'm not a hard coder, I code for fun). But as I prefer to conform to the release early, release often moto, I didn't implement it yet.
The idea would be to increment a verification for the @required script during the main script verification and display an additional message to the user suggesting him to uninstall and reinstall his script like "additionaly, the update control script used by this one was also updated, you should uninstall completely your script and reinstall it to take full advantage of this upgrade".
 
IzzySoft Scriptwright

Hi Sylvain,

Sylvain Comte wrote:
I thinks it's a bit tricky for me and I didn't want to explore Greasemonkey guts too far.
I have been thinking about it before updating and may have a softer solution (I'm not a hard coder, I code for fun). But as I prefer to conform to the release early, release often moto, I didn't implement it yet.

These are all facts I understand very well - since they apply to me, too Tongue
The idea would be to increment a verification for the @required script during the main script verification and display an additional message to the user suggesting him to uninstall and reinstall his script like "additionaly, the update control script used by this one was also updated, you should uninstall completely your script and reinstall it to take full advantage of this upgrade".

That would be a beginning. But if it's possible to automate this (i.e. download the control script, or any other updated @required script along plus store it/them in the main scripts directory), that would be the final solution. Not sure if it's possible, but maybe you can add it to the wish list?

Au revoir,
Izzy.

 
IzzySoft Scriptwright

Just a thought - not sure if that's possible: GM itself must have a function to remove a script (which is used in the manager). Maybe this function could be utilized in case a dependency needs to be updated - so asking the user to confirm the scripts removal (of course without removing any stored preferences of that script), remove it (if approved), and then trigger the install?

 
IzzySoft Scriptwright

Sylvain,

just to let you know: I meanwhile created my own updater script, which also takes care for the dependencies announced by @require. I did not (yet?) find a way to handle "complete updates", though - but at least this way the user gets informed a simple update may not suffice, in case dependencies have been updated. If you are interested to have a look at the code, you find it here.