Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Move zome templates out of core repo and support third party templates #1565

Merged
merged 17 commits into from
Oct 25, 2019

Conversation

willemolding
Copy link
Collaborator

@willemolding willemolding commented Jul 2, 2019

PR summary

Maintaining the template zomes produced by hc generate in the core repo was awkward. This PR:

  • Moves the templates to their own repos
  • Uses a proper templating crate (Tera)
  • Allows users to specify the URLs to their own custom template zome repos by running hc generate path/to/zome https://github.com/username/template-repo. As long as they follow our templating convention ({{ version }}, {{ author }} and {{ name }} for the moment) it will fill these fields.
  • Updates the .hcbuild. Previously this was populated using cargo which used absolute paths but this caused issues when the .hcbuild files are commited/shared. It now uses relative paths.

followups

If there is pull for it we could also add support for user defined template fields which are passed to hc generate as an extra param.

changelog

Please check one of the following, relating to the CHANGELOG-UNRELEASED.md

  • this is a code change that effects some consumer (e.g. zome developers) of holochain core so it is added to the CHANGELOG-UNRELEASED.md (linked above), with the format - summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)
  • this is not a code change, or doesn't effect anyone outside holochain core development

@willemolding willemolding changed the title Feature/hc templates from repo Move zome templates out of core repo and support third party templates Jul 2, 2019
@willemolding
Copy link
Collaborator Author

Not sure about the best way to go about testing. I don't want to slow down the current CI cycle but it would be nice to have the peace of mind that using hc init and hc generate produces something that actually builds and passes dna tests.

Copy link
Collaborator

@Connoropolous Connoropolous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this step in general for sure!

One thing that we discussed when it was actually a 'git clone' in the past, was the fact that this means that hc generate can only be used while you have an internet connection, which is a touch sad. That said, it's worth testing for/checking for what the behaviour of this command would be if you did not have internet at the time, and hopefully making it a decent experience in that case too.

@@ -24,13 +24,13 @@ impl Build {
Ok(build)
}

pub fn save_as<T: AsRef<Path>>(&self, path: T) -> DefaultResult<()> {
let file = File::create(path)?;
// pub fn save_as<T: AsRef<Path>>(&self, path: T) -> DefaultResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doing just commented out code?

cli/src/main.rs Outdated Show resolved Hide resolved
willemolding and others added 2 commits July 13, 2019 18:48
Co-Authored-By: Connor Turland <connor.turland@holo.host>
@thedavidmeister
Copy link
Contributor

@willemolding oh i think this needs the merge conflicts solved, the diff looks pretty messy atm?

Copy link
Collaborator

@lucksus lucksus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Also wondering about the commented out lines - should those be removed?

@willemolding willemolding merged commit 8f1cb4a into develop Oct 25, 2019
@neonphog neonphog deleted the feature/hc-templates-from-repo branch March 5, 2020 23:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants