Project

undead

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Undead gets Dynamic HTML. Dynamic HTML are created by JavaScript.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0

Runtime

~> 0.3.1
 Project Readme

Undead

Undead gets Dynamic HTML. Dynamic HTML are created by JavaScript.

Installation

Add this line to your application's Gemfile:

gem 'undead'

And then execute:

$ bundle

Or install it yourself as:

$ gem install undead

Installing PhantomJS

You need at least PhantomJS 1.8.1. There are no other external dependencies (you don't need Qt, or a running X server, etc.)

Mac

  • Homebrew: brew install phantomjs
  • MacPorts: sudo port install phantomjs
  • Manual install: Download this

Linux

  • Download the 32 bit or 64 bit binary.
  • Extract the tarball and copy bin/phantomjs into your PATH

Windows

Manual compilation

Do this as a last resort if the binaries don't work for you. It will take quite a long time as it has to build WebKit.

(See also the PhantomJS building guide.)

Usage

Get Dynamic HTML in Terminal

$ undead http://example.com/

Get Dynamic HTML in Ruby

Undead.get can get Dynamic HTML. <script> is evaluated, then HTML is created.

response = Undead.get 'http://example.com/'  # GET http://example.com/

# Undead's response. The HTML p element is dynamicaly created.
# <!doctype html>
# <html>
# <head></head>
# <body>
#   <div id="main">
#     <p>Hello, World!</p>
#   </div>
#   <script>
#     var p = document.createElement("p");
#     var helloText = document.createTextNode("Hello, World!");
#     p.appendChild(helloText);
#     var main = document.getElementById("main");
#     main.appendChild(p);
#   </script>
# </body>

# Original response.
# <!doctype html>
# <html>
# <head></head>
# <body>
#   <div id="main"></div>
#   <script>
#     var p = document.createElement("p");
#     var helloText = document.createTextNode("Hello, World!");
#     p.appendChild(helloText);
#     var main = document.getElementById("main");
#     main.appendChild(p);
#   </script>
# </body>

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/south37/undead.

License

The gem is available as open source under the terms of the MIT License.