[Plugin] Autoloader
-
This is mainly useful for when writing plugins. After making a change to a plugin, just click the update scripts button and it will automatically reload any scripts which have been modified since they were last reloaded. It should handle .rb and .rbs files, and will look for scripts in all the paths in the $: global variable.
The plugin will list the files which have been reloaded and the files for which reloading failed in the status bar.
Extract the attached file to your plugins folder to try it out.
-
Cool! This is very handy when updating scripts and want to use the new version without restarting SketchUP!
-
If I have SU open and add a new plugin, will this tool now "see" the new plugin without re-starting SU?
I'm talking new plugin, not revising script on an already loaded plugin. -
Yes it will see new files as well as existing modified ones;)
-
works like a dream.
Thank you -
-
Hi,
@unknownuser said:
works like a dream
@AndriyG81: does it reload modified files that are in sub-folders of the Plugins folder ? It doesn't do that for me...
-
Currently it only reloads files in the plugins folder.
-
@diggsey said:
Currently it only reloads files in the plugins folder.
But does it "see" newsub-folders?
More precisely, if I've put a new plugin into the plugins folder while SU is open and that new plugin contains a folder, will Autoloader "see" the new sub-folder and allow the new plugin to work?
-
When you get a list of entries in a Directory it will include files and folders.
It loads scripts it finds by files by their extname [.rb etc], but you can also find directories by their filetype.
So it's also possible to get a list of any subfolders and then reiterate through those to get their .rb files etc etc... -
Yes, of course. It doesn't affect the way the plugin is loaded, it just loads it.
-
Hi Diggsey,
Nice idea, thank you. However...
Sketchup::load (if I remember) is an alias for Sketchup::require, and doesn't reload scripts that are already listed in the $LOADED_FEATURES array. In short, I don't think anything is actually getting reloaded.
Also, it would be helpful to wrap the load in begin..rescue..end to catch LoadError's and SyntaxErrors and report them as coming from the file being loaded instead of from autoloader.
-
cool...i tried it thanks a lot..!!!
Advertisement