What?
cargo-shuttle uses the library part of cargo-generate for cloning repos in cargo shuttle init.
Get rid of cargo-generate and re-implement its core functionality.
Why?
- Reduce dependency tree weight from cargo-generate, which has more features than we need.
- It also panics sometimes
- It is not written to be used as a library
- Possibly get rid of openssl/native-tls dependency
Requirements
- All documented features and options of the
cargo shuttle init command should remain the same and work the same way. (https://github.com/shuttle-hq/shuttle-examples#readme)
- The solution should mimic
cargo-generate, which includes, but not limited to:
- Create a temp dir with
tempdir
- Parse the
--from parameter and determine if the arg is a repo or path:
gh:aaa/bbb => clone from GitHub user aaa repo bbb, same for gl: and bb:
aaa/bbb => same as above
aaa & aaa/bbb/ccc etc => could be seen as relative paths, but should error, to not get confused with the previous bullet
./aaa => from local path aaa/
../../aaa/bbb => also local path
/aaa/bbb => local absolute path
C:/aaa/bbb => local absolute path (windows)
- Clone/Copy from the source into the temp dir
- Take only the subfolder param (if provided) and copy all of those files into target folder
- Do a git init if relevant (same way it does now)
- Do the final modifications with
set_crate_name , edit_shuttle_toml, create_gitignore_file. (basically no change)
Bonus requirements (optional)
- Get rid of openssl/native-tls dependency. NOTE: We only need to support cloning over HTTP, which should hopefully simplify this a bit. Investigate the suitable crate for this (
gix?)
- Update unit/integration tests to cover any missing parts of the
init API
- Allow passing args or syntax for specifying a branch/tag/commit to clone from. A
--rev arg??
What?
cargo-shuttleuses the library part ofcargo-generatefor cloning repos incargo shuttle init.Get rid of
cargo-generateand re-implement its core functionality.Why?
Requirements
cargo shuttle initcommand should remain the same and work the same way. (https://github.com/shuttle-hq/shuttle-examples#readme)cargo-generate, which includes, but not limited to:tempdir--fromparameter and determine if the arg is a repo or path:gh:aaa/bbb=> clone from GitHub user aaa repo bbb, same forgl:andbb:aaa/bbb=> same as aboveaaa&aaa/bbb/cccetc => could be seen as relative paths, but should error, to not get confused with the previous bullet./aaa=> from local pathaaa/../../aaa/bbb=> also local path/aaa/bbb=> local absolute pathC:/aaa/bbb=> local absolute path (windows)set_crate_name,edit_shuttle_toml,create_gitignore_file. (basically no change)Bonus requirements (optional)
gix?)initAPI--revarg??