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

feat: refactor CopyTemplateFiles to support different file system #78

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

howieyuen
Copy link
Collaborator

@howieyuen howieyuen commented Jun 22, 2022

related: #72 (comment)

Refactor CopyTemplateFiles()(rename to RenderLocalTemplate()) to support different file system, not only local directory:

  1. For the built-in templates, we must use the go:embed command, otherwise, we cannot compile it into binary, and we cannot access the built-in templates directory because of a relative path.
  2. Render the template to the specified directory, the whole process is divided into 3 steps:
    1. ReadTemplate(): read the local path to srcFS
    2. RenderFSTemplate(): render srcFS to destFS
    3. WriteToDisk(): write to disk
  3. For third-party integration scenarios, you can choose one:
    1. Local directory: RenderLocalTemplate()
    2. Self-provided memory file system: RenderFSTemplate()
    3. Built-in template that comes with the scaffold package: GetInternalTemplates()

@howieyuen howieyuen requested review from a team June 22, 2022 11:10
@coveralls
Copy link

coveralls commented Jun 22, 2022

Coverage Status

Coverage decreased (-0.2%) to 73.372% when pulling 1b62f91 on howieyuen:scaffold-servitization into 1c2494f on KusionStack:main.

@howieyuen howieyuen enabled auto-merge (squash) June 23, 2022 02:35
@howieyuen howieyuen force-pushed the scaffold-servitization branch 2 times, most recently from 6f8ae60 to 4eea102 Compare June 24, 2022 06:37
Copy link
Contributor

@elliotxx elliotxx left a comment

Choose a reason for hiding this comment

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

lgtm

@howieyuen howieyuen merged commit 28e6f71 into KusionStack:main Jun 27, 2022
@howieyuen howieyuen deleted the scaffold-servitization branch June 27, 2022 09:50
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 2022
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.

None yet

4 participants