# Method that runs an executable file

**URL:** <https://www.ruby-forum.com/t/method-that-runs-an-executable-file/173185>\
**Category:** Ruby\
**Created:** [August 4, 2009, 4:24pm UTC](https://www.ruby-forum.com/t/method-that-runs-an-executable-file/173185 "2009-08-04T16:24:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dezrtdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f4b2a3/32.png) [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Post date:** [August 4, 2009, 4:24pm UTC](https://www.ruby-forum.com/t/method-that-runs-an-executable-file/173185/1 "2009-08-04T16:24:52Z")

</div>

hello,

i am quite new to programming, only began in february this year and am  
doing a project for my uni course.

me and my group are using ruby on rails and were wondering if it is  
possible to create a method that when run, gets a rakefile to execute a  
database migrate?

would greatly appreciate any help here

---

<div class="post-metadata">

**Author:** ![dezrtdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f4b2a3/32.png) [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Post date:** [August 4, 2009, 5:07pm UTC](https://www.ruby-forum.com/t/method-that-runs-an-executable-file/173185/2 "2009-08-04T17:07:41Z")

</div>

On Tue, Aug 4, 2009 at 10:25 AM, Michael W.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> hello,
> 
> i am quite new to programming, only began in february this year and am  
> doing a project for my uni course.
> 
> me and my group are using ruby on rails and were wondering if it is  
> possible to create a method that when run, gets a rakefile to execute a  
> database migrate?
> 
> would greatly appreciate any help here

There are several general ways in Ruby to launch an external command:  
[http://pasadenarb.com/2007/03/ruby-shell-commands.html](http://pasadenarb.com/2007/03/ruby-shell-commands.html)

Though, be aware, particularly for web apps, of potential security  
issues that can be introduced:  
[Command Injection | OWASP Foundation](http://www.owasp.org/index.php/Command_Injection)  
[Code injection - Wikipedia](http://en.wikipedia.org/wiki/Code_injection#Shell_injection)

---

<div class="post-metadata">

**Author:** ![dezrtdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f4b2a3/32.png) [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Post date:** [August 4, 2009, 6:47pm UTC](https://www.ruby-forum.com/t/method-that-runs-an-executable-file/173185/3 "2009-08-04T18:47:17Z")

</div>

unknown wrote:

> On Tue, Aug 4, 2009 at 10:25 AM, Michael W.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > hello,
> > 
> > i am quite new to programming, only began in february this year and am  
> > doing a project for my uni course.
> > 
> > me and my group are using ruby on rails and were wondering if it is  
> > possible to create a method that when run, gets a rakefile to execute a  
> > database migrate?
> > 
> > would greatly appreciate any help here
> 
> There are several general ways in Ruby to launch an external command:  
> [http://pasadenarb.com/2007/03/ruby-shell-commands.html](http://pasadenarb.com/2007/03/ruby-shell-commands.html)
> 
> Though, be aware, particularly for web apps, of potential security  
> issues that can be introduced:  
> [Command Injection | OWASP Foundation](http://www.owasp.org/index.php/Command_Injection)  
> [Code injection - Wikipedia](http://en.wikipedia.org/wiki/Code_injection#Shell_injection)

thank you,

i have never used IRB before so am a little unfamiliar with the coding  
on the page, it is still helpful though. i shall try to work through it  
and get a method created for executing a rakefile.

regards,  
mike
