#!/bin/bash # Copyright 2014 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This file is not intended to be run automatically. It is meant to be run # immediately before exporting docs. We do not want to check these documents in # by default. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." source "$(KUBE_ROOT)/hack/lib/init.sh" kube::golang::setup_env global BINS := '( 'cmd/gendocs cmd/genkubedocs cmd/genman cmd/genyaml federation/cmd/genfeddocs ) make -C $(KUBE_ROOT) WHAT="$(BINS[*])" kube::util::ensure-temp-dir kube::util::gen-docs $(KUBE_TEMP) # remove all of the old docs kube::util::remove-gen-docs # Copy fresh docs into the repo. # the shopt is so that we get docs/.generated_docs from the glob. shopt -s dotglob cp -af "$(KUBE_TEMP)"/* $(KUBE_ROOT) shopt -u dotglob # Replace with placeholder docs kube::util::set-placeholder-gen-docs (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [74 82] ) (/..) } spids: [73] ) ] spids: [73] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (golang) (Lit_Other ":") (Lit_Other ":") (setup_env)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BINS) op: Equal rhs: { (ArrayLiteralPart words: [ {(cmd/gendocs)} {(cmd/genkubedocs)} {(cmd/genman)} {(cmd/genyaml)} {(federation/cmd/genfeddocs)} ] ) } spids: [104] ) ] spids: [104] ) (C {(make)} {(-C)} {(DQ (${ VSub_Name KUBE_ROOT))} {(Lit_VarLike "WHAT=") (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Arith_Star) spids: [136 141] ) ) } ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (ensure-temp-dir)} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (gen-docs)} {(DQ (${ VSub_Name KUBE_TEMP))} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (remove-gen-docs)} ) (C {(shopt)} {(-s)} {(dotglob)}) (C {(cp)} {(-af)} {(DQ (${ VSub_Name KUBE_TEMP)) (/) (Lit_Other "*")} {(DQ (${ VSub_Name KUBE_ROOT))}) (C {(shopt)} {(-u)} {(dotglob)}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (util) (Lit_Other ":") (Lit_Other ":") (set-placeholder-gen-docs) } ) ] )