appscrolls
appscrolls copied to clipboard
add --save NAME option to save your chosen scrolls when creating an app
Simple way to save your selections. Considering how to implement pulling them back out and using them when generating.
On one hand, I thought about overloading the scrolls option to let you do -s saved_name, rather than creating yet another option. At the same time another option would be cleaner and likely more obvious...so maybe I'll spike on that and see how it goes.
Also, yeah, didn't include tests. Happy to give them a go if you have some guidance on it--I always find testing code like this to sometimes get a bit awkward and unhelpful.
Seems like a ~/.scrolls dir might be desired from other pull requests? Maybe makes sense to standardize that, and then the file that stores this data can go in there?
Perhaps a "saved scroll" is just another scroll with dependencies? (the scrolls you originally selected)
Then we don't need --use
, rather you just select your custom scroll "my-scrolls" normally: scrolls new myapp2 -s my-scrolls
.
Thoughts?
Yep, definitely like that style of use. You could even publish scrolls that represent common configs, etc.
So, how do we build this? It would seem that if scrolls had a way of depending on other scrolls, you could easy save one that just depends on those you selected. I don't believe they currently have this functionality though? Seems a basic version of this wouldn't be hard to build.
Ahh, just found the require option after looking through source. Seems this would do it. I'm going to give this idea a go and see how it turns out.
Ok, code is ugly (partial copy/paste from rake task), but is proof-of-concept ready. I like this strategy. Would probably want to combine with other efforts to write out scroll file to ~/.scrolls/{name}.rb or something similar.
I'm trying to think through the UX here.
- You generate an app with some scrolls.
- You realize you missed some scrolls, so you generate it again (happens to me)
- Later, you want to generate a new app with the scrolls you previously used; or a co-worker is creating a new app and wants to use those scrolls
Perhaps --save
isn't in their mind? Perhaps we offer a new command scrolls save
and it shows you your previous history, you select one, and give it a name.
Thoughts?
Ok so it automatically writes a history file that you then select from? I can see that working nicely.
- Every time you run scrolls we add to a history log
- You can call
scrolls history
to see that list. You can then--save
or--use
directly from it?
I think I like the history command, pure in what it does, and then the options give you both saving as a new scroll for future use, as well as ability to just reuse easily without worrying about generating a new scroll.
What you think?
Yeah that sounds good.
Ok, spiked out functionality as described above, take a peek and let me know what you think.
Thoughts? If looks good, will take a look at writing some tests for this.
The idea looks great. Continue!