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
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
about why you want to pull info from that file, what info you want
pull, maybe even some other solutions that you’ve tried but don’t think
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
Technically, it depends, but web apps have only a tiny amount of access
local machine – basically cookies and slightly more advanced cookies
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
on that file.
It also depends what kind of tools your OS has for notification, unless
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
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
set up permissions like that.
-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
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
That depends what your priorities are, and what your needs are. You
told us nearly enough, so I can’t possibly answer that, but here are
Do you control the client? That is, are you just trying to have
automatically happen on your own computer? Then yes, Ruby makes a fine
Are you hoping to make a simple installer that anyone can use? In that
Rawr looks promising, but if you need it running in the background all
time, you may end up having to look into some OS-specific installers –
those aren’t likely to be written in Ruby. You may still be able to
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
Is there an existing solution you could adapt? Rails is pretty easy to
– if you can find any sort of simple background service that polls a
transmits it via REST, that’d probably talk to Rails. In that case, it
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.