Running phantomjs from a Ruby on Rails application

2020-05-21 09:27发布

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?

1条回答
相关推荐>>
2楼-- · 2020-05-21 09:29

Use backticks in your ruby code e.g.:

output = `phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png`
查看更多
登录 后发表回答