Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use slice.source_path in RubyFileWriter #202

Open
cllns opened this issue Jul 14, 2024 · 1 comment
Open

Use slice.source_path in RubyFileWriter #202

cllns opened this issue Jul 14, 2024 · 1 comment

Comments

@cllns
Copy link
Member

cllns commented Jul 14, 2024

If we can pass an actual slice instance into RubyFileWriter#directory, we could use our new Slice#source_path to make this simpler:

base = slice.source_path

This returns the appropriate value for both the app as well as slices, so it means we no longer need if app else slice conditionals 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 #186 (comment)

@cllns cllns changed the title Use slice.source_path in RubyFileGenerator Use slice.source_path in RubyFileWriter Jul 14, 2024
@cllns
Copy link
Member Author

cllns commented Jul 14, 2024

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: and inflector: 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 #199 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant