# Running a script on a users PC

**URL:** <https://www.ruby-forum.com/t/running-a-script-on-a-users-pc/165227>\
**Category:** Rails\
**Created:** [April 10, 2009, 12:53pm UTC](https://www.ruby-forum.com/t/running-a-script-on-a-users-pc/165227 "2009-04-10T12:53:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@jmac](https://www.ruby-forum.com/u/jmac)\
**Post date:** [April 10, 2009, 12:53pm UTC](https://www.ruby-forum.com/t/running-a-script-on-a-users-pc/165227/1 "2009-04-10T12:53:59Z")

</div>

I am researching a new rails app that would like to create. One  
feature of the app will allow users to select a ruby script and run it  
on their local machine. However I’m not sure how to implement this.

There are a few points that I’m not sure how to approach:

1. How to store the script to be executed on the users PC. As text in  
the DB or as a file in the DB (Can a file be stored in a DB) Or as a  
file in the apps file structure.
2. How to get the script to the users PC and start it running. (The  
users PC will have Ruby installed).
3. How to report back the result of running the script.

---

<div class="post-metadata">

**Author:** ![jmac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@jmac](https://www.ruby-forum.com/u/jmac)\
**Post date:** [April 10, 2009, 12:59pm UTC](https://www.ruby-forum.com/t/running-a-script-on-a-users-pc/165227/2 "2009-04-10T12:59:15Z")

</div>

On Apr 10, 11:41 am, jmac [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am researching a new rails app that would like to create. One  
> feature of the app will allow users to select a ruby script and run it  
> on their local machine. However I’m not sure how to implement this.
> 
> There are a few points that I’m not sure how to approach:
> 
> 1. How to store the script to be executed on the users PC. As text in  
> the DB or as a file in the DB (Can a file be stored in a DB) Or as a  
> file in the apps file structure.

You could either store the contents of the file in the database or  
store the file somewhere and keep the path to that file in the  
database.

> 1. How to get the script to the users PC and start it running. (The  
> users PC will have Ruby installed).

This is likely to be tricky - It would obviously be a major security  
flaw if random websites could run arbitrary ruby scripts on your  
computer.  
If you just want people to play around with ruby rather than have  
access to any local resources (file system, network etc…) you might  
be interested in the jruby applet.

Fred
