Use slice.source_path in RubyFileWriter
If we can pass an actual slice instance into RubyFileWriter#directory, we could use our new
Slice#source_pathto make this simpler:base = slice.source_pathThis returns the appropriate value for both the app as well as slices, so it means we no longer need
if app else sliceconditionals everywhere, which has been a bother for the longest time :)(Again, this would be another great refactor for post-merge, I don't want to hold anything up!)
Originally posted by @timriley in https://github.com/hanami/cli/pull/186#discussion_r1676984531
When doing this, might be worth trying this other refactor for RubyFileWriter
Like you mentioned in the description, this is an internal class only so we can tolerate some slightly less ergonomic API design, but I think a refactor to allow a FileWriter instance to be initialised once and then used to write multiple files might be nice.
So this would probably pull the
fs:andinflector:params out into#initialize, with the rest going into some method that writes an actual file.I think this'd be worth playing with sometime, but it's not blocking and I'm definitely keen to get our full range of CLI commands ready for beta1 on Tuesday. So happy if this comes in a follow-up change of some kind :)
Originally posted by @timriley in https://github.com/hanami/cli/pull/199#discussion_r1676987192
Closed in #222 (though I actually didn't end up doing what this issue says)