/admin/export

Hi all,

I’m rather new to radiant and I’m using it to set up a small-scale
intranet
site. I wanted to do an /admin/export to create a template that could be
used for the setup_database script, but I’m running into difficulties.
The
YAML file I get from the export seems to be in a different format than
setup_database is expecting.

I’m not very familiar with YAML or how it is generated and parsed in
Ruby,
so I’m a bit lost. I was initially running Radiant from a RubyGem, but
I’ve
since switched to the subversion trunk in the hopes that this issue
would be
resolved (perhaps by the fact that it’s got its own Rails in
/vendor/…I
thought maybe this was an issue with my version of Rails and how it
handles
YAML conversions).

So I’ve got Radiant rev. 85 running on Rails 1.1.2 (or whichever version
is
in /vendor/), served via LightTPD.

Any help would be greatly appreciated.

-James MacAulay
Ottawa, Canada

The export files I get look like this:


Snippets:
5:
name: firefox-reminder
updated_at: 2006-07-13 19:43:46 Z
filter_id: “”
created_by: 1
updated_by:
id: 5
content:
created_at: 2006-07-13 19:43:46 Z
1:
name: header
updated_at: 2006-07-13 15:58:42 Z
filter_id: Textile
created_by: 1
updated_by: 1
id: 1

…etc.

The templates in /db/templates, on the other hand, look like this:

name: Simple Blog
description: Setup Radiant as a simple weblog.
records:
Layouts:
main:
id: 1
name: Normal
content: |

…etc.

I put a small primer up here http://www.ruby-forum.com/topic/68883 so
you don’t have to reinvent the wheel. From my experience, I actually
found it much faster and cleaner to write it out by hand, instead of
taking the dump from /admin/export, though your experience might be
different. (Maybe we should make a more in depth explaination on making
templates in the docs? I’ll start writing one up this weekend.)

Bernard Yu wrote:

I put a small primer up here http://www.ruby-forum.com/topic/68883 so
you don’t have to reinvent the wheel. From my experience, I actually
found it much faster and cleaner to write it out by hand, instead of
taking the dump from /admin/export, though your experience might be
different.

Yeah YAML can be a bit difficult to format at times. It’s best to set
your editor to use spaces (two per indent). I’d like to work on the
export feature a little, though. It’s tripped more than a couple of
people up.

(Maybe we should make a more in depth explaination on making
templates in the docs? I’ll start writing one up this weekend.)

That would be good. Add it to the Radiant Handbook on the dev wiki.


John L.
http://wiseheartdesign.com

James MacAulay wrote:

Thanks for the clarification. I see now that there was previous
discussion about this not too long ago (in the “Informal Competition”
thread), so my apologies for that bit of redundancy.

It looks like it would be pretty straightforward to write an export
script which makes setup_database-friendly templates. I’d be
interested in tackling this myself, if other people think this would
be a good thing to do. Are there any major stumbling blocks I should
be aware of?

It should be fairly trival to update Radiant::Exporter to handle this:

http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/radiant/exporter.rb

Please consider creating a patch.


John L.
http://wiseheartdesign.com

Thanks for the clarification. I see now that there was previous
discussion about this not too long ago (in the “Informal Competition”
thread), so my apologies for that bit of redundancy.

It looks like it would be pretty straightforward to write an export
script which makes setup_database-friendly templates. I’d be
interested in tackling this myself, if other people think this would
be a good thing to do. Are there any major stumbling blocks I should
be aware of?

James

Right. Will do.

James

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs