-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
[WIP] Extract CLI generator #931
Conversation
Also renamed from 'destination' to 'path', since a destination doesn't really make sense for something that's being deleted.
And rename some variables from 'destination' to 'path', since it's more accurate
Also fix the behavior for routes, where it'd say it 'inserted' the route when really it appended it. Either would be fine, but this is more accurate and simpler to implement.
c1c912f
to
910ca80
Compare
very good job @cllns it makes sense to extract this to CLI, for me it is ok :) Can you rebase this branch from |
Talking with @jodosha a little while ago, we decided this should be extracted more. Specifically, reading the templates should be extracted into So instead of: source = templates.find("README.md.erb")
destination = project.readme(context)
generator.create(source, destination, context) The API would be: destination = project.readme(context)
generator.create("README.md.erb", destination, context) Does that make sense? It's quite a bit more work on top of what's already in this PR. |
Removing milestone 1.3.0 because it isn't completed and is not a priority |
Closing as stale PR. @cllns Feel free to resume the work. |
Note: we'll get rid of @templates, in favor of using @Generator directly
It needs the other updated instance variable too, for now.
We can pass in just the name of the file, and the generator knows what to do with it now.
It's now just Hanami::CLI::Templates, too
The Command can find its own location for templates now, based on the command, so it's not necessary to specify an exact class.
Closing as stale initiative. @cllns Feel free to reopen, in case. |
We'd like to extract to file generation functionality from this repo to
Hanami::CLI
.A few reasons:
Hanami::CLI
can benefit from our work. They won't need to write their own file manipulation and output code.Hanami::CLI
level, so all our specs for this repo can be plaintext without being muddied by a bunch of shell-code for colorizing (since we can disable colorizing for specs, and delegate the testing of that behavior toHanami::CLI
's test suite).Hanami::CLI
.cc @AlfonsoUceda @hanami/core
Some clean-up too:
I changed some variables names to
path
fromdestination
when there's only one page. It makes sense to havedestination
andsource
when they are two paths, but, for example,destination
doesn't make sense for something we want to delete.The CLI said a route was
insert
ed, when really it wasappend
ed. Either one works but it's simpler for the cade to just let it say the route was appended to the routes file.