duerst/eprun — pull request #1 by camertron (2013-12-08 07:08:30+00:00)
Title: Add support for MRI 1.8, turn into gem

Hey Martin,

I've been doing a bit of work recently on converting eprun into a gem and adding support for Ruby 1.8 (which is required by twitter-cldr-rb). Ultimately I'd like to make eprun a dependency and deprecate the existing normalization implementation we have today.

Some notes regarding this pull request:

1. Instead of using characters and strings as the keys and values for the normalization tables, I used Unicode codepoints. This is mostly to avoid string indexing and other issues in MRI 1.8. Similarly, all normalization regexes now use escaped octal character representations instead of Unicode escapes (eg \u11AB).
2. The test suite has been rewritten in RSpec (from Test::Unit).
3. The normalization table generator script has been turned into a rake task. Run `bundle exec rake generate_tables` to regenerate.
4. The benchmark suite is also a rake task. Run `bundle exec rake benchmark` to execute.
5. Eprun is now capable of running on the TravisCI build platform (see `.travis.yml`). You'll need to enable the git hook for automatic test runs in Eprun's admin config on GitHub and sign up for a free TravisCI account.
6. Because of the addition of MRI compatibility, Eprun's benchmarks have taken a bit of a hit. I noticed an average slow-down of about 400ms. To me, that's an acceptable level of degradation, but I'd like to hear what you think.
7. The project now works on all major versions of MRI, including 1.8, 1.9, and 2.0. I had to remove a few references to the `Encoding` class, particularly the functionality that would convert to UTF-8 from UTF-16 before performing normalization. This means that Eprun *must* be used only with UTF-8 inputs. I don't know if there's anything we can do about that unless we'd like to guess at the encoding and use `Iconv` to convert.

Let me know what you think! As far as I know, Eprun is still the fastest Ruby normalization implementation out there. Thanks for your consideration!

-Cameron