Add yard to generate Ruby code documentation

This commit is contained in:
Gabriel Mazetto 2021-08-24 04:44:29 +00:00 committed by Balasankar 'Balu' C
parent 77e3c77224
commit b774a14b4d
5 changed files with 41 additions and 19 deletions

2
.gitignore vendored
View File

@ -23,6 +23,8 @@ public/*
config/projects/simple.rb
.markdownlintrc
.DS_Store
.yardoc
yard
# These are created during a package build. We do not want to commit them
.yarn-cache

1
.yardopts Normal file
View File

@ -0,0 +1 @@
yardoc -o yard --no-private --protected lib/**/*.rb files/gitlab-cookbooks/**/*.rb files/gitlab-ctl-commands/**/*.rb files/gitlab-ctl-commands-ee/**/*.rb - README.md CONTRIBUTING.md LICENSE CHANGELOG.md

View File

@ -34,6 +34,7 @@ gem 'http'
gem 'aws-sdk-ec2'
gem 'aws-sdk-marketplacecatalog'
gem 'gitlab'
gem 'yard'
group :packagecloud, optional: true do
gem 'package_cloud'

View File

@ -424,6 +424,7 @@ GEM
winrm (~> 2.0)
wisper (2.0.1)
wmi-lite (1.0.5)
yard (0.9.26)
zeitwerk (2.4.2)
zhexdump (0.0.2)
@ -454,6 +455,7 @@ DEPENDENCIES
rspec-parameterized
rspec_junit_formatter
thor (= 0.18.1)
yard
BUNDLED WITH
2.2.15

View File

@ -4,6 +4,16 @@
#############
# Templates #
#############
.com-docs-except-triggers: &com-docs-except-triggers
except:
refs:
- /./@gitlab/omnibus-gitlab
- triggers
- /^deps/
- /./@gitlab-org/build/omnibus-gitlab-mirror
variables:
- $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING
- $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/
.com-except-triggers: &com-except-triggers
except:
@ -250,15 +260,7 @@ docs-lint markdown:
- vale --minAlertLevel error doc
# Lint Markdown
- markdownlint --config .markdownlint.yml 'doc/**/*.md'
except:
refs:
- /./@gitlab/omnibus-gitlab
- triggers
- /^deps/
- /./@gitlab-org/build/omnibus-gitlab-mirror
variables:
- $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING
- $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/
<<: *com-docs-except-triggers
# Perform link checks on published HTML files
docs-lint links:
@ -277,15 +279,26 @@ docs-lint links:
- bundle exec nanoc check internal_links
# Check the internal anchor links
- bundle exec nanoc check internal_anchors
except:
refs:
- /./@gitlab/omnibus-gitlab
- triggers
- /^deps/
- /./@gitlab-org/build/omnibus-gitlab-mirror
variables:
- $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING
- $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/
<<: *com-docs-except-triggers
yard:
extends: .gems-cache
image: "${RUBY_IMAGE}"
stage: check
needs: []
before_script:
# These jobs will not be run on dev, so we set ALTERNATIVE_SOURCES to true
# so tests run fine on forks
- export ALTERNATIVE_SOURCES="true";
- *install-gems
script:
- bundle exec yardoc
<<: *com-docs-except-triggers
artifacts:
expire_in: 1 week
paths:
- yard/*
# Trigger a docs build in gitlab-docs
# Useful to preview the docs changes live
@ -604,12 +617,15 @@ validate_packer_changes:
##############################
pages:
image: "${PUBLIC_BUILDER_IMAGE_REGISTRY}/ubuntu_16.04:${BUILDER_IMAGE_REVISION}"
image: "${PUBLIC_BUILDER_IMAGE_REGISTRY}/ubuntu_20.04:${BUILDER_IMAGE_REVISION}"
stage: prepare
needs:
- yard
script:
- bundle exec rake license:generate_pages
- mv ${LICENSE_S3_BUCKET} public
- cp support/webpages/* public
- cp yard/* public
artifacts:
paths:
- public