Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cue/load: make cue.mod the default desitination
Browse files Browse the repository at this point in the history
This effects generation, for instance.

- also update Kubernetes tutorial to use `cue mod init`

Change-Id: I9ff9f023f6771057e86f9f51f6c9c35c095939ce
  • Loading branch information
mpvl committed Oct 25, 2019
1 parent 9707302 commit 7a78467
Show file tree
Hide file tree
Showing 100 changed files with 10,700 additions and 3,971 deletions.
8 changes: 4 additions & 4 deletions cue/load/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ err: relative import paths not allowed ("./file")
path: ""
module: example.org/test
root: $CWD/testdata
dir: $CWD/testdata/pkg
dir: $CWD/testdata/cue.mod/gen
display:`,
}, {
cfg: dirCfg,
Expand Down Expand Up @@ -192,7 +192,7 @@ err: cannot find package "non-existing"
path: non-existing
module: example.org/test
root: $CWD/testdata
dir: $CWD/testdata/pkg/non-existing
dir: $CWD/testdata/cue.mod/gen/non-existing
display:non-existing`,
}, {
cfg: dirCfg,
Expand All @@ -216,8 +216,8 @@ display:./imports
files:
$CWD/testdata/imports/imports.cue
imports:
acme.com/catch: $CWD/testdata/pkg/acme.com/catch/catch.cue
acme.com/helper:helper1: $CWD/testdata/pkg/acme.com/helper/helper1.cue`,
acme.com/catch: $CWD/testdata/cue.mod/pkg/acme.com/catch/catch.cue
acme.com/helper:helper1: $CWD/testdata/cue.mod/pkg/acme.com/helper/helper1.cue`,
}, {
cfg: dirCfg,
args: args("./toolonly"),
Expand Down
File renamed without changes.
17 changes: 9 additions & 8 deletions doc/tutorial/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,24 @@ We first make a copy of the data directory.

```
$ cp -a original tmp
$ cd tmp/services
$ cd tmp
```

<!-- TODO
Although not strictly necessary, we mark the root of the configuration tree
for good measure.
We initialize a module so that we can treat all our configuration files
in the subdirectories as part of one package.
We do that later by giving all the same package name.

```
$ touch ../cue.mod
cue mod init
$ cue mod init
```
-->

Creating a module also allows our packages import external packages.

Let's try to use the `cue import` command to convert the given YAML files
into CUE.

```
$ cd services
$ cue import ./...
Import failed: must specify package name with the -p flag
```
Expand Down Expand Up @@ -1051,7 +1052,7 @@ $ cue get go k8s.io/api/apps/v1beta1
```

Now that we have the Kubernetes definitions in `pkg`, we can import and use them:
Now that we have the Kubernetes definitions in our module, we can import and use them:

```
$ cat <<EOF > k8s_defs.cue
Expand Down
Empty file.
1 change: 1 addition & 0 deletions doc/tutorial/kubernetes/quick/cue.mod/module.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Code generated by cue get go. DO NOT EDIT.

//cue:generate cue get go k8s.io/api/apps/v1beta1

package v1beta1

GroupName :: "apps"

0 comments on commit 7a78467

Please sign in to comment.