Skip to content

Commit d702642

Browse files
committed
Rename examples to templates on the git repo
Also removes `/usr/local/share/lima/examples` (symlink to `templates`). Follow-up to PR 1679 Fix issue 2808 Signed-off-by: Akihiro Suda <[email protected]>
1 parent 41d98c2 commit d702642

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+34
-59
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
run: sudo make install
110110
- name: Verify templates match `limactl edit` format
111111
run: |
112-
find examples -name '*.yaml' -exec limactl edit --set 'del(.nothing)' {} \;
112+
find templates -name '*.yaml' -exec limactl edit --set 'del(.nothing)' {} \;
113113
git diff-index --exit-code HEAD
114114
- name: Uninstall
115115
run: sudo make uninstall

Makefile

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ help-targets:
8989
@echo '- templates : Copy templates'
9090
@echo '- template_experimentals : Copy experimental templates to experimental/'
9191
@echo '- default_template : Copy default.yaml template'
92-
@echo '- create-examples-link : Create a symlink at ../examples pointing to templates'
9392
@echo
9493
@echo 'Targets for files in _output/share/doc/lima:'
9594
@echo '- documentation : Copy documentation to _output/share/doc/lima'
@@ -146,7 +145,7 @@ menuconfig: Kconfig
146145
################################################################################
147146
.PHONY: binaries
148147
binaries: limactl helpers guestagents \
149-
templates template_experimentals create-examples-link \
148+
templates template_experimentals \
150149
documentation create-links-in-doc-dir
151150

152151
################################################################################
@@ -313,8 +312,8 @@ MKDIR_TARGETS += _output/share/lima
313312

314313
################################################################################
315314
# _output/share/lima/templates
316-
TEMPLATES = $(addprefix _output/share/lima/templates/,$(filter-out experimental,$(notdir $(wildcard examples/*))))
317-
TEMPLATE_EXPERIMENTALS = $(addprefix _output/share/lima/templates/experimental/,$(notdir $(wildcard examples/experimental/*)))
315+
TEMPLATES = $(addprefix _output/share/lima/templates/,$(filter-out experimental,$(notdir $(wildcard templates/*))))
316+
TEMPLATE_EXPERIMENTALS = $(addprefix _output/share/lima/templates/experimental/,$(notdir $(wildcard templates/experimental/*)))
318317

319318
.PHONY: default_template templates template_experimentals
320319
default_template: _output/share/lima/templates/default.yaml
@@ -325,28 +324,14 @@ $(TEMPLATES): | _output/share/lima/templates
325324
$(TEMPLATE_EXPERIMENTALS): | _output/share/lima/templates/experimental
326325
MKDIR_TARGETS += _output/share/lima/templates _output/share/lima/templates/experimental
327326

328-
_output/share/lima/templates/%: examples/%
327+
_output/share/lima/templates/%: templates/%
329328
cp -aL $< $@
330329

331330
# returns "force" if GOOS==windows, or GOOS!=windows and the file $(1) is not a symlink.
332331
# $(1): target file
333332
# On Windows, always copy to ensure the target has the same file as the source.
334333
force_link = $(if $(filter windows,$(GOOS)),force,$(shell test ! -L $(1) && echo force))
335334

336-
################################################################################
337-
# _output/share/lima/examples
338-
.PHONY: create-examples-link
339-
create-examples-link: _output/share/lima/examples
340-
_output/share/lima/examples: _output/share/lima/templates $$(call force_link,$$@)
341-
# remove the existing directory or symlink
342-
rm -rf $@
343-
ifneq ($(GOOS),windows)
344-
ln -sf templates $@
345-
else
346-
# copy from templates built in build process
347-
cp -aL $< $@
348-
endif
349-
350335
################################################################################
351336
# _output/share/doc/lima
352337
DOCUMENTATION = $(addprefix _output/share/doc/lima/,$(wildcard *.md) LICENSE SECURITY.md VERSION)
@@ -366,7 +351,7 @@ _output/share/doc/lima/%: % | _output/share/doc/lima
366351
MKDIR_TARGETS += _output/share/doc/lima
367352

368353
.PHONY: create-links-in-doc-dir
369-
create-links-in-doc-dir: _output/share/doc/lima/templates _output/share/doc/lima/examples
354+
create-links-in-doc-dir: _output/share/doc/lima/templates
370355
_output/share/doc/lima/templates: _output/share/lima/templates $$(call force_link,$$@)
371356
# remove the existing directory or symlink
372357
rm -rf $@
@@ -376,15 +361,6 @@ else
376361
# copy from templates built in build process
377362
cp -aL $< $@
378363
endif
379-
_output/share/doc/lima/examples: _output/share/doc/lima/templates $$(call force_link,$$@)
380-
# remove the existing directory or symlink
381-
rm -rf $@
382-
ifneq ($(GOOS),windows)
383-
ln -sf templates $@
384-
else
385-
# copy from templates built in build process
386-
cp -aL $< $@
387-
endif
388364

389365
################################################################################
390366
# returns difference between GOOS GOARCH and GOHOSTOS GOHOSTARCH.
@@ -424,12 +400,12 @@ endif
424400
################################################################################
425401
schema-limayaml.json: _output/bin/limactl$(exe)
426402
ifeq ($(native_compiling),true)
427-
$< generate-jsonschema --schemafile $@ examples/default.yaml
403+
$< generate-jsonschema --schemafile $@ templates/default.yaml
428404
endif
429405

430406
.PHONY: check-jsonschema
431407
check-jsonschema: schema-limayaml.json
432-
check-jsonschema --schemafile $< examples/default.yaml
408+
check-jsonschema --schemafile $< templates/default.yaml
433409

434410
################################################################################
435411
.PHONY: diagrams
@@ -523,8 +499,8 @@ artifact: $(addprefix $(ARTIFACT_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS))
523499

524500
ARTIFACT_DES = _output/bin/limactl$(exe) $(LIMA_DEPS) $(HELPERS_DEPS) \
525501
$(ALL_GUESTAGENTS) \
526-
$(TEMPLATES) $(TEMPLATE_EXPERIMENTALS) _output/share/lima/examples \
527-
$(DOCUMENTATION) _output/share/doc/lima/templates _output/share/doc/lima/examples \
502+
$(TEMPLATES) $(TEMPLATE_EXPERIMENTALS) \
503+
$(DOCUMENTATION) _output/share/doc/lima/templates \
528504
_output/share/man/man1/limactl.1
529505

530506
# file targets

cmd/limactl/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To create an instance "default" from a local file:
5757
$ limactl create --name=default /usr/local/share/lima/templates/fedora.yaml
5858
5959
To create an instance "default" from a remote URL (use carefully, with a trustable source):
60-
$ limactl create --name=default https://raw.githubusercontent.com/lima-vm/lima/master/examples/alpine.yaml
60+
$ limactl create --name=default https://raw.githubusercontent.com/lima-vm/lima/master/templates/alpine.yaml
6161
6262
To create an instance "local" from a template passed to stdin (--name parameter is required):
6363
$ cat template.yaml | limactl create --name=local -

pkg/limayaml/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../examples/default.yaml
1+
../../templates/default.yaml

templates

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

website/content/en/docs/_index.md

Lines changed: 3 additions & 3 deletions

website/content/en/docs/config/_index.md

Lines changed: 1 addition & 1 deletion

website/content/en/docs/faq/_index.md

Lines changed: 10 additions & 10 deletions

website/content/en/docs/templates/_index.md

Lines changed: 1 addition & 1 deletion

website/hugo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ enable = false
205205
source="docsy"
206206
target="content/docs/Reference"
207207
language="en"
208-
# Import examples README.md from examples folder
208+
# Import templates README.md from templates folder
209209
[[module.imports]]
210210
path="../.."
211211
[[module.imports.mounts]]
212-
source="examples"
213-
target="static/examples"
212+
source="templates"
213+
target="static/templates"
214214
language="en"
215-
includeFiles = "README.md"
215+
includeFiles = "README.md"

website/layouts/shortcodes/readtemplates.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ $gh_repo := (.Site.Params.github_repo) -}}
22
{{ $gh_docs := (printf "%s/tree/%s/docs/" $gh_repo $.Site.Params.version) -}}
3-
{{ $gh_examples := (printf "%s/tree/%s/examples/" $gh_repo $.Site.Params.version) -}}
3+
{{ $gh_templates := (printf "%s/tree/%s/templates/" $gh_repo $.Site.Params.version) -}}
44

55
{{/* Store ordinal, to be retrieved by parent element */}}
66
{{ if ge hugo.Version "0.93.0" }}
@@ -39,10 +39,10 @@
3939
{{ else }}
4040
{{ $file_content := ($.Scratch.Get "filepath" | os.ReadFile) }}
4141
{{ $file_content = replace $file_content "../docs/" $gh_docs }}
42-
{{- replace $file_content "./" $gh_examples -}}
42+
{{- replace $file_content "./" $gh_templates -}}
4343
{{ end }}
4444
{{ else if eq (.Get "draft") "true" }}
4545

4646
<p style="color: #D74848"><b><i>The file <code>{{ $.Scratch.Get "filepath" }}</code> was not found.</i></b></p>
4747

48-
{{ else }}{{- errorf "Shortcode %q: file %q not found at %s" .Name ($.Scratch.Get "filepath") .Position -}}{{ end }}
48+
{{ else }}{{- errorf "Shortcode %q: file %q not found at %s" .Name ($.Scratch.Get "filepath") .Position -}}{{ end }}

0 commit comments

Comments
 (0)