Storing form data in xml file

Hi
I am writing an application where the form data needs to be stored as
xml file. I cannot use data base as I want to provide version
management for this data (currently planning on SVN). The form data is
a perl script file. Users write the perl script in the form and save
it to the server (which gets saved as .pl file). The web UI also
provides a way to execute that file by clicking the execute button. On
the server the file gets executed and output is stored into a log
file. I would like to manage these log files using the web UI

The UI wireframe looks some thing like this

Add New Script (button)

Show current Scripts

1.pl Edit Execute Manage-Versions Delete Rename Copy
2.pl Edit Execute Manage-Versions Delete Rename Copy
.
.
.

Please help me on how I can create a model for this. Model is not a
data base (I will eventually create a database to store the list of
scripts and their metadata, but the content of the scripts is going to
be in a file)

I need a config variable, that defines where the data can be stored on
the file system. Where can I put this config and how can I access it

DATA_STORAGE = /opt/perlscripts/

How can I use this model to write a CLI program, along with the webUI
(for CLI fans)

thanks a lot in advance

Kiran

How can I use this model to write a CLI program,

Well, you might offer random people $100 to see if you can get them to
read through all your specs. If that is successful, then you might try
offering them $5,000 to write the code for you.

I gave you the first part gratis. But it’ll cost you $5,000 if you want
me to write the code for you. If you want to write the code yourself,
then you need to read “Learning Perl (5th ed.)” and Sitepoint’s “jQuery:
Novice to Ninja” or pick a beginning javascript book. And you might
need to read a beginning ruby book, like “Beginning Ruby: From Novice to
Professional (2nd ed)”, and a beginning rails book like “Ruby on Rails 3
Tutorial”.

You also need to know basic html and css. Keep studying ruby, rails,
perl, and jQuery until one day it hits you that you know how to
accomplish all the things in your list of requirements.

Yeah, web programming ain’t easy.

gl

Thanks, that helped me a lot :slight_smile:

I don’t need the model or the code, all I want is the way to store the
data in a file in a directory. How do I keep track of the variables.
The reason why I explained in detail: I looked at other posts and got
suggestions saying why don’t you store the data in the database.
That’s not going to help me because of the reasons mentioned

On Sep 13, 2011, at 5:19 AM, maskiran wrote:

Thanks, that helped me a lot :slight_smile:

I don’t need the model or the code, all I want is the way to store the
data in a file in a directory. How do I keep track of the variables.
The reason why I explained in detail: I looked at other posts and got
suggestions saying why don’t you store the data in the database.
That’s not going to help me because of the reasons mentioned

render to string, then File.new(‘path/to/file’, ‘w’).print your_string

That’s assuming you will only ever do this once per file, and wipe out
the file if you need to do it again. Look at the File class for the
relevant flags to #open – there are some that will let you append
lines or rewrite an existing file (create it if it’s not there) etc.

Walter

On Tue, Sep 13, 2011 at 1:53 AM, maskiran [email protected] wrote:

On form submit, save the script to a temp file or an IO object, and use
it
as a
paperclip attachment to a script model.

As for the output logging, you can create another model that has the log
files as
attachments, and is connected to the script model in a one-to-many
relationship.

.

“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.