Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript Execute Ruby Script

Server/Client are the same box. Creating a UI to run ruby test scripts locally.

I want something like executing an ActiveXObject:

    w = new ActiveXObject("WScript.Shell");
    w.run('test.rb');

File structure is as follows

>Project
  -index.HTML
  -custom.js
  >Scripts
   -Ruby Script
like image 793
unmuse Avatar asked Apr 23 '26 15:04

unmuse


1 Answers

Assuming ruby is installed in the system and is included in the PATH variable. All you need to do is:

var w = new ActiveXObject("WScript.Shell");
w.run('ruby Scripts\\test.rb');
like image 73
Candide Avatar answered Apr 26 '26 03:04

Candide



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!