Oh, I forgot to mention that your extension must load before the file_system extension for this to work:

config.extensions = [:all, :file_system]

-- should do the trick in config/environment.rb.

Sean

Keith Bingman wrote:

On Aug 25, 2008, at 4:35 PM, Sean Cribbs wrote:


I think it would be quite straightforward to add the functionality in a similar fashion for 'text-assets' such as stylesheets and javascript files. If I understand Sean's design correctly, I think his intention was that extension authors could make their custom models play with the FileSystem extension by adding modules such as (using SnS as an example):

   /lib/file_system/model/stylesheet_extensions.rb
   /lib/file_system/model/javascript_extensions.rb

These modules would be added to the SnS extension itself, rather than in the FileSystem extension. If you had SnS installed without FileSystem extension these modules would do nothing, but if you had both extensions installed, then FS would pick up the extra functionality provided by those modules in the SnS extension. (It might be necessary to specify the load order of file_system extension before the others)

The only thing extra you would need to do is to test for the existence of the FileSystemExtension and then add your models to its list:

if defined?(FileSystemExtension)
FileSystem::MODELS << 'Stylesheet' << 'Javascript'
end


I just tried this out with my hacked version of SNS (with "name" instead of "filename") and for the most part it works. The only things is, while the names of the models get loaded in the constant list, the model extensions do not. If you manually add the Model names in the file_system extension, then they do load (and strangely, if you inspect the list, the added model names are there twice).

Again, odd, bu it is actually working and I can now export css and js files from the SNS extension. Once I get this oddities cleaned up I will try to fork it.

Keith Bingman

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to