[Plugin] Autoloader

[Plugin] Autoloader

Postby Diggsey » Sun Apr 24, 2011 4:31 pm

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.
0

Diggsey 
 

Re: [Plugin] Autoloader

Postby dedmin » Sun Apr 24, 2011 4:50 pm

Cool! This is very handy when updating scripts and want to use the new version without restarting SketchUP!
0

dedmin 
 

Re: [Plugin] Autoloader

Postby Bob James » Sun Apr 24, 2011 5:06 pm

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.
0
i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60
User avatar
Bob James 
Premium Member
Premium Member
 

Re: [Plugin] Autoloader

Postby Diggsey » Sun Apr 24, 2011 5:07 pm

Yes it will see new files as well as existing modified ones;)
0

Diggsey 
 

Re: [Plugin] Autoloader

Postby AndriyG81 » Sun Apr 24, 2011 6:17 pm

works like a dream.
:P
Thank you
0

AndriyG81 
 

Re: [Plugin] Autoloader

Postby Bob James » Mon Apr 25, 2011 1:24 am

Diggsey wrote:Yes it will see new files as well as existing modified ones;)

Now this is a timesaver :thumb:
0
i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60
User avatar
Bob James 
Premium Member
Premium Member
 

Re: [Plugin] Autoloader

Postby Didier Bur » Thu Apr 28, 2011 9:51 am

Hi,

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... :cry:
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] Autoloader

Postby Diggsey » Thu Apr 28, 2011 5:01 pm

Currently it only reloads files in the plugins folder.
0

Diggsey 
 

Re: [Plugin] Autoloader

Postby Bob James » Sat Apr 30, 2011 7:27 pm

Diggsey wrote:Currently it only reloads files in the plugins folder.

But does it "see" new sub-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?
0
i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60
User avatar
Bob James 
Premium Member
Premium Member
 

Re: [Plugin] Autoloader

Postby TIG » Sat Apr 30, 2011 7:40 pm

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...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Autoloader

Postby Diggsey » Sat Apr 30, 2011 7:41 pm

Yes, of course. It doesn't affect the way the plugin is loaded, it just loads it.
0

Diggsey 
 

Re: [Plugin] Autoloader

Postby Jim » Sun May 01, 2011 2:23 am

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.

Related Topic
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Autoloader

Postby archipod88 » Tue May 17, 2011 8:20 pm

cool...i tried it thanks a lot..!!! :thumb:
0

archipod88 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 8 guests

Visit our sponsors: