Re: [Radiant] Re: File-based Snippets/Layouts with Support for Radiant Tags?

2008-08-25 Thread Andrew Neil


On 25 Aug 2008, at 14:13, Arik Jones wrote:


Andrew Neil wrote:

The file_system extension exists for this purpose. Check it out:

http://github.com/nelstrom/radiant-file-system-extension/tree/master

I should warn you that it is still under development, so if you do  
use

it, take care! I would appreciate feedback on any problems you
encounter.

Drew


Does this jive with the Styles N' Scripts extension? If so, I think
you've solved a really large problem for me.


Not yet. That was the first question to be asked when I announced this  
extension:


http://www.ruby-forum.com/topic/152887#709163

so I can probably say it tops the list of desired features. Sean  
answered the Q in the same thread.


Sean designed the extension for the Redken site, which included a  
couple of additional models. I have basically taken Sean's extension  
and stripped out all of the Redken specific functionality. If you look  
at the extension as it was when I first checked it in to github:



http://github.com/nelstrom/radiant-file-system-extension/commit/cf20284c13f3a43d00408086e628c2c13337380c

you can get an idea for what Sean means when he says you can just  
create an appropriately named module. In particular, I draw your  
attention to the files:


/lib/file_system/model/part_type_extensions.rb
/lib/file_system/model/template_extensions.rb

These files describe the save and load functionality for PartType and  
Template models. I have discarded them, because the corresponding  
models were custom built for Redken. On the other hand, I have  
maintained the page_extensions.rb file, because the Page model is part  
of Radiant core.


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)


I'm offering these pointers to help anyone get started on this who  
wants it. I have my plate full just now (and a vacation as of next  
week) so I won't be able to have a go at this myself for at least a  
month.


Cheers,
Drew
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Re: File-based Snippets/Layouts with Support for Radiant Tags?

2008-08-25 Thread Sean Cribbs


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

Then the extension will pick up those models, add the basic 
functionality and attempt to add their specialized modules as well.


The extension is very helpful when you are working on a big site, or one 
that you want to manipulate significantly offline.  I'd call the support 
for Pages shaky at best, and I'd still recommend manipulating those in 
the regular interface.  However, the other models -- snippets, layouts 
-- are very simple and easy to manipulate in the filesystem.


Thanks, Drew, for offering to maintain this extension!

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


Re: [Radiant] Re: File-based Snippets/Layouts with Support for Radiant Tags?

2008-08-25 Thread Keith Bingman
It just so happens that I was playing around with getting the  
file_system extension to work with SNS when I came across a nasty  
conflict. It seems that SNS uses the attribute filename instead of  
name. Because the file_system extension uses this as well, it leads to  
all sorts of nasty issues.


If you change the attribute to 'name' (or anything else for that  
matter), then everything works nicely. But I can't figure out how to  
reset the filename attribute in the class extension and keep the whole  
thing working. Maybe Chris will be kind enough to change the filename  
attribute in sns or someone else has an idea. It would be great to get  
these two plugins working together!


Keith


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

Then the extension will pick up those models, add the basic  
functionality and attempt to add their specialized modules as well.


The extension is very helpful when you are working on a big site, or  
one that you want to manipulate significantly offline.  I'd call the  
support for Pages shaky at best, and I'd still recommend  
manipulating those in the regular interface.  However, the other  
models -- snippets, layouts -- are very simple and easy to  
manipulate in the filesystem.


Thanks, Drew, for offering to maintain this extension!



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


Re: [Radiant] Re: File-based Snippets/Layouts with Support for Radiant Tags?

2008-08-25 Thread Keith Bingman


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


Re: [Radiant] Re: File-based Snippets/Layouts with Support for Radiant Tags?

2008-08-25 Thread Sean Cribbs
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