ansi-sys-revived
ansi-sys-revived is a Ruby library to render texts with ANSI escape sequences. Convert your colorful shell output to HTML code.
Original version, Ruby-ANSI.SYS, was developed on RubyForge. Original website is ansi-sys.rubyforge.org. kazz187 was the first to import the project to GitHub.
Installation
Add this line to your application's Gemfile:
gem 'ansi-sys-revived'
Then execute:
$ bundle
Gem works on Ruby 1.9.3, 2.0 and 2.1. Use original ansi-sys for Ruby 1.8.
Usage
Show with the default ANSI colors:
require 'ansisys'
terminal = AnsiSys::Terminal.new
terminal.echo("Hello \e[32mWorld\e[m")
terminal.render #=> HTML fragment
Or with brigher colors:
require 'ansisys'
terminal.render(:html, 80, nil, AnsiSys::Screen.default_css_colors(false, true))
Tests
You can run through spec files:
$ bundle exec rake spec
Contributing
- Fork it
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Create a pull request
- Include this text in the description:
I hereby license the submitted code under GNU GPL v3.
- Thanks!
License
Copyright (c) 2014 StratusHost Damian Nowak
Licensed under GNU GPL v3. See LICENSE file.
Original copyright note:
Ruby-ANSI.SYS Copyright (C) 2007 zunda unless otherwise stated.
This program is free software. You can distribute/modify this program under the terms of the GNU LGPL, Lesser General Public License version 2.1.