diff --git a/.github/workflows/check-code-embedding.yml b/.github/workflows/check-code-embedding.yml deleted file mode 100644 index 2d5a46fdd..000000000 --- a/.github/workflows/check-code-embedding.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Check Code Embedding - -on: - push: - branches: - - all - pull_request: - branches: - - master - -jobs: - - build-embedded-code: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: zulu - - - run: ./gradlew :buildAll - - check-embedded-samples: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.4' - - # Bundler version is restricted to `2.4.22`, - # as we want to use Ruby `2.7.4` to match GH Pages environment. - # - # Any newer versions of Bundler require Ruby 3.x, - # which are much newer than what's GH Pages has at the moment. - # - - run: | - gem install bundler -v 2.4.22 - bundle install - - - name: Check Embedding - run: ./_script/check-samples diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 000000000..54eb7f6da --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,67 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + +env: + HUGO_VERSION: 0.147.8 + GH_USER: site-commons-machine-user + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_SITE_COMMONS_PAT }} + submodules: true + fetch-depth: 0 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: ${{ env.HUGO_VERSION }} + extended: true + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Cache Hugo Modules + uses: actions/cache@v4 + with: + path: /tmp/hugo_cache + key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-hugomod- + + - name: Prepare Environment + run: git config --global url."https://${{ env.GH_USER }}:${{ secrets.GH_SITE_COMMONS_PAT }}@github.com".insteadOf "https://github.com" + + - name: Install Dependencies + working-directory: site + run: npm ci + + - name: Build Spine + working-directory: site + run: hugo --minify + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: ./site/public diff --git a/.github/workflows/proof-links.yml b/.github/workflows/proof-links.yml index f6e8df675..502dd8b4d 100644 --- a/.github/workflows/proof-links.yml +++ b/.github/workflows/proof-links.yml @@ -1,37 +1,113 @@ name: Proof Links +on: [pull_request, workflow_dispatch] -on: - push: - branches: - - master - pull_request: - branches: - - master +env: + HUGO_VERSION: 0.147.8 + GH_USER: site-commons-machine-user + LYCHEE_RELEASE: "lychee-v0.15.1-x86_64-unknown-linux-gnu.tar.gz" + LYCHEE_VERSION_TAG: "v0.15.1" jobs: proof-links: runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: ${{ env.HUGO_VERSION }} + extended: true + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Cache Hugo Modules + uses: actions/cache@v4 + with: + path: /tmp/hugo_cache + key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-hugomod- + + - name: Prepare environment + run: git config --global url."https://${{ env.GH_USER }}:${{ secrets.GH_SITE_COMMONS_PAT }}@github.com".insteadOf "https://github.com" + + - name: Install Dependencies + working-directory: site + run: npm ci + + - name: Build Spine + working-directory: site + run: hugo -e development + + # Cache Lychee results to avoid hitting rate limits. + - name: Cache Lychee results + uses: actions/cache@v4 with: - submodules: 'recursive' + path: .lycheecache + key: cache-lychee-results - - name: Set up Ruby and Bundler - uses: ruby/setup-ruby@v1 + - name: Cache Lychee executable + id: cache-lychee + uses: actions/cache@v4 with: - ruby-version: '2.7.4' - - # Bundler version is restricted to `2.4.22`, - # as we want to use Ruby `2.7.4` to match GH Pages environment. - # - # Any newer versions of Bundler require Ruby 3.x, - # which are much newer than what's GH Pages has at the moment. - # - - name: Run Jekyll build + path: lychee + key: ${{ runner.os }}-${{ env.LYCHEE_RELEASE }} + + # We use Lychee directly instead of a GitHub Action because it + # must have access the local Hugo server, which is not visible + # from the Docker-based action. + - name: Download Lychee executable + uses: robinraju/release-downloader@v1.7 + if: steps.cache-lychee.outputs.cache-hit != 'true' + with: + repository: "lycheeverse/lychee" + tag: ${{ env.LYCHEE_VERSION_TAG }} + fileName: ${{ env.LYCHEE_RELEASE }} + + - name: Extract Lychee executable + if: steps.cache-lychee.outputs.cache-hit != 'true' run: | - gem install bundler -v 2.4.22 - bundle install - bundle exec jekyll build + mkdir -p lychee && + tar -xf ${{ env.LYCHEE_RELEASE }} -C lychee - - name: Proof Links - run: ./_script/proof-links + # 1. In the generated HTML, some inner links will have absolute URLs and + # the link checker will attempt to fetch them. That's why we need + # a server. Sadly, link checkers have no settings to address this. + # 2. Output redirection is necessary for nohup in GitHub Actions. + # 3. Sleep makes sure the server is up before the next step. + - name: Start Hugo server + working-directory: site + run: | + nohup hugo server \ + --environment development \ + > nohup.out 2> nohup.err < /dev/null & + sleep 5 + + - name: Check if the cache file exists + run: | + if [ -f ".lycheecache" ]; then + echo "Lychee cache exists." + else + echo "No lychee cache file." + fi + + - name: Check links + run: | + ./lychee/lychee --config lychee.toml --timeout 60 \ + --base http://localhost:1313/ \ + 'site/public/**/*.html' diff --git a/.gitignore b/.gitignore index 9a43667a0..6b29beb2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,21 @@ -# The result of Jekyll build -_site/ +# Hugo cache files +/site/resources +public -# Intermediate directory used by `embed-code` Jekyll subcommand -.fragments +# Cache folder for Hugo Modules +/site/_vendor -.sass-cache -.jekyll-metadata -.DS_Store +# Node modules +node_modules -*/build/ +# Used to control concurrency between multiple Hugo instances +/site/.hugo_build.lock -**/*.jar +# Needed for navigation help inside code editors +jsconfig.json -# Do not ignore the Gradle Wrapper at the top level and in the sub-projects that are -# added as included builds. See `settings.gradle.kts` for details. -!**/gradle/wrapper/* +# The temporary Lychee cache obtained from local check +.lycheecache # IntelliJ IDEA modules and interim config files *.iml @@ -29,6 +30,8 @@ _site/ !.idea/codeStyles/ !.idea/copyright/ +.DS_Store + # Gradle interim configs .gradle/ diff --git a/.gitmodules b/.gitmodules index 598b1b9fe..81c04cfe6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,3 @@ [submodule "_code/examples/todo-list"] path = _code/examples/todo-list url = https://github.com/spine-examples/todo-list -[submodule "_code/config"] - path = config - url = https://github.com/SpineEventEngine/config -[submodule "_docs"] - path = _docs - url = https://github.com/SpineEventEngine/documentation.git diff --git a/AUTHORING.md b/AUTHORING.md index 7d8573deb..3e1375eeb 100644 --- a/AUTHORING.md +++ b/AUTHORING.md @@ -2,83 +2,87 @@ Content Author Guide ======== This document is a guide for adding content to the [spine.io](https://spine.io) site. -**Table of Contents** -- [Using URLs in Markdown](#using-urls-in-markdown) - + [Links to Blog Posts](#links-to-blog-posts) - - [Rule 1 -- Always concatenate Jekyll and Liquid tags](#rule-1----always-concatenate-jekyll-and-liquid-tags) - - [Rule 2 -- *(Almost)* Always start links with `{{ site.baseurl }}`](#rule-2----almost-always-start-links-with--sitebaseurl-) - - [Rule 3 -- Always use a trailing slash after `{{ site.baseurl }}`](#rule-3----always-use-a-trailing-slash-after--sitebaseurl-) -- [Adding collapsible list for sidebar navigation](#adding-collapsible-list-for-sidebar-navigation) -- [Adding code samples to the site](#adding-code-samples-to-the-site) -- [Testing broken links](#testing-broken-links) -- [Adding email links](#adding-email-links) -- [Managing the “Prev”/“Next” buttons in the documentation](#managing-the-prevnext-buttons-in-the-documentation) -- [Using a language switcher for source code samples](#using-a-language-switcher-for-source-code-samples) +**Table of Contents** +* [Using URLs](#using-urls) + * [URLs in markdown](#urls-in-markdown) + * [Rule 1](#rule-1----all-internal-links-must-not-start-with-a-slash) + * [Rule 2](#rule-2----each-link-should-end-with-a-slash-to-prevent-unnecessary-redirects) + * [Images](#images) + * [URLs in HTML](#urls-in-html) +* [Navigation](#navigation) + * [Main navigation](#main-navigation) + * [Documentation side navigation](#documentation-side-navigation) + * [Documentation “Next/Prev” buttons](#documentation-nextprev-buttons) + * [Adding code samples to the site](#adding-code-samples-to-the-site) +* [Testing broken links](#testing-broken-links) + * [Cloak email](#cloak-email) + * [Note blocks](#note-blocks) Table of contents generated with markdown-toc -# Using URLs in Markdown +# Using URLs -### Links to Blog Posts +To refer to another page, image, or asset in the Spine documentation, +use relative URLs. The site domain and documentation version are added automatically. -There are thee rules to follow: +### URLs in markdown -#### Rule 1 -- Always concatenate Jekyll and Liquid tags +There are two rules to follow: -| Good | Bad | -|-------------------------------------------|--------------------------------------------| -| `href="{{ site.baseurl }}{{ post.url }}"` | `href="{{ site.baseurl }}/{{ post.url }}"` | +#### Rule 1 -- All internal links **must not** start with a slash. -This removes the double-slash from your site's URLs. +| Good | Bad | +|--------------------------------------|--------------------------------------| +| `[Introduction](docs/introduction/)` | `[Introduction](/docs/introduction/)`| -#### Rule 2 -- *(Almost)* Always start links with `{{ site.baseurl }}` +#### Rule 2 -- Each link should **end with a slash** to prevent unnecessary redirects. -| Good | Bad | -|-------------------------------------------|-------------------------| -| `href="{{ site.baseurl }}{{ post.url }}"` | `href="{{ post.url }}"` | +| Good | Bad | +|--------------------------------------|-------------------------------------| +| `[Introduction](docs/introduction/)` | `[Introduction](/docs/introduction)`| -This fixes almost all of the in-site links. The next rule covers the remainder. +### Images -**Exception**: Start hyperlinks with `{{ site.url }}{{ site.baseurl }}` in feed pages, like `atom.xml`. +To render an image in markdown use: -#### Rule 3 -- Always use a trailing slash after `{{ site.baseurl }}` - -| Good | Bad | -|-------------------------------------------|------------------------------------------| -| `href="{{ site.baseurl }}/" title="Home"` | `href="{{ site.baseurl }}" title="Home"` | - -| Good | Bad | -|------------------------------------------------|-----------------------------------------------| -| `href="{{ site.baseurl }}/public/favicon.ico"` | `href="{{ site.baseurl }}public/favicon.ico"` | +```markdown +![Image alt](img/articles/test.webp) +``` +Use anchors to specify image size: `#medium`, `#small`: -Visit [Configuring Jekyll for Project GitHub Pages and for User GitHub Pages](http://downtothewire.io/2015/08/15/configuring-jekyll-for-user-and-project-github-pages/) if you want to know why these rules should be followed. +```markdown +![Image alt](img/articles/test.webp#medium)` +``` -### URL rules +### URLs in HTML -All these URLs lead to the same page: `/docs`, `/docs/`, `/docs/index`, `/docs/index.html`. -But if you use them all throughout the site, it will create problems for search crawlers. +When working with layout partials, URLs should be specified using the following syntax: -Please stick to these rules for using links on the site. +```html +Requirements +``` -#### Use a trailing slash to refer to the directory containing the `index.html` file +```html + +``` -| Good | Bad | -|-----------------------------------------------|----------------------------------------------------| -|`{{ site.baseurl }}/docs/introduction/` | `{{ site.baseurl }}/docs/introduction/index` | +# Navigation -#### Drop the `.html` suffix. This will simplify the URL +### Main navigation -| Good | Bad | -|-----------------------------------------------|----------------------------------------------------| -|`{{ site.baseurl }}/docs/introduction/rules` | `{{ site.baseurl }}/docs/introduction/rules.html` | +To edit navigation items, modify `site/data/navbar.yml`. +The navigation template is located at `site/layouts/_partials/components/navbar/navigation.html`. +### Documentation side navigation -# Adding collapsible list for sidebar navigation +The documentation side navigation can be edited in the [SpineEventEngine/documentation](https://github.com/SpineEventEngine/documentation) +repository in the `docs/data/docs//sidenav.yml` file. -For collapsible categories we use the Bootstrap [Collapse](https://getbootstrap.com/docs/4.5/components/collapse/) component. +### Documentation “Next/Prev” buttons -For instructions on adding or changing sidebar navigation, please see the [Navigation Author Guide](_data/navigation/NAVIGATION.md). +The “Prev”/“Next” buttons are generated automatically for all document pages. +The implementation is inside the [SpineEventEngine/documentation](https://github.com/SpineEventEngine/documentation). # Adding code samples to the site @@ -86,172 +90,69 @@ Please see [this document](_code/EMBEDDING.md) for the instructions. # Testing broken links -We use the [html-proofer](https://github.com/gjtorikian/html-proofer) tool to test broken links. -To start test locally you may be required to install the Gem of the tool first: +We use the [Lychee](https://github.com/lycheeverse/lychee) tool to test broken links. +To start test locally you may be required to [install the tool](https://github.com/lycheeverse/lychee?tab=readme-ov-file#installation). -```bash -bundle install -``` -... and then build the site: +Then navigate to the `site` directory and run the site locally ```bash -jekyll build +hugo server ``` -After that, please use the following command: +Make sure it runs on port `1313`. + +To test broken links, run following command from the root of the project: ```bash ./_script/proof-links ``` > We only log errors falling within the 4xx status code range. -> Please note that links to GitHub are ignored by --http-status-ignore "429" command, because GitHub rejects the check -> coming from htmlproofer. Details of this are described in [this issue](https://github.com/gjtorikian/html-proofer/issues/226). - -Also, we have a GitHub Action which tests the links when the pull request is created to the `master`. -Please see the [`.github/workflows/proof-links.yml`](.github/workflows/proof-links.yml) file for details. +> Please note that some of the links are added to excludes in the [`lychee.toml`](lychee.toml) file. -# Adding email links +Also, we have a GitHub Action which tests the links when a pull request is created. +Please see the [`.github/workflows/proof-links.yml`](.github/workflows/proof-links.yml) +file for details. -We use the [Jekyll Email Protect](https://github.com/vwochnik/jekyll-email-protect) to protect our -email addresses from spam bots. We store all email variables in the `_data/support.yml` file. +# Cloak email -### In HTML -``` -{{ 'example@example.com' | html_encode_email }} -``` +The `cloakemail` shortcode is used to cloak emails or phone numbers from +spamming bots. We store all email variables in the `site/data/spine.yml` file. -Or through a variable: -``` -{{ site.data.support.email | html_encode_email }} -``` +In markdown files, use the shortcode with a provided variable from a data file, for example: -The above code will yield: -``` -%65%78%61%6D%70%6C%65@%65%78%61%6D%70%6C%65.%63%6F%6D +```markdown +{{< cloakemail address_variable="spine.sales_email" >}} ``` -### In Markdown -In markdown files we cannot obfuscate the link text, so it would be safer to use something like `Contact us`. -``` -[{{ Contact us }}](mailto:{{ site.data.support.email | encode_email }}) -``` +or with the display text: -The above code will yield: -``` -Contact us +```markdown +{{< cloakemail address_variable="spine.sales_email" display="Contact us" >}} ``` -# Managing the “Prev”/“Next” buttons in the documentation +# Note blocks -The “Prev”/“Next” buttons are generated automatically for all document pages. The generation is -based on the [`doc_side_nav.yml`](_data/navigation/doc_side_nav.yml) navigation. +To add a note block with additional styles in markdown files, +use the predefined `note-block` shortcode. -To customize the automatically added “Prev”/“Next” buttons, add the appropriate variables to -the **front matter** block of the document page. +```markdown +{{% note-block class="note" %}} +This is some dummy text to show how a note block can look. Check this +[example link to guides][test-url] to see how links appear inside the block. -### To hide the “Previous” or “Next” button: +You can add more lines or even lists: +- First item. +- Second item. +{{% /note-block %}} -``` -prev_btn: false +[test-url]: docs/guides/ ``` -``` -next_btn: false -``` - -### To customize the “Previous” or “Next” button name: -``` -prev_btn: - page: Development Process Overview -``` +You can use only predefined classes such as: `note`, `warning`, or `lead`. +```markdown +{{% note-block class="lead" %}} +The test lead block. +{{% /note-block %}} ``` -next_btn: - page: Development Process Overview -``` - -### To customize the “Previous” or “Next” button name and URL: -``` -prev_btn: - page: Development Process Overview - url: /docs/introduction/ -``` - -``` -next_btn: - page: Architecture Overview - url: /docs/introduction/architecture.html -``` - -**Related files:** -- `_includes/doc-next-prev-nav.html` - the navigation template with the automatic button generation; -- `_sass/modules/_doc-next-prev-nav.scss` - navigation styles; -- `_layouts/docs.html` - the documentation layout where the `doc-next-prev-nav` is included. - -# Using a language switcher for source code samples - -The switch state will be saved globally so that the user can navigate between pages. - -### Usage - -To show language tabs use the structure below. -Add a `lang` attribute with `Java`, `Kotlin`, `JavaScript` or any other language value -for `div`s with content. If no language is provided, the content will not be displayed. -``` -
-
- Any Java content here -
-
- Any Kotlin content here -
-
- Any JavaScript content here -
-
-``` - -In **markdown**, all tags should be left-aligned. This way, the blocks -of code will not be broken: - -``` -
-
-Any Java content here -
-
-Any Kotlin content here -
-
-Any JavaScript content here -
-
-``` - -If you don't need to display the tabs, but only need to show a specific paragraph of text -or change the title depending on the language, just use this: -``` -
-# Getting started with Spine in Java -
- -
-# Getting started with Spine in Kotlin -
-``` - -To change only some of the words in a sentence, use the `` tag with the `.inline` class: -``` -A minimal client-server application in -Java -Kotlin -which handles one command to print some text... -``` - -**Related files** - -The files are stored in the [`documentation`](https://github.com/SpineEventEngine/documentation) -repository. -- `_sass/base/_code-tabs.scss` - styles for the code tabs; -- `tools/code-tabs.js` - code tab implementation. diff --git a/README.md b/README.md index 8972fc7c7..645735be3 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,109 @@ spine.io site ====== + This repository contains the code of the [spine.io](https://spine.io) site. -It is based on [Jekyll](https://jekyllrb.com/) and is hosted on +It is based on [Hugo](https://gohugo.io/) and is hosted on [GitHub Pages](https://pages.github.com/). This project is two-headed: - * It is a Ruby project because of Jekyll. + * It is a Hugo project. * It is a Gradle project to for checking the source code embedded to the site. The code samples used on the site and in the framework documentation are added using -the [`embed-code`](https://github.com/SpineEventEngine/embed-code) Jekyll subcommand. +the [`embed-code`][embed-code] tool (Go version). -The code resides under the `_code` directory. For instructions on embedding the code into the pages, -please see the [`_code/EMBEDDING.md`](_code/EMBEDDING.md) file. +The code resides under the `_code` directory. For instructions on embedding the code +into the pages, please see the [`_code/EMBEDDING.md`](_code/EMBEDDING.md) file. -# Prerequisites +## Prerequisites - 1. Install Ruby 2.7 (as it's the latest version [supported by GitHub Pages](https://pages.github.com/versions/)). - 2. Install the `bundler` tool. - 3. Install the project dependencies by running `bundle install`. - -Now you should be able to run the site locally. +1. Install [Java JDK] version `11` to build the site. +2. Install [Go][go] at least version `1.12`. +2. Install [Node.js][nodejs]. Its version should be `18+`. +3. Install [Hugo Extended][hugo-quick-start] at least version `v0.145` or higher. +4. Get access to the [`site-commons`][site-commons] repository from the admins + to be able to download the theme. +5. Make sure [SSH][site-commons-ssh] is configured correctly and the passphrase is stored in the keychain. +6. Install project dependencies from the `site` directory by running `npm install`. -# Running the site locally +## Running the site locally To build and launch the site on the local server: ``` ./gradlew :runSite ``` + To build the site without running the server: ``` ./gradlew :buildSite ``` -If you experience issues with this step, please check out -the [Troubleshooting Guide](TROUBLESHOOTING.md). -# Documentation +Another way to run the site locally is to follow these steps: + +1. Navigate to the `site` folder. +2. Start the local server with this command: + + ```shell + hugo server + ``` + +## Documentation -The documentation is located in a [separate repository](https://github.com/SpineEventEngine/documentation.git). -It is added to this site as a Git submodule. +The documentation is located in a [separate repository][documentation-repo]. +It is added to this site as a Hugo Module. -Any changes to the documentation must be made in its own -[repository](https://github.com/SpineEventEngine/documentation.git). +Any changes to the documentation must be made in its own [repository][documentation-repo]. The `documentation` repository is made to be self-sustainable in terms of editing. A fully-fledged -Jekyll site has been set up for it. All the contents and links in it are working as intended. +Hugo site has been set up for it. All the contents and links in it are working as intended. It allows making changes to it more convenient for authors. -However, to make it all possible, the `documentation` repository has its own `docs` folder — -otherwise, all links would be broken. Therefore, to avoid any confusion, the submodule -in this “main” repository is named `_docs`. +In terms of building the “main” site, the [Hugo Modules][hugo-modules] +are used to embed the content. -In terms of building the “main” site, the [Jekyll collections](https://jekyllrb.com/docs/step-by-step/09-collections/) -are used to embed the contents of the `_docs` submodule. +### Steps to get documentation updates -### Steps to get updates -1. Update submodules: -``` -git submodule update --remote -``` +1. Navigate to the `site` directory. +2. Clean the module cache: -2. Add any new files pulled from the repository: -``` -git add . -``` + ```shell + hugo mod clean + ``` -3. Perform a commit and push back to origin to rebuild the site. +3. Get the documentation Hugo Module: + + ```shell + hugo mod get -u github.com/SpineEventEngine/documentation/docs + ``` + +4. Commit and push changes from `go.mod` and `go.sum` files. + In the `go.sum` file keep only two last records to avoid file cluttering. + +## Common theme + +This project uses the [`site-commons`][site-commons] Hugo theme for general components such +as anchor icons, snackbars, etc. + +1. Navigate to the `site` directory. +2. To get theme updates, run: + + ```shell + hugo mod get -u github.com/TeamDev-Ltd/site-commons + ``` + +3. Commit and push changes from `go.mod` and `go.sum` files. + In the `go.sum` file keep only two last records to avoid file cluttering. # Authoring For instructions on adding the content to the site, please see the [`AUTHORING.md`](AUTHORING.md) file. + +[go]: https://go.dev/doc/install +[nodejs]: https://nodejs.org/en/download/current +[hugo-quick-start]: https://gohugo.io/getting-started/quick-start/#step-1-install-hugo +[site-commons]: https://github.com/TeamDev-Ltd/site-commons +[site-commons-ssh]: https://github.com/TeamDev-Ltd/site-commons/tree/master?tab=readme-ov-file#configure-go-to-use-ssh-for-github +[hugo-modules]: https://gohugo.io/hugo-modules/introduction +[embed-code]: https://github.com/SpineEventEngine/embed-code/tree/embed-code-go +[documentation-repo]: https://github.com/SpineEventEngine/documentation.git diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md deleted file mode 100644 index 7cf86d758..000000000 --- a/TROUBLESHOOTING.md +++ /dev/null @@ -1,23 +0,0 @@ -# Troubleshooting Ruby and Gem installation - -## Check the version of Ruby - -Jekyll, technically, works with Ruby 2.4.0. However, some of its dependencies may require a newer version of Ruby. -At the point of creating this memo, the 2.7.0 is the freshest version. Jekyll and its dependencies work with it fine. - -When installing Ruby via `brew`, the freshest version will be installed by default. It is still required to add the path -to the binary dist in the `$PATH`, for example: -``` -/usr/local/Cellar/ruby/2.7.0/bin/ -``` - -## Building native extensions - -In many cases, gems are provided with C-lang native extensions. The extensions are not compiled for all the combinations -of operating systems, operating system versions, and Ruby versions. If a pre-compiled extension artifact is missing, -`gem` will attempt to compile it locally. - -On MacOS of versions 10.14 and 10.15, the compilation may fail with a number of errors pointing at the `resource.h` -C-lang file. In this case, follow [this answer](https://stackoverflow.com/a/47401866/3183076) on StackOverflow: rename -the `/usr/local/include` directory to something else, e.g. `/usr/local/include_old`, so that the C compiler goes not -look there for the System API by default. diff --git a/_code/EMBEDDING.md b/_code/EMBEDDING.md index f727132a5..841ec4be0 100644 --- a/_code/EMBEDDING.md +++ b/_code/EMBEDDING.md @@ -1,65 +1,9 @@ Embedding code ====== -Your actions for adding a code sample to the documentation may vary depending on the scenarios -described in this document. +The `embed-code` tool is currently not used in this project. +It is only used in the [documentation][documentation-repo] repository. +You can read more in the corresponding [EMBEDDING.md][embedding-readme]. -- [The `_code` directory](#the---code--directory) -- [The Jekyll sub-command for embedding the code](#the-jekyll-sub-command-for-embedding-the-code) -- [Referencing existing code](#referencing-existing-code) -- [Adding a new small piece](#adding-a-new-small-piece) -- [Adding a new example project](#adding-a-new-example-project) - -Table of contents generated with markdown-toc - -# The `_code` directory - -This directory contains the source code which is embedded into the pages of the spine.io site. -There are two sub-directories under the `_code`: - * `examples` — contains examples selected from the repositories under `spine-examples` - organization. These repositories added to this project as Git submodules. - * `samples` — smaller pieces of code embedded to the site. - -# The Jekyll sub-command for embedding the code - -We use the [`embed-code`](https://github.com/SpineEventEngine/embed-code) Jekyll subcommand for -adding the source code to Markdown pages. The tool allows inserting or updating a source code -snippet using the specific instructions added to a Markdown page. - -Please read the [`embed-code` documentation](https://github.com/SpineEventEngine/embed-code) to -familiarise with the syntax. - -# Referencing existing code - -Just follow instructions from the [`embed-code` guide](https://github.com/SpineEventEngine/embed-code). - -# Adding a new small piece - - 1. Add the code under `_code/samples/src` directory. - 2. Make sure tests for the new code pass. - 3. Add the new piece using the [`embed-code` guide](https://github.com/SpineEventEngine/embed-code). - -# Adding a new example project - - 1. Make sure the project you're going to add has a top-level `buildAll` Gradle task. - - See the [build of the Hello Example](https://github.com/spine-examples/hello/blob/master/build.gradle) - for the declaration of such a task. This task must present in both single- and multi-module - Gradle example projects that are going to be used for embedding into this site. - - If you are interested in the details on why the `buildAll` task is needed, please see - the `buildAll` task from the [`build.gradle.kts`](build.gradle.kts) of this project for - the links to discussions of the problem of building composite builds, and the solution we use. - - 2. Add the example code as a submodule for this project: - - ```bash - git submodule add https://github.com/spine-examples/ _code/examples/ - ``` - Please make sure the new submodule goes under the `_code/examples` directory, as shown in - the command line template above. - - 3. Include the build of the added project into the [`settings.gradle.kts`](settings.gradle.kts) - file. - -After these steps you can embed the code into the pages of the site. +[documentation-repo]: https://github.com/SpineEventEngine/documentation +[embedding-readme]: https://github.com/SpineEventEngine/documentation/tree/master/_code/EMBEDDING.md diff --git a/_code/samples/build.gradle b/_code/samples/build.gradle deleted file mode 100644 index 8b18b5740..000000000 --- a/_code/samples/build.gradle +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -plugins { - id "io.spine.tools.gradle.bootstrap" version "1.7.0" -} - -spine.enableJava().server() - -ext { - junitVersion = '5.7.0' -} - -dependencies { - testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" -} - -test { - useJUnitPlatform { - includeEngines 'junit-jupiter' - } -} - -project.ext { - // The root for the generated source code. - generatedRootDir = "$projectDir/generated" - - // Directories for the code generated by the Protobuf Compiler and Spine plugins - // for the Compiler. - generatedJavaDir = "$generatedRootDir/main/java" - generatedTestJavaDir = "$generatedRootDir/test/java" - - // Directories for the Spine-specific code generated by the Spine Model Compiler, - // for example, rejections. - generatedSpineDir = "$generatedRootDir/main/spine" - generatedTestSpineDir = "$generatedRootDir/test/spine" -} - -apply plugin: 'idea' - -idea { - module { - // Add generated code directories to the source code of the module in IntelliJ IDEA. - generatedSourceDirs += file(generatedJavaDir) - generatedSourceDirs += file(generatedSpineDir) - testSourceDirs += file(generatedTestJavaDir) - testSourceDirs += file(generatedTestSpineDir) - } -} - -/** - * The task for composite builds to include this project and depend on this top-level task. - */ -task buildAll(type: GradleBuild) { - tasks = [ 'build' ] -} diff --git a/_code/samples/gradle/wrapper/gradle-wrapper.jar b/_code/samples/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c02..000000000 Binary files a/_code/samples/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/_code/samples/gradle/wrapper/gradle-wrapper.properties b/_code/samples/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 4d9ca1649..000000000 --- a/_code/samples/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/_code/samples/gradlew b/_code/samples/gradlew deleted file mode 100755 index 4f906e0c8..000000000 --- a/_code/samples/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or 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 -# -# https://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. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/_code/samples/gradlew.bat b/_code/samples/gradlew.bat deleted file mode 100644 index 107acd32c..000000000 --- a/_code/samples/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/_code/samples/settings.gradle b/_code/samples/settings.gradle deleted file mode 100644 index 55ac0f442..000000000 --- a/_code/samples/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -rootProject.name = "samples" diff --git a/_code/samples/src/main/java/io/spine/site/home/server/NanoPmContext.java b/_code/samples/src/main/java/io/spine/site/home/server/NanoPmContext.java deleted file mode 100644 index 6bdcb96ee..000000000 --- a/_code/samples/src/main/java/io/spine/site/home/server/NanoPmContext.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.site.home.server; - -import io.spine.server.BoundedContext; -import io.spine.server.BoundedContextBuilder; - -/** - * Defines the Mini PM context. - */ -public final class NanoPmContext { - - static final String NAME = "Nano PM"; - - /** Prevents instantiation of this utility class. */ - private NanoPmContext() { - } - - /** Creates a builder for single-tenant context filled in with entity types. */ - public static BoundedContextBuilder newBuilder() { - return BoundedContext.singleTenant(NAME) - .add(TaskAggregate.class) - .add(TaskProjection.class); - } -} diff --git a/_code/samples/src/main/java/io/spine/site/home/server/TaskAggregate.java b/_code/samples/src/main/java/io/spine/site/home/server/TaskAggregate.java deleted file mode 100644 index 152f55f23..000000000 --- a/_code/samples/src/main/java/io/spine/site/home/server/TaskAggregate.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.site.home.server; - -import io.spine.core.CommandContext; -import io.spine.site.home.Task; -import io.spine.site.home.TaskId; -import io.spine.site.home.command.AssignTask; -import io.spine.site.home.command.CompleteTask; -import io.spine.site.home.command.CreateTask; -import io.spine.site.home.event.TaskAssigned; -import io.spine.site.home.event.TaskCompleted; -import io.spine.site.home.event.TaskCreated; -import io.spine.server.aggregate.Aggregate; -import io.spine.server.aggregate.Apply; -import io.spine.server.command.Assign; - -final class TaskAggregate extends Aggregate { - - @Assign - TaskCreated handle(CreateTask cmd, CommandContext ctx) { - return TaskCreated.newBuilder() - .setTask(cmd.getId()) - .setName(cmd.getName()) - .setDescription(cmd.getDescription()) - .setOwner(ctx.getActorContext().getActor()) - .vBuild(); // validate the event - } - - @Apply - private void event(TaskCreated e) { - builder().setName(e.getName()) - .setDescription(e.getDescription()) - .setOwner(e.getOwner()); - } - - @Assign - TaskCompleted handle(CompleteTask cmd) { - return TaskCompleted.newBuilder() - .setTask(cmd.getTask()) - .vBuild(); - } - - @Apply - private void event(TaskCompleted e) { - setArchived(true); - } - - @Assign - TaskAssigned handle(AssignTask cmd) { - return TaskAssigned.newBuilder() - .setAssignee(cmd.getAssignee()) - .vBuild(); - } - - @Apply - private void event(TaskAssigned e) { - builder().setAssignee(e.getAssignee()); - } -} diff --git a/_code/samples/src/main/java/io/spine/site/home/server/TaskProjection.java b/_code/samples/src/main/java/io/spine/site/home/server/TaskProjection.java deleted file mode 100644 index 03752f9c5..000000000 --- a/_code/samples/src/main/java/io/spine/site/home/server/TaskProjection.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.site.home.server; - -import io.spine.core.EventContext; -import io.spine.core.Subscribe; -import io.spine.core.UserId; -import io.spine.site.home.TaskId; -import io.spine.site.home.TaskItem; -import io.spine.site.home.event.TaskAssigned; -import io.spine.site.home.event.TaskCompleted; -import io.spine.site.home.event.TaskCreated; -import io.spine.server.projection.Projection; - -final class TaskProjection extends Projection { - - @Subscribe - void on(TaskCreated e) { - builder().setName(e.getName()) - .setDescription(e.getDescription()) - .setOwner(toPersonName(e.getOwner())); - } - - @Subscribe - void on(TaskAssigned e) { - builder().setAssignee(toPersonName(e.getAssignee())); - } - - @Subscribe - void on(TaskCompleted e, EventContext ctx) { - builder().setWhenDone(ctx.getTimestamp()); - } - - /** - * Returns always the same mock name because this code is not going to be shown - * at the site pages. - */ - private static String toPersonName(@SuppressWarnings("unused") UserId user) { - return "John Doe"; - } -} diff --git a/_code/samples/src/main/java/io/spine/site/home/server/package-info.java b/_code/samples/src/main/java/io/spine/site/home/server/package-info.java deleted file mode 100644 index 13658d031..000000000 --- a/_code/samples/src/main/java/io/spine/site/home/server/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * This package contains server-side implementation of the Mini PM example which is used - * at the site home page. - */ -@CheckReturnValue -@ParametersAreNonnullByDefault -@BoundedContext(NanoPmContext.NAME) -package io.spine.site.home.server; - -import com.google.errorprone.annotations.CheckReturnValue; -import io.spine.core.BoundedContext; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/_code/samples/src/main/proto/spine/example/events.proto b/_code/samples/src/main/proto/spine/example/events.proto deleted file mode 100644 index ace437e0d..000000000 --- a/_code/samples/src/main/proto/spine/example/events.proto +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -syntax = "proto3"; - -package spine.example; - -import "spine/options.proto"; - -option (type_url_prefix) = "type.spine.io"; -option java_package = "io.spine.example"; -option java_outer_classname = "EventsProto"; -option java_multiple_files = true; - -// #docregion ProjectCreated -message ProjectCreated { - -} -// #enddocregion ProjectCreated diff --git a/_code/samples/src/main/proto/spine/site/home/commands.proto b/_code/samples/src/main/proto/spine/site/home/commands.proto deleted file mode 100644 index bd14cd4e2..000000000 --- a/_code/samples/src/main/proto/spine/site/home/commands.proto +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -syntax = "proto3"; - -package spine.site.home; - -import "spine/options.proto"; - -option (type_url_prefix) = "type.spine.io"; -option java_package = "io.spine.site.home.command"; -option java_outer_classname = "CommandsProto"; -option java_multiple_files = true; - -import "spine/site/home/identifiers.proto"; - -// Create a new task. -message CreateTask { - TaskId id = 1; // assumed `required` - string name = 2 [(required) = true]; - string description = 3; -} - -// Assign a task on a user. -message AssignTask { - TaskId task = 1; - spine.core.UserId assignee = 2 [(required) = true]; -} - -// Mark a task as completed. -message CompleteTask { - TaskId task = 1; -} diff --git a/_code/samples/src/main/proto/spine/site/home/events.proto b/_code/samples/src/main/proto/spine/site/home/events.proto deleted file mode 100644 index 379e1c720..000000000 --- a/_code/samples/src/main/proto/spine/site/home/events.proto +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -syntax = "proto3"; - -package spine.site.home; - -import "spine/options.proto"; - -option (type_url_prefix) = "type.spine.io"; -option java_package = "io.spine.site.home.event"; -option java_outer_classname = "CommandsProto"; -option java_multiple_files = true; - -import "spine/site/home/identifiers.proto"; - -// A new task has been created. -message TaskCreated { - TaskId task = 1 [(required) = true]; - string name = 2 [(required) = true]; - string description = 3; - spine.core.UserId owner = 4 [(required) = true]; -} - -// A task was assigned to a user. -message TaskAssigned { - TaskId task = 1 [(required) = true]; - spine.core.UserId assignee = 2 [(required) = true]; -} - -// A task was marked as completed. -message TaskCompleted { - TaskId task = 1 [(required) = true]; -} diff --git a/_code/samples/src/main/proto/spine/site/home/identifiers.proto b/_code/samples/src/main/proto/spine/site/home/identifiers.proto deleted file mode 100644 index fee4bea54..000000000 --- a/_code/samples/src/main/proto/spine/site/home/identifiers.proto +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -syntax = "proto3"; - -package spine.site.home; - -import "spine/options.proto"; - -option (type_url_prefix) = "type.spine.io"; -option java_package = "io.spine.site.home"; -option java_outer_classname = "IdentifiersProto"; -option java_multiple_files = true; - -import public "spine/core/user_id.proto"; - -message TaskId { - string uuid = 1; -} diff --git a/_code/samples/src/main/proto/spine/site/home/task.proto b/_code/samples/src/main/proto/spine/site/home/task.proto deleted file mode 100644 index 32aa1da09..000000000 --- a/_code/samples/src/main/proto/spine/site/home/task.proto +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -syntax = "proto3"; - -package spine.site.home; - -import "spine/options.proto"; - -option (type_url_prefix) = "type.spine.io"; -option java_package = "io.spine.site.home"; -option java_outer_classname = "TaskProto"; -option java_multiple_files = true; - -import "google/protobuf/timestamp.proto"; -import "spine/site/home/identifiers.proto"; - -// A task which can be assigned to a user. -message Task { - option (entity).kind = AGGREGATE; - TaskId id = 1; // assumed `required` - string name = 2 [(required) = true]; - string description = 3; - spine.core.UserId owner = 4 [(required) = true]; - spine.core.UserId assignee = 5; -} - -// An item in a task list displayed in UI. -message TaskItem { - option (entity).kind = PROJECTION; - TaskId task = 1; - string name = 2 [(required) = true]; - string description = 3; - string owner = 4 [(required) = true]; - string assignee = 5; - google.protobuf.Timestamp when_done = 6; -} diff --git a/_code/samples/src/test/java/io/spine/example/CompiledProtobuf.java b/_code/samples/src/test/java/io/spine/example/CompiledProtobuf.java deleted file mode 100644 index 591de7046..000000000 --- a/_code/samples/src/test/java/io/spine/example/CompiledProtobuf.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package io.spine.example; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import static com.google.common.truth.Truth.assertThat; - -@DisplayName("Project should contain Protobuf types:") -class CompiledProtobuf { - - @Test - @DisplayName("ProjectCreated") - void projectCreated() { - assertThat(ProjectCreated.class) - .isNotNull(); - } -} diff --git a/_code/samples/src/test/java/io/spine/site/home/server/TaskCreationTest.java b/_code/samples/src/test/java/io/spine/site/home/server/TaskCreationTest.java deleted file mode 100644 index 5b7d08558..000000000 --- a/_code/samples/src/test/java/io/spine/site/home/server/TaskCreationTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * 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 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.site.home.server; - -import io.spine.server.BoundedContextBuilder; -import io.spine.site.home.Task; -import io.spine.site.home.TaskId; -import io.spine.site.home.TaskItem; -import io.spine.site.home.command.CreateTask; -import io.spine.site.home.event.TaskCreated; -import io.spine.testing.server.blackbox.ContextAwareTest; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import static io.spine.testing.TestValues.randomString; - -@DisplayName("Handling `CreateTask` command should") -public class TaskCreationTest extends ContextAwareTest { - - private TaskId task; - private String name; - private String description; - - @Override - protected BoundedContextBuilder contextBuilder() { - return NanoPmContext.newBuilder(); - } - - private CreateTask generateCommand() { - task = TaskId.generate(); - name = randomString(); - description = randomString(); - return CreateTask.newBuilder() - .setId(task) - .setName(name) - .setDescription(description) - .vBuild(); - } - - @BeforeEach - void postCommand() { - CreateTask cmd = generateCommand(); - context().receivesCommand(cmd); - } - - @Test - @DisplayName("generate `TaskCreated` event") - void eventGenerated() { - TaskCreated expected = expectedEvent(); - context().assertEvent(TaskCreated.class) - .comparingExpectedFieldsOnly() - .isEqualTo(expected); - } - - private TaskCreated expectedEvent() { - return TaskCreated.newBuilder() - .setTask(task) - .setName(name) - .setDescription(description) - .buildPartial(); - } - - @Test - @DisplayName("create a `Task`") - void aggregateCreation() { - Task expected = expectedAggregateState(); - context().assertEntityWithState(task, Task.class) - .hasStateThat() - .comparingExpectedFieldsOnly() - .isEqualTo(expected); - } - - private Task expectedAggregateState() { - return Task.newBuilder() - .setId(task) - .setName(name) - .setDescription(description) - .buildPartial(); - } - - @Test - @DisplayName("create a `TaskItem`") - void projectionCreation() { - TaskItem expected = expectedProjectionState(); - context().assertEntityWithState(task, TaskItem.class) - .hasStateThat() - .comparingExpectedFieldsOnly() - .isEqualTo(expected); - } - - private TaskItem expectedProjectionState() { - return TaskItem.newBuilder() - .setName(name) - .setDescription(description) - .buildPartial(); - } -} diff --git a/_script/check-samples b/_script/check-samples deleted file mode 100755 index f0d4fe47f..000000000 --- a/_script/check-samples +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2020, TeamDev. All rights reserved. -# -# 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 -# -# Redistribution and use in source and/or binary forms, with or without -# modification, must retain the above copyright notice and the following -# disclaimer. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# Load environment variables for the case of execution from the Gradle build if they exist. -BASH_PROFILE=~/.bash_profile -BASH_RC=~/.bashrc - -if [ -f ${BASH_PROFILE} ]; then - echo "Using user's local bash profile." - . ${BASH_PROFILE} -elif [ -f ${BASH_RC} ]; then - echo "Using user's local bash runtime configuration." - . ${BASH_RC} -fi - -bundle exec jekyll checkCodeSamples diff --git a/_script/embed-code b/_script/embed-code deleted file mode 100755 index 937190729..000000000 --- a/_script/embed-code +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2020, TeamDev. All rights reserved. -# -# 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 -# -# Redistribution and use in source and/or binary forms, with or without -# modification, must retain the above copyright notice and the following -# disclaimer. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# Load environment variables for the case of execution from the Gradle build if they exist. -BASH_PROFILE=~/.bash_profile -BASH_RC=~/.bashrc - -if [ -f ${BASH_PROFILE} ]; then - echo "Using user's local bash profile." - . ${BASH_PROFILE} -elif [ -f ${BASH_RC} ]; then - echo "Using user's local bash runtime configuration." - . ${BASH_RC} -fi - -# Ensure `_code` files are fetched. -git submodule update --remote --merge --recursive - -# Update code samples. -bundle exec jekyll embedCodeSamples diff --git a/_script/jekyll-build b/_script/hugo-build similarity index 95% rename from _script/jekyll-build rename to _script/hugo-build index 4a09596da..cc35453e3 100755 --- a/_script/jekyll-build +++ b/_script/hugo-build @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2020, TeamDev. All rights reserved. +# Copyright 2025, TeamDev. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,4 +37,5 @@ elif [ -f ${BASH_RC} ]; then . ${BASH_RC} fi -bundle exec jekyll build +cd site +hugo diff --git a/_script/jekyll-serve b/_script/hugo-serve similarity index 95% rename from _script/jekyll-serve rename to _script/hugo-serve index 99c0a8bc1..0180823e4 100755 --- a/_script/jekyll-serve +++ b/_script/hugo-serve @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2020, TeamDev. All rights reserved. +# Copyright 2025, TeamDev. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,4 +37,5 @@ elif [ -f ${BASH_RC} ]; then . ${BASH_RC} fi -bundle exec jekyll serve +cd site +hugo server diff --git a/_script/proof-links b/_script/proof-links index bc6dd4f2d..548fee710 100755 --- a/_script/proof-links +++ b/_script/proof-links @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2020, TeamDev. All rights reserved. +# Copyright 2025, TeamDev. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,9 +37,4 @@ elif [ -f ${BASH_RC} ]; then . ${BASH_RC} fi -# Check the links used by the site. -bundle exec htmlproofer \ - --assume-extension ./_site \ - --only_4xx \ - --http-status-ignore "429" \ - --url-ignore "/twitter.com/" +lychee --config lychee.toml --base http://localhost:1313 "site/public/**/*.html" diff --git a/build.gradle.kts b/build.gradle.kts index 5af2be7e6..42806e1e5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2020, TeamDev. All rights reserved. + * Copyright 2025, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,21 +28,14 @@ * Builds and runs the site locally. */ task("runSite") { - commandLine("./_script/jekyll-serve") + commandLine("./_script/hugo-serve") } /** * Builds the site without starting the server. */ task("buildSite") { - commandLine("./_script/jekyll-build") -} - -/** - * Embeds the code sames into pages of the site. - */ -task("embedCode") { - commandLine("./_script/embed-code") + commandLine("./_script/hugo-build") } /** @@ -52,13 +45,6 @@ task("checkLinks") { commandLine("./_script/proof-links") } -/** - * Verifies that the source code samples embedded into the pages are up-to-date. - */ -task("checkSamples") { - commandLine("./_script/check-samples") -} - /** * Builds all included projects via depending on the top-level "buildAll" tasks * declared in these projects. diff --git a/config b/config deleted file mode 160000 index 24b530469..000000000 --- a/config +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 24b5304699ac2f60a464f1796d911aba871f66c2 diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 000000000..e74b06fb6 --- /dev/null +++ b/lychee.toml @@ -0,0 +1,45 @@ +# Exclude URLs and mail addresses from checking (supports regex). +exclude = [ + # Links that return errors during checks, but work for the user. + "fonts.googleapis.com/*", + "fonts.gstatic.com/*", + "chromium.googlesource.com/*", + "chromereleases.googleblog.com/*", + "clients4.google.com/", + "ssl.gstatic.com/", + "googletagmanager.com/*", + "x.com/*", + + "stackoverflow.com/questions/*", + "openjdk.org/*", + "npmjs.com/*", + "raw.githubusercontent.com/SpineEventEngine/*" +] + +# Exclude these filesystem paths from getting checked. +exclude_path = [] + +# Check links inside `` and `
` blocks as well
+# as Markdown code blocks.
+include_verbatim = false
+
+# Verbose program output
+verbose = "error"
+
+# Don't show interactive progress bar while checking links.
+no_progress = false
+
+# Comma-separated list of accepted status codes for valid links.
+accept = ["200..=204", "429"]
+
+# Link caching to avoid checking the same links on multiple runs.
+cache = true
+
+# Discard all cached requests older than this duration.
+max_cache_age = "3d"
+
+# Maximum number of allowed retries before a link is declared dead.
+max_retries = 3
+
+# Minimum wait time in seconds between retries of failed requests.
+retry_wait_time = 2
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 054d1156a..b10de4e94 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,5 +1,5 @@
 /*
- * Copyright 2020, TeamDev. All rights reserved.
+ * Copyright 2025, TeamDev. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,7 +25,3 @@
  */
 
 rootProject.name = "spine.io"
-
-includeBuild("./_code/samples")
-
-includeBuild("./_code/examples/hello")
diff --git a/site/.gitignore b/site/.gitignore
deleted file mode 100644
index a72e6f71b..000000000
--- a/site/.gitignore
+++ /dev/null
@@ -1,72 +0,0 @@
-# Hugo cache files
-/resources
-public
-
-# Cache folder for Hugo Modules
-_vendor
-
-# Node modules
-node_modules
-
-# Used to control concurrency between multiple Hugo instances
-.hugo_build.lock
-
-# Needed for navigation help inside code editors
-jsconfig.json
-
-# IntelliJ IDEA modules and interim config files
-*.iml
-.idea/*.xml
-.idea/.name
-.idea/artifacts
-.idea/libraries
-.idea/modules
-.idea/shelf
-
-!.idea/misc.xml
-!.idea/codeStyles/
-!.idea/copyright/
-
-.DS_Store
-
-# Gradle interim configs
-.gradle/
-
-# Generated source code
-generated/
-
-# Gradle build files
-build/
-
-# IDEA build files
-out/
-
-# Spine temporary artifact storage
-.spine/
-
-# Temporarily add the Spine Protoc plugin until this Base issue is fixed:
-#     https://github.com/SpineEventEngine/base/issues/552
-# Update the file when you bump Spine dependency in `samples` or `examples`.
-# The `.spine` directory must have all the versions of the plugin until the issue is fixed.
-!/.spine/spine-protoc-plugin-1.5.21.jar
-
-# Credentials to Maven repositories and Google Cloud Storage used for Travis build reports
-credentials.tar
-credentials.properties
-cloudrepo.properties
-deploy_key_rsa
-gcs-auth-key.json
-
-#
-# The gradle.properties file should contain settings specific to a developer's workstation.
-#
-# See sample file for a Mac OS X workstation below.
-# -------
-# # Set Java home to point to JDK8. This is need to generate classes working with Java8 API.
-# # Otherwise the following warning appears during the build:
-# #     warning: [options] bootstrap class path not set in conjunction with -source 1.8
-# #
-# # suppress inspection "UnusedProperty"
-# org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/
-# -------
-gradle.properties
diff --git a/site/config/_default/hugo.toml b/site/config/_default/hugo.toml
index 1612f7b26..b07e86c50 100644
--- a/site/config/_default/hugo.toml
+++ b/site/config/_default/hugo.toml
@@ -1,6 +1,7 @@
 baseURL = 'https://spine.io/'
 languageCode = 'en-us'
 title = 'Spine Event Engine'
+enableRobotsTXT = true
 disableKinds = ['taxonomy', 'term']
 
 [module]
@@ -44,9 +45,10 @@ disableKinds = ['taxonomy', 'term']
 
 # Version control config.
 # To change the current main version, update only the `path` parameter.
-# Read more in the `SPINE_RELEASE.md` guide.
+# Read more in the `SpineEventEngine/documentation/SPINE_RELEASE.md` guide.
 #
-# The configuration is duplicated now due to the known issue with cascade arrays:
+# The configuration is currently duplicated from the `SpineEventEngine/documentation`
+# repository due to a known issue with cascading arrays:
 # https://github.com/gohugoio/hugo/issues/13869
 [[cascade]]
   [cascade.params]
diff --git a/site/content/release-notes/2018/v1.0.0-pre1.md b/site/content/release-notes/2018/v1.0.0-pre1.md
index 8ec968ffe..bb8c678b0 100644
--- a/site/content/release-notes/2018/v1.0.0-pre1.md
+++ b/site/content/release-notes/2018/v1.0.0-pre1.md
@@ -24,6 +24,7 @@ introducing a JUnit extension for muting redundant test output;
 - entity IDs are now always validated as if `(required) = true`.
 
 ## CoreJvm
+
 This is a preview release of the Spine 1.0 version.
 
 #### New Maven Repository
@@ -33,8 +34,6 @@ In this version one more artifact repository is introduced:
 - Releases: [https://spine.mycloudrepo.io/public/repositories/releases](https://spine.mycloudrepo.io/public/repositories/releases)
 - Snapshots: [https://spine.mycloudrepo.io/public/repositories/snapshots](https://spine.mycloudrepo.io/public/repositories/snapshots)
 
-The [previously used repository](https://maven.teamdev.com/repository/spine/) is also maintained.
-
 #### Features and Improvements
 
 Since 0.10.0 several significant features were introduced, making the framework near the 
diff --git a/site/go.mod b/site/go.mod
index db4cdf8be..1b895b3fb 100644
--- a/site/go.mod
+++ b/site/go.mod
@@ -3,6 +3,6 @@ module github.com/SpineEventEngine/SpineEventEngine.github.io
 go 1.22.0
 
 require (
-    github.com/SpineEventEngine/documentation/docs v0.0.0-20251215141546-8a4bbba5b1e4 // indirect
+	github.com/SpineEventEngine/documentation/docs v0.0.0-20251216105126-d1da958b0294 // indirect
 	github.com/TeamDev-Ltd/site-commons v0.0.0-20251202150534-a795438915ff // indirect
 )
diff --git a/site/go.sum b/site/go.sum
index 82cb74427..7d45f6427 100644
--- a/site/go.sum
+++ b/site/go.sum
@@ -1,4 +1,4 @@
-github.com/SpineEventEngine/documentation/docs v0.0.0-20251215141546-8a4bbba5b1e4 h1:9PdrpO1Elll1u7I4gUy1rQ73zQRT/N9txtKAXlwM8Lg=
-github.com/SpineEventEngine/documentation/docs v0.0.0-20251215141546-8a4bbba5b1e4/go.mod h1:0lSB4kPZY9Qk429mepYiraNIEucYDIwiNVhJ3Wn3gKo=
+github.com/SpineEventEngine/documentation/docs v0.0.0-20251216105126-d1da958b0294 h1:RXxaFO0x3zqteoJ5B5r3/JYltseNNorawAFBeHYttu8=
+github.com/SpineEventEngine/documentation/docs v0.0.0-20251216105126-d1da958b0294/go.mod h1:0lSB4kPZY9Qk429mepYiraNIEucYDIwiNVhJ3Wn3gKo=
 github.com/TeamDev-Ltd/site-commons v0.0.0-20251202150534-a795438915ff h1:8kjfGJhf6LeS+IlK9NRktxtcv6O/WDneBuQD3QLPGIs=
 github.com/TeamDev-Ltd/site-commons v0.0.0-20251202150534-a795438915ff/go.mod h1:atDeksDWBzsIidpW6Ivz2yYHwp2JPa1i1KXIxkctQ3c=
diff --git a/site/layouts/_partials/release-notes/sidenav.html b/site/layouts/_partials/release-notes/sidenav.html
index e287bbf95..4c9df53fd 100644
--- a/site/layouts/_partials/release-notes/sidenav.html
+++ b/site/layouts/_partials/release-notes/sidenav.html
@@ -26,15 +26,22 @@
 
 {{ $page := . }}
 {{ $sidenavData := partial "release-notes/functions/get-releases.html" . }}
+{{ $yearNow := "nil" }}
+
+{{ if eq $.File.Path "release-notes/_index.md" }}
+    {{ $yearNow = now.Format "2006" }}
+{{ end }}
 
 {{ if $sidenavData }}
     {{ partial "docs/components/sidenav/mobile-header.html" . }}
     
    {{ range $sidenavData }} {{ if .children }} + {{ $isActive := eq .key $yearNow }} {{ partial "docs/components/sidenav/category.html" (dict "page_context" $page "item_context" . + "is_active" $isActive ) }} {{ else }} {{ partial "docs/components/sidenav/page.html" (dict