How to proceed?

I am a fairly new member to RoR community and programming for that
matter. I want to create a Rails app that pulls info from a file on a
computer every time that file changes.
-So I’m thinking I need to have some code installed on the client
computer?
-the installed code would have to be at the admin level incase any
user causes the file to change?
-the installed code would then report back to a Rails application
after each change of the file
-the program would need to run in the background no matter who is
logged in.

Would a Ruby written program be the correct choice on the client
computer or should that part of the equation be written in something
else?
Anyone see in problems with trying to create this or can offer
suggestions where to start?

On Monday, July 26, 2010 08:50:09 pm [email protected] wrote:

I am a fairly new member to RoR community and programming for that
matter. I want to create a Rails app that pulls info from a file on a
computer every time that file changes.

That sounds like a really fragile approach.

What are you actually trying to do?

Since you’ve admitted to being new to programming, the above question is
one
of the most important ones you should ask yourself when faced with any
problem. There is such a thing as too much context, but explaining
something
about why you want to pull info from that file, what info you want
to
pull, maybe even some other solutions that you’ve tried but don’t think
will
work, would be helpful.

But if you do want to do it this way:

-So I’m thinking I need to have some code installed on the client
computer?

Yes.

Technically, it depends, but web apps have only a tiny amount of access
to the
local machine – basically cookies and slightly more advanced cookies
(like
the local SQL storage in some newer browsers).

-the installed code would have to be at the admin level incase any
user causes the file to change?

That depends on your OS, but no, I don’t think so. It just needs read
rights
on that file.

It also depends what kind of tools your OS has for notification, unless
you
intend to just poll.

On Unix-like OSes, you should be able to run this code as a completely
deprivileged user, just one who has read access. On Linux, inotify and
dnotify
just need read access – or, technically, execute access on directories

unless I’m missing something.

However, depending on the file, you may need administrator access in
order to
set up permissions like that.

-the installed code would then report back to a Rails application
after each change of the file

Yes.

-the program would need to run in the background no matter who is
logged in.

That depends. Do you want it to report no matter who is logged in?

Would a Ruby written program be the correct choice on the client
computer or should that part of the equation be written in something
else?

That depends what your priorities are, and what your needs are. You
haven’t
told us nearly enough, so I can’t possibly answer that, but here are
some
guesses:

Do you control the client? That is, are you just trying to have
something
automatically happen on your own computer? Then yes, Ruby makes a fine
client-
side language.

Are you hoping to make a simple installer that anyone can use? In that
case,
Rawr looks promising, but if you need it running in the background all
the
time, you may end up having to look into some OS-specific installers –
and
those aren’t likely to be written in Ruby. You may still be able to
write some
Ruby code, but it may also not be worth the effort if the client side is
really, really, ridiculously simple. But if you’re having to do a lot of
parsing and interpreting (instead of just uploading the file), it may
yet be
worth it…

Is there an existing solution you could adapt? Rails is pretty easy to
talk to
– if you can find any sort of simple background service that polls a
file and
transmits it via REST, that’d probably talk to Rails. In that case, it
almost
doesn’t matter what the implementation language is.

Anyone see in problems with trying to create this or can offer
suggestions where to start?

Ask again, but with more details.