While learning how to use Nokogiri in Ruby,I got this idea,what if I can automate these commands which I write in bash for Nokogiri? Is there any way or method which I can use to automate the call?
For example: As I was trying to grab some data from one site I wrote:
require 'rubygems'
require 'nokogiri'
require 'open-uri'
PAGE_URL = "http://hackerstreet.in"
page = Nokogiri::HTML(open(PAGE_URL))
links = page.css("a")
puts links.length
puts links[0].text
puts links[0]["href"]
And, to execute it, I have to enter this command at the command line:
$ ruby any.rb > any.html
What shall I do in order to run the same from a Web-App.
If anyone can help on this issue then that would be great.