Commit a81717ae authored by Thomas Boni's avatar Thomas Boni
Browse files

Merge branch '337-job-apidoc-add-options-in-apidoc-job' into 'latest'

Resolve "[job][apidoc] Add options in apidoc job"

Closes #337

See merge request r2devops/hub!194
parents c9f037c3 8ead1022
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -276,3 +276,5 @@ Vue
vue
wordlists
Wordlists
unhandled
Unhandled
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
@@ -28,10 +28,14 @@ code using [apiDoc](https://apidocjs.com/){:target="_blank"}.

| Name | Description | Default |
| ---- | ----------- | ------- |
| `APIDOC_VERSION` <img width=250/> | Version of apiDoc to use <img width=400/> | `0.24.0` |
| `APIDOC_VERSION` <img width=250/> | Version of apiDoc to use <img width=400/> | `0.27.1` |
| `APIDOC_CONFIG_PATH` | Path to config file or to directory containing config file (apidoc.json or apidoc.config.js) | `.` |
| `APIDOC_OUTPUT_PATH` | Output directory path | `website_build/` |
| `APIDOC_TEMPLATE_PATH` | Path to template folder | `/usr/lib/node_modules/apidoc/template/` |
| `APIDOC_SOURCE_PATH` | Path to analyzed folder  | ` ` |
| `APIDOC_INCLUDE_FILTER` | Regex to include specific files | ` ` |
| `APIDOC_EXCLUDE_FILTER` | Regex to exclude specific files | ` ` |
| `APIDOC_OPTIONS` | Additional options | ` ` |

### Artifacts

+14 −3
Original line number Diff line number Diff line
@@ -12,10 +12,21 @@ apidoc:
    APIDOC_CONFIG_PATH: '.'
    APIDOC_OUTPUT_PATH: 'website_build/'
    APIDOC_TEMPLATE_PATH: '/usr/local/lib/node_modules/apidoc/template/'
    APIDOC_VERSION: '0.24.0'
    APIDOC_VERSION: '0.27.1'
    APIDOC_SOURCE_PATH: ""
    APIDOC_INCLUDE_FILTER: ""
    APIDOC_EXCLUDE_FILTER: ""
    APIDOC_OPTIONS: ""
  script:
    - npm install apidoc@$APIDOC_VERSION -g
    - apidoc --verbose -c "$APIDOC_CONFIG_PATH" -o "$APIDOC_OUTPUT_PATH" -t "$APIDOC_TEMPLATE_PATH"
    # Conditions are necessary as if $filters are empty apidoc
    # don't find any files (exclude everything)
    - if [ ! -z "$APIDOC_INCLUDE_FILTER" ]; then APIDOC_OPTIONS="-f $APIDOC_INCLUDE_FILTER $APIDOC_OPTIONS"; fi
    - if [ ! -z "$APIDOC_EXCLUDE_FILTER" ]; then APIDOC_OPTIONS="-e $APIDOC_EXCLUDE_FILTER $APIDOC_OPTIONS"; fi
    - |
      apidoc --verbose -c "$APIDOC_CONFIG_PATH" -o "${CI_PROJECT_DIR}/${APIDOC_OUTPUT_PATH}" \
      -t "$APIDOC_TEMPLATE_PATH" -i "${CI_PROJECT_DIR}/${APIDOC_SOURCE_PATH}" \
      ${APIDOC_OPTIONS}
  artifacts:
    when: always
    expose_as: "apiDoc build"
+5 −0
Original line number Diff line number Diff line
* Add `APIDOC_SOURCE_PATH` variable
* Add `APIDOC_INCLUDE_FILTER` variable
* Add `APIDOC_EXCLUDE_FILTER` variable
* Add `APIDOC_OPTIONS` variable
* Upgrade `APIDOC_VERSION` default value
 No newline at end of file