RCB asked:

Is there a standard nitro extension framework (like rail's plugins) ?

Tags: 0.30

Is there a standard way to distribute plugins for nitro? I know of Rail's plugins, and I am wondering if Nitro has something similar?

(1 attempts)

james answered:

I believe that is what 'parts' are for. For example, you create a subdirectory part/, off the app root. In run.rb you call Part.require( 'name-of-part-dir') where name-of-art-dir is the name of a subdirectory off part/ that holds the parts code.

Imagine you want to create a Selenium plugin. You'll have part/selenium/, a directory that holds an actual (though possibly minimal) Nitro app focused on handling certain page requests (perhaps 'selenium/teardown' and 'selenium/setup' so that your Selenium code can interact with your Nitro backend).

That means that the top-level run.rb has Part.require( 'selenium'), which instructs Nitro to go load part/selenium/run.rb and mix it into the current application.

Mind you, I'm sketchy on this, but so far this seems to have worked for me. Georgr wrote a parts tutorial (don't have link handy) and the source for the Part class explains some things.

(BTW, if my description is actually correct, then it seems like extra work to have to explicitly call Part.require when Nitro could simply look to see if there is a part/ dir, and if there is then just go load the files. Adding plugins should be transparent.)

Rating: 4