Running phantomjs from a Ruby on Rails application

I'm interested in using Phantomjs and I'd like to run it from my Ruby on Rails application. However, this is a command line tool (i.e. I'd need to run something like phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png in my terminal). How would I execute a command line tool from my app?

Answers


Use backticks in your ruby code e.g.:

output = `phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png`

Need Your Help

Jquery Click Variable Loop

jquery variables loops dynamic click

I am working on getting assigning a dynamic variable within Jquery in which the buttons could change to be more or less so I figured a loop would be best. (that rimes oo god it's gotten to be that ...

css, liquid columns width margins

css layout preprocessor liquid

I am building a fluid layout using the css function calc, with this function i can set the width of my items with percentages with values like 33.333% or 25% and deduct an amount equal to the margi...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.