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 config/projects/simple.rb
.markdownlintrc .markdownlintrc
.DS_Store .DS_Store
.yardoc
yard
# These are created during a package build. We do not want to commit them # These are created during a package build. We do not want to commit them
.yarn-cache .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-ec2'
gem 'aws-sdk-marketplacecatalog' gem 'aws-sdk-marketplacecatalog'
gem 'gitlab' gem 'gitlab'
gem 'yard'
group :packagecloud, optional: true do group :packagecloud, optional: true do
gem 'package_cloud' gem 'package_cloud'

View File

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

View File

@ -4,6 +4,16 @@
############# #############
# Templates # # 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 .com-except-triggers: &com-except-triggers
except: except:
@ -250,15 +260,7 @@ docs-lint markdown:
- vale --minAlertLevel error doc - vale --minAlertLevel error doc
# Lint Markdown # Lint Markdown
- markdownlint --config .markdownlint.yml 'doc/**/*.md' - markdownlint --config .markdownlint.yml 'doc/**/*.md'
except: <<: *com-docs-except-triggers
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]+$/
# Perform link checks on published HTML files # Perform link checks on published HTML files
docs-lint links: docs-lint links:
@ -277,15 +279,26 @@ docs-lint links:
- bundle exec nanoc check internal_links - bundle exec nanoc check internal_links
# Check the internal anchor links # Check the internal anchor links
- bundle exec nanoc check internal_anchors - bundle exec nanoc check internal_anchors
except: <<: *com-docs-except-triggers
refs:
- /./@gitlab/omnibus-gitlab yard:
- triggers extends: .gems-cache
- /^deps/ image: "${RUBY_IMAGE}"
- /./@gitlab-org/build/omnibus-gitlab-mirror stage: check
variables: needs: []
- $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING before_script:
- $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/ # 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 # Trigger a docs build in gitlab-docs
# Useful to preview the docs changes live # Useful to preview the docs changes live
@ -604,12 +617,15 @@ validate_packer_changes:
############################## ##############################
pages: 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 stage: prepare
needs:
- yard
script: script:
- bundle exec rake license:generate_pages - bundle exec rake license:generate_pages
- mv ${LICENSE_S3_BUCKET} public - mv ${LICENSE_S3_BUCKET} public
- cp support/webpages/* public - cp support/webpages/* public
- cp yard/* public
artifacts: artifacts:
paths: paths:
- public - public