From 7cd571eca617d67fe491843e2b821b30b62bad9b Mon Sep 17 00:00:00 2001 From: Allison Richardet Date: Thu, 22 Dec 2016 11:45:26 -0600 Subject: [PATCH] docs: only list exported fields in param and export sections --- docs/content/resources/docker.container.md | 2 +- docs/content/resources/docker.image.md | 2 +- docs/content/resources/docker.network.md | 2 +- docs/content/resources/docker.volume.md | 2 +- docs/content/resources/file.content.md | 2 +- docs/content/resources/file.directory.md | 2 +- docs/content/resources/file.fetch.md | 2 +- docs/content/resources/file.mode.md | 2 +- docs/content/resources/file.owner.md | 18 +++++++++--------- docs/content/resources/filesystem.md | 2 +- docs/content/resources/lvm.logicalvolume.md | 2 +- docs/content/resources/lvm.volumegroup.md | 2 +- docs/content/resources/module.md | 2 +- docs/content/resources/package.apt.md | 2 +- docs/content/resources/package.rpm.md | 2 +- docs/content/resources/param.md | 2 +- docs/content/resources/task.md | 2 +- docs/content/resources/task.query.md | 2 +- docs/content/resources/user.group.md | 2 +- docs/content/resources/user.user.md | 2 +- docs/content/resources/wait.port.md | 2 +- docs/content/resources/wait.query.md | 2 +- docs/extract.go | 12 ++++++++---- 23 files changed, 38 insertions(+), 34 deletions(-) diff --git a/docs/content/resources/docker.container.md b/docs/content/resources/docker.container.md index 10b6a69fc..977e4d8c6 100644 --- a/docs/content/resources/docker.container.md +++ b/docs/content/resources/docker.container.md @@ -1,7 +1,7 @@ --- title: "docker.container" slug: "docker-container" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/docker.image.md b/docs/content/resources/docker.image.md index 10f3935ec..c35a8c04e 100644 --- a/docs/content/resources/docker.image.md +++ b/docs/content/resources/docker.image.md @@ -1,7 +1,7 @@ --- title: "docker.image" slug: "docker-image" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/docker.network.md b/docs/content/resources/docker.network.md index c344bc85b..b5a36c03c 100644 --- a/docs/content/resources/docker.network.md +++ b/docs/content/resources/docker.network.md @@ -1,7 +1,7 @@ --- title: "docker.network" slug: "docker-network" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/docker.volume.md b/docs/content/resources/docker.volume.md index 04ab589a4..d2388fb46 100644 --- a/docs/content/resources/docker.volume.md +++ b/docs/content/resources/docker.volume.md @@ -1,7 +1,7 @@ --- title: "docker.volume" slug: "docker-volume" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/file.content.md b/docs/content/resources/file.content.md index fa18efa7b..97f877a09 100644 --- a/docs/content/resources/file.content.md +++ b/docs/content/resources/file.content.md @@ -1,7 +1,7 @@ --- title: "file.content" slug: "file-content" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/file.directory.md b/docs/content/resources/file.directory.md index f0fdbd124..19b9af4d0 100644 --- a/docs/content/resources/file.directory.md +++ b/docs/content/resources/file.directory.md @@ -1,7 +1,7 @@ --- title: "file.directory" slug: "file-directory" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/file.fetch.md b/docs/content/resources/file.fetch.md index c0af0c92f..3231b5539 100644 --- a/docs/content/resources/file.fetch.md +++ b/docs/content/resources/file.fetch.md @@ -1,7 +1,7 @@ --- title: "file.fetch" slug: "file-fetch" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/file.mode.md b/docs/content/resources/file.mode.md index 768052f69..3448700fa 100644 --- a/docs/content/resources/file.mode.md +++ b/docs/content/resources/file.mode.md @@ -1,7 +1,7 @@ --- title: "file.mode" slug: "file-mode" -date: "2016-12-19T14:58:57-06:00" +date: "2016-12-22T11:43:14-06:00" menu: main: parent: resources diff --git a/docs/content/resources/file.owner.md b/docs/content/resources/file.owner.md index 416679865..a28c94135 100644 --- a/docs/content/resources/file.owner.md +++ b/docs/content/resources/file.owner.md @@ -1,7 +1,7 @@ --- title: "file.owner" slug: "file-owner" -date: "2016-12-19T11:36:04-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources @@ -11,7 +11,10 @@ menu: Owner sets the file and group ownership of a file or directory. If `recursive` is set to true and `destination` is a directory, then it will also recursively change ownership of all files and subdirectories. Symlinks -are ignored. +are ignored. If the file or directory does not exist during the plan phase +of application the differences will be calculated during application. +Otherwise changes will be limited to the files identified during the plan +phase of application. ## Example @@ -21,7 +24,7 @@ are ignored. new file, then changing the ownership of that file to a different group. */ file.content "to-change" { - destination = "to-change" + destination = "tochange" } task.query "existing-group" { @@ -64,21 +67,21 @@ recursively. Symlinks are not followed. - `uid` (optional int) - Only one of `user` may be set. + Only one of `user` or `uid` may be set. UID specifies user-ownership by UID - `group` (string) - Only one of `gid` may be set. + Only one of `group` or `gid` may be set. Groupname specifies group-ownership by groupname - `gid` (optional int) - Only one of `group` may be set. + Only one of `group` or `gid` may be set. GID specifies group ownership by gid @@ -87,9 +90,6 @@ recursively. Symlinks are not followed. Verbose specifies that when performing recursive updates, a diff should be shown for each file to be changed -- osProxy (OSProxy) - - ## Exported Fields diff --git a/docs/content/resources/filesystem.md b/docs/content/resources/filesystem.md index 7b1d3dd72..5b4868026 100644 --- a/docs/content/resources/filesystem.md +++ b/docs/content/resources/filesystem.md @@ -1,7 +1,7 @@ --- title: "filesystem" slug: "filesystem" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/lvm.logicalvolume.md b/docs/content/resources/lvm.logicalvolume.md index 51de30d0c..f5e38791f 100644 --- a/docs/content/resources/lvm.logicalvolume.md +++ b/docs/content/resources/lvm.logicalvolume.md @@ -1,7 +1,7 @@ --- title: "lvm.logicalvolume" slug: "lvm-logicalvolume" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/lvm.volumegroup.md b/docs/content/resources/lvm.volumegroup.md index 74c4a00c8..2a0cca846 100644 --- a/docs/content/resources/lvm.volumegroup.md +++ b/docs/content/resources/lvm.volumegroup.md @@ -1,7 +1,7 @@ --- title: "lvm.volumegroup" slug: "lvm-volumegroup" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/module.md b/docs/content/resources/module.md index b392b8cec..7efad6d27 100644 --- a/docs/content/resources/module.md +++ b/docs/content/resources/module.md @@ -1,7 +1,7 @@ --- title: "module" slug: "module" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/package.apt.md b/docs/content/resources/package.apt.md index 753f8f3c3..a3fea4f86 100644 --- a/docs/content/resources/package.apt.md +++ b/docs/content/resources/package.apt.md @@ -1,7 +1,7 @@ --- title: "package.apt" slug: "package-apt" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/package.rpm.md b/docs/content/resources/package.rpm.md index ce4bddd58..ba2d49e99 100644 --- a/docs/content/resources/package.rpm.md +++ b/docs/content/resources/package.rpm.md @@ -1,7 +1,7 @@ --- title: "package.rpm" slug: "package-rpm" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/param.md b/docs/content/resources/param.md index 082ea95a4..a2cf20691 100644 --- a/docs/content/resources/param.md +++ b/docs/content/resources/param.md @@ -1,7 +1,7 @@ --- title: "param" slug: "param" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/task.md b/docs/content/resources/task.md index 818027a52..98798d39c 100644 --- a/docs/content/resources/task.md +++ b/docs/content/resources/task.md @@ -1,7 +1,7 @@ --- title: "task" slug: "task" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/task.query.md b/docs/content/resources/task.query.md index 1868690bf..60566c5ef 100644 --- a/docs/content/resources/task.query.md +++ b/docs/content/resources/task.query.md @@ -1,7 +1,7 @@ --- title: "task.query" slug: "task-query" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/user.group.md b/docs/content/resources/user.group.md index 64038d0c6..4185653d2 100644 --- a/docs/content/resources/user.group.md +++ b/docs/content/resources/user.group.md @@ -1,7 +1,7 @@ --- title: "user.group" slug: "user-group" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/user.user.md b/docs/content/resources/user.user.md index 27285db57..9bfe36150 100644 --- a/docs/content/resources/user.user.md +++ b/docs/content/resources/user.user.md @@ -1,7 +1,7 @@ --- title: "user.user" slug: "user-user" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/wait.port.md b/docs/content/resources/wait.port.md index c38e81336..c4a3ad4dc 100644 --- a/docs/content/resources/wait.port.md +++ b/docs/content/resources/wait.port.md @@ -1,7 +1,7 @@ --- title: "wait.port" slug: "wait-port" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/content/resources/wait.query.md b/docs/content/resources/wait.query.md index 2e9142e3e..ee3abcdf3 100644 --- a/docs/content/resources/wait.query.md +++ b/docs/content/resources/wait.query.md @@ -1,7 +1,7 @@ --- title: "wait.query" slug: "wait-query" -date: "2016-12-19T14:58:58-06:00" +date: "2016-12-22T11:43:15-06:00" menu: main: parent: resources diff --git a/docs/extract.go b/docs/extract.go index d3f25cce5..eea4f02f7 100644 --- a/docs/extract.go +++ b/docs/extract.go @@ -212,13 +212,13 @@ func (e *ExportExtractor) Visit(node ast.Node) (w ast.Visitor) { } return e case *ast.Field: - typ := stringify(n.Type, "") - doc := (&TypeExtractor{}).Docs(n.Doc, n.Comment) - - if n.Names == nil { + if n.Names == nil || !ast.IsExported(n.Names[0].String()) { return e } + typ := stringify(n.Type, "") + doc := (&TypeExtractor{}).Docs(n.Doc, n.Comment) + field := &Field{ Name: n.Names[0].String(), Type: typ, @@ -314,6 +314,10 @@ func (te *TypeExtractor) Visit(node ast.Node) (w ast.Visitor) { return te case *ast.Field: + if !ast.IsExported(n.Names[0].String()) { + return te + } + typ := stringify(n.Type, "optional") doc := te.Docs(n.Doc, n.Comment) if strings.Contains(typ, "duration") {