On Thu, Jun 12, 2014 at 04:30:06PM +0200, Lukas Ocilka wrote:
The current Yast code that we will have in SLE 12 is partly automagically translated from YCP to kind of Ruby (also called RYCP), is still using many YCP-like methods for backward compatibility. Partly - because we have already cleaned up some pieces when touching them, following the Boy-Scout Rule [#1] and so the feel quite OK. Of course, we will not be able to cleanup everything we wanted and when SLE 12 is out, we will have to maintain the codebase for years.
I want to prototype a tool to help with converting Rubified YCP to idiomatic Ruby. I want to try different levels: - An "aggressive" conversion, which converts *all* Ops and Builtin calls in a file assuming tests are in place to catch bugs, - A "safe" conversion which leaves functoinality the same even if the dreaded nil sneaks in. Like replacing Builtins.getenv(foo) with ENV[foo]. Or using a simple static analysis to deduce that a variable cannot be nil, like in @help = "" @help = Ops.add(@help, "Part 1 of 42...") @help = Ops.add(@help, "Part 2 of 42...") David sent me a link to http://whitequark.org/blog/2013/04/26/lets-play-with-ruby-code/ which points to a library that was used to convert between RSpec 2 and RSpec 3 (which is a nontrivial task defeating regex hacks)
[rest of the mail] will reply tomorrow -- Martin Vidner, Cloud & Systems Management Team http://en.opensuse.org/User:Mvidner
Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu