Keats / kickstart

A scaffolding tool to get new projects up and running quickly
MIT License
354 stars 24 forks source link

To be able to set a "base repository user" for fast cloning #19

Closed Arteneko closed 5 years ago

Arteneko commented 5 years ago

Feature request

Basically, I'm setting up a common base path for my kickstart templates (something like https://git.artemix.org/Templates/), and I'd want to be able to quickly clone a template by simply specifying its name (like APIBackend would then resolve to https://git.artemix.org/Templates/APIBackend).

The resolution matching logic would be:

Keats commented 5 years ago

How would the path be set? The closest thing in cookiecutter are abbreviations in a config file: https://cookiecutter.readthedocs.io/en/latest/advanced/user_config.html

You can define path so you could define art = https://git.artemix.org/Templates/ and do kickstart art:some-template

I'm a bit hesitant with having a base path as it seems to be a very unique usecase

Arteneko commented 5 years ago

I didn't think about a prefix, but more of a global setting, but this is an interesting idea that'd allow differenciation between local folder and remote configuration.

A prefix like the cookiecutter's example you shown would be perfect, I couldn't find any mention to it in the README though, is that already implemented or more of a todo ?

If yes, I think the prefix idea would be much nicer than my first "global" idea.

Keats commented 5 years ago

Not implemented at all currently, I'm trying to have as little features as possible to start with to avoid feature bloating.

Git also has that prefixes so it's not unique, here's a piece of my .gitconfig:

[url "https://github.com/"]
    insteadOf = gh:

[url "https://bitbucket.org/"]
    insteadOf = bb:

and then you can do git clone gh:keats/kickstart for example. Right now kickstart looks for http{s}/git only to determine whether it's a local or a git remote but it could be changed to detect more cases like those prefixes. This way, it would work transparently without the need for a config file since kickstart just gives the remote to git.

Edit: I just realised it doesn't solve your exact usecase though since templates in your case are directories of one git repo. Is it a bit problem to have one git repo per template?

Arteneko commented 5 years ago

Understood for the part about feature bloating, I acknowledge that it's not a priority.

I didn't know about the Git configuration prefix, that's a nice feature, I'll dig into that.

If you're okay with this, I may try to work on the implementation of a shortcut pattern, both for kickstart to have it and to work into rust.

Keats commented 5 years ago

Go for it and let me know if you need help. The code to modify is https://github.com/Keats/kickstart/blob/master/src/utils.rs#L48-L55

Arteneko commented 5 years ago

Thanks for the direct link, I'm gonna work on this for the few next days !

To contact you for help, should I do it on this thread or by email ? And if so, which ?

Keats commented 5 years ago

Doing it in this thread is fine!

Arteneko commented 5 years ago

Now, I'm stuck on something: a "global" configuration file.

I don't really know how to load a toml file, handilng paths without any platform-dependence.

My guess would be something like:

Another solution would be to use the XDG standard, but is that wise and acceptable to add a crate to handle that ?

Keats commented 5 years ago

You don't need a config file since we just shell it to git. People will modify their .gitconfig and that will work automatically

On Mon, 6 Aug 2018, 22:02 Ivan Delsinne, notifications@github.com wrote:

Now, I'm stuck on something: a "global" configuration file.

I don't really know how to load a toml file, handilng paths without any platform-dependence.

My guess would be something like:

  • In ~/.config/kickstart.toml
  • In ~/.kickstart.toml
  • In /etc/kickstart.toml
  • Alongside the kickstart binary

Another solution would be to use the XDG standard https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html, but is that wise and acceptable to add a crate to handle that ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Keats/kickstart/issues/19#issuecomment-410835276, or mute the thread https://github.com/notifications/unsubscribe-auth/AApho4C4XTwW0DFkIPLN28Ljob6gpVNXks5uOKDEgaJpZM4VwBbd .

Arteneko commented 5 years ago

Okay, I was starting to implement the matching myself, but now I understand what you said. Gonna work on the real result now.

For confirmation, it's to add a prefix detection on "when it's ^(\d)+:, it's git", amirite ?

Keats commented 5 years ago

For confirmation, it's to add a prefix detection on "when it's ^(\d)+:, it's git", amirite ?

Seems like it would work fine yeah

Arteneko commented 5 years ago

Closed, as it've been merged.