Migrate the script code to ruby.

Improve the readme.