Add task to install templates. Similar to RailsBytes #1286
Replies: 3 comments 2 replies
-
Love it! I'd actually recommend that we emulate tty-file over thor, though, having had a much easier time digging into TTY's code in the past: https://github.com/piotrmurach/tty-file |
Beta Was this translation helpful? Give feedback.
-
I have given this some thought because I am not sure it templates are the best solution but I cannot think of better way to do this. Another thought is something like Ameba. An in place replacement is easier in Crystal because Crystal allows access to the code at compile time. The pro is a higher level of confidence in applying a template. The cons is it is way harder to make template and it would really only be able to modify Crystal files. |
Beta Was this translation helpful? Give feedback.
-
I've been working on a solution that we could eventually use for this, and it's pretty nifty! https://github.com/stephendolan/spark Still a work in progress, but I've really enjoyed using it with Lucky Jumpstart's |
Beta Was this translation helpful? Give feedback.
-
Similar to https://railsbytes.com.
For MVP:
lucky template.install <LINK_TO_TEMPLATE>
. Easy to remember and understandWe should also add some methods like the ones in Thor and Rails templates:
We don't need them all, but stuff like insert_into_file with the
after
option, creating files, adding shards, asking questions, etc. We have some code in Lucky CLI that does some of this. We just need to move it to something likeLuckyCli::TemplateActions
or something`Implementation:
tasks/temp_lucky_template.cr
), e.g.template-{random_numbers}.cr
lucky install_temp_template
-> this runs all the code from the linked URL, which now has access to LuckyCLI so it can use all the helper methods we define therebegin/ensure
and anat_exit
so that if something fails we can print an error message and delete the file from src/tasksSecurity
Later on
We should add something to the website to explore templates. This would be super simpler. It doesn't have a code editor or anything like that. You can sign up, post a "template" with:
So the website is just a place for people to share templates and make them easier to find and install
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions