Closed ams-tschoening closed 5 years ago
I had different implementations in mind, like providing an additional option --pre-compiled
taking a path or a boolean, but reusing the already available paths for KSY-files and deciding based on their extension seems the easier approach to me. It's like switching between if compilation is necessary by ksv
or not pretty much transparently.
Makes sense, thanks for sharing this!
If one runs into problems with the compiled KSY and things break because bugs/missing implementation in the compiler most likely, sometimes it's easier to change formerly generated Ruby to test which changes lead to successful Ruby and afterwards change the compiler accordingly. With the former behaviour of "ksv" compiling always using temporary directories, this was pretty much impossible to achieve and one needed to change the compiler always to generate new code. But for people new to Scala and Ruby (like me) this is a pretty difficult roundtrip.
So "ksv" has been enhanced so that some pre-compiled Ruby file can be given instead of some KSY and "ksv" doesn't compile in that case anymore. Instead, by convention all Ruby files in the parent dir of the given file are required and the given file name is used as main class. Both approaches are pretty much what "ksv" implemented currently anyway.
This helped me debugging https://github.com/kaitai-io/kaitai_struct/issues/552.