Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Symlinks

Dmitry Shevtsov edited this page Sep 29, 2020 · 4 revisions

DevDocs uses symlinks to inherit content from a previous minor version for topics that have not been affected by new releases. For example, src/guides/v2.4/hello-world.md file can be a symlink of the src/guides/v2.3/hello-world.md. So that any changes in the 2.3 version of the topic would automatically be applied to the 2.4 version of the topic.

To help with managing symlink files, DevDocs has implemented helper rake tasks. You can list them using the rake -D symlink command:

rake symlink:create_from
    Create a 2.4 symlink from the corresponding 2.3 file. Example: rake symlink:create_from path=src/guides/v2.3/release-notes/packages-cloud.md

rake symlink:replace_at
    Replace a 2.4 symlink with a copy of the 2.3 file. Example: rake symlink:replace_at path=src/guides/v2.4/release-notes/packages-cloud.md

The commands have to be run at the root folder of the project. If you need to find out whether a file is a symlink, you can use command line tools such as realpath

~/Projects/repos/magento/devdocs (master)$ realpath src/guides/v2.4/release-notes/packages-cloud.md
../Projects/repos/magento/devdocs/src/guides/v2.4/release-notes/packages-cloud.md

or ls -l with a relative path to the directory where the file is located

~/Projects/repos/magento/devdocs (master)$ ls -l src/guides/v2.4/
total 0
drwxr-xr-x   7 dmytroshevtsov  staff   224 Jul  7 17:24 advanced-reporting
drwxr-xr-x  10 dmytroshevtsov  staff   320 Jul  8 14:43 architecture
drwxr-xr-x  21 dmytroshevtsov  staff   672 Jul  7 17:24 b2b
lrwxr-xr-x   1 dmytroshevtsov  staff    33 Jul  7 17:24 bk-get-started-magento.md -> ../v2.3/bk-get-started-magento.md
drwxr-xr-x  13 dmytroshevtsov  staff   416 Jul  7 17:24 coding-standards
drwxr-xr-x   9 dmytroshevtsov  staff   288 Jul  8 14:47 comp-mgr
...

In the above example, bk-get-started-magento.md is a symlink of the ../v2.3/bk-get-started-magento.md file.