Skip to content
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

[Feature]: Refactor init to bootstrap examples #867

Closed
1 task done
paulotten opened this issue May 5, 2023 · 5 comments · Fixed by #888 or #984
Closed
1 task done

[Feature]: Refactor init to bootstrap examples #867

paulotten opened this issue May 5, 2023 · 5 comments · Fixed by #888 or #984
Assignees

Comments

@paulotten
Copy link
Contributor

Describe the feature

We currently bootstrap projects for various service integrations with hard-coded boilerplate code. The current implementation also generates the Cargo.toml with the latest available versions, which can be a problem: ‣

So for this project we should:

  1. Investigate the viability of bootstrapping projects from examples in our examples repository: https://github.com/shuttle-hq/examples
  2. Open a draft PR with a proof of concept
  3. Update the cargo-shuttle cli to be able to init any example, not just hello-world for each integration.
  4. Implement the refactor for all integrations

Suggestion or Example of how the feature would be used

No response

Duplicate declaration

  • I have searched the issues and this feature has not been requested before.
@paulotten
Copy link
Contributor Author

Plan for point 1 is to use include_str!.

@paulotten
Copy link
Contributor Author

Draft #869 created. Questions for @oddgrd or another Shuttle dev:

  1. Do you like the include_str! approach?

The current implementation also generates the Cargo.toml with the latest available versions, which can be a problem

  1. Would you like me to just copy over the entire Cargo.toml file for each example? (Or would that cause some other issues?)

paulotten added a commit to mikegin/examples that referenced this issue Jun 5, 2023
Created by running `cargo shuttle init` and selecting the "none" option.
Will be used by shuttle-hq/shuttle#867
@paulotten
Copy link
Contributor Author

Update the cargo-shuttle cli to be able to init any example, not just hello-world for each integration.

This is not currently implemented in #888. I'd recommend splitting it out to a separate issue. (Should be easy.)

@jonaro00
Copy link
Member

jonaro00 commented Jun 6, 2023

@paulotten Do you want to work on the last part? If not, I can take it.

@paulotten
Copy link
Contributor Author

@jonaro00 I'm fine with you taking the last part. Just let #888 get merged first.

paulotten added a commit to mikegin/shuttle that referenced this issue Jun 8, 2023
oddgrd pushed a commit that referenced this issue Jun 9, 2023
…#888)

* feat: use `cargo generate` instead of hardcoding examples source code

* feat: use `cargo-generate` as a library

* feat: add `custom/none` example

* use project name `.as_ref()`

* fix: apparently we need to use `auto_path` instead of `subfolder`.

* chore: update `examples` git submodule

* manually set the crate name

* fix: clippy lints

* fix: rocket sub path

* move `use` to top of file

* remove the Shuttle.toml file, if it exists

* feat: create a .gitignore file when copying an example

closes #867

---------

Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment