Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor clean up of repo #2950

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
19 changes: 19 additions & 0 deletions contributing/templates_and_guides/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Templates and Guides

In this directory you will find templates and writing guides that you can use when contributing new documentation to the repo.

## Why templates and guides?

At ClickHouse we believe that high quality documentation is vitally important to our community as it helps them get the most
out of ClickHouse quickly. We also recognise that documentation at ClickHouse is a collective effort, with a diverse range of
people contributing content, not all of whom are technical writers. Fortunately, you don't have to be one to still contribute
great documentation. In this directory you'll find templates and guidelines for various types of content. We use these to help
ensure that our documentation is consistent, and therefore more readable and maintainable, and also to assist you in writing
quality content for the documentation.

## List of templates

## Guidelines



File renamed without changes.
File renamed without changes.
40 changes: 0 additions & 40 deletions copyClickhouseRepoDocs.sh

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"prep-from-local": "bash -c 'array_root=($npm_package_config_prep_array_root);array_en=($npm_package_config_prep_array_en);for folder in ${array_en[@]}; do cp -r $0/$folder docs/en;echo \"Copied $folder from [$0]\";done;for folder in ${array_root[@]}; do cp -r $0/$folder docs/;echo \"Copied $folder from [$0]\";done;echo \"Prep completed\";'",
"prep-from-master": "bash -c 'array_root=($npm_package_config_prep_array_root);array_en=($npm_package_config_prep_array_en);ch_temp=/tmp/ch_temp_$RANDOM && mkdir -p $ch_temp && git clone --depth 1 --branch master https://github.com/ClickHouse/ClickHouse $ch_temp; for folder in ${array_en[@]}; do cp -r $ch_temp/$folder docs/en;echo \"Copied $folder from ClickHouse master branch\";done;for folder in ${array_root[@]}; do cp -r $ch_temp/$folder docs/;echo \"Copied $folder from ClickHouse master branch\";done;rm -rf $ch_temp && echo \"Prep completed\";'",
"serve": "docusaurus serve",
"build-api-doc": "node clickhouseapi.js",
"build-api-doc": "node scripts/clickhouseapi.js",
"build-swagger": "npx @redocly/cli build-docs https://api.clickhouse.cloud/v1 --output build/en/cloud/manage/api/swagger.html",
"new-build": "bash ./copyClickhouseRepoDocs.sh && bash ./scripts/settings/autogenerate-settings.sh && yarn build-api-doc && yarn build && yarn build-swagger",
"new-build": "bash scripts/copyClickHouseRepoDocs.sh && bash scripts/settings/autogenerate-settings.sh && yarn build-api-doc && yarn build && yarn build-swagger",
"start": "docusaurus start",
"swizzle": "docusaurus swizzle",
"write-heading-ids": "docusaurus write-heading-ids"
Expand Down
4 changes: 0 additions & 4 deletions pagerank.csv

This file was deleted.

File renamed without changes.
46 changes: 46 additions & 0 deletions scripts/copyClickHouseRepoDocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

handle_error() {
echo -e "\033[0;31m[$SCRIPT_NAME] An error occurred: $1"
exit 1
}

SCRIPT_NAME=$(basename "$0")

echo "[$SCRIPT_NAME] Start tasks for copying docs from ClickHouse repo"

# Clone ClickHouse repo
echo "[$SCRIPT_NAME] Start cloning ClickHouse repo"
ch_temp=/tmp/ch_temp_$RANDOM && mkdir -p $ch_temp && git clone --depth 1 --branch master https://github.com/ClickHouse/ClickHouse $ch_temp
echo -e "[$SCRIPT_NAME] \033[0;32mCloning completed\033[0m"

# Copy docs folders from ClickHouse repo to docs folder
echo "[$SCRIPT_NAME] Start copying docs"
cp -r $ch_temp/docs/en/development docs/en/ &&
cp -r $ch_temp/docs/en/engines docs/en/ &&
cp -r $ch_temp/docs/en/getting-started docs/en/ &&
cp -r $ch_temp/docs/en/interfaces docs/en/ &&
cp -r $ch_temp/docs/en/operations docs/en/ &&
cp -r $ch_temp/docs/en/sql-reference docs/en/ &&
cp -r $ch_temp/docs/ru docs/ &&
cp -r $ch_temp/docs/zh docs/ || handle_error "Copying docs folders from ClickHouse repo to docs folder"

# Necessary for autogenerating settings
cp $ch_temp/src/Core/FormatFactorySettings.h "$(dirname "$0")/settings" &&
cp $ch_temp/src/Core/Settings.cpp "$(dirname "$0")/settings" || handle_error "Copying C++ source files used for autogeneration"

echo -e "[$SCRIPT_NAME] \033[0;32mCopying completed successfully\033[0m"

echo -e "[$SCRIPT_NAME] Generate changelog"
cp docs/en/_placeholders/changelog/_index.md docs/en/whats-new/changelog/index.md &&
sed "0,/^# $(date +%Y) Changelog/d" \
< ClickHouse/CHANGELOG.md \
>> docs/en/whats-new/changelog/index.md || handle_error "Generating changelog"
echo -e "[$SCRIPT_NAME] \033[0;32mGenerate changelog completed successfully\033[0m"

# Cleanup
echo "[$SCRIPT_NAME] Start deleting temporarily cloned ClickHouse repo"
rm -r $ch_temp -f || handle_error "could not delete $ch_temp"

echo -e "[$SCRIPT_NAME] \033[0;32mCleanup completed successfully\033[0m"
echo -e "[$SCRIPT_NAME] \033[0;32mFinished successfully\033[0m"
File renamed without changes.
21 changes: 15 additions & 6 deletions scripts/settings/autogenerate-settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

SCRIPT_NAME=$(basename "$0")

handle_error() {
echo -e "\033[0;31m[$SCRIPT_NAME] An error occurred: $1"
exit 1
}

echo "[$SCRIPT_NAME] Autogenerating settings"

# Install ClickHouse
Expand All @@ -23,7 +28,7 @@ This feature is beta stage. The outcome of using it together with other features
# Autogenerate Format settings
./clickhouse -q "
WITH
'FormatFactorySettings.h' AS cpp_file,
'scripts/settings/FormatFactorySettings.h' AS cpp_file,
settings_from_cpp AS
(
SELECT extract(line, 'DECLARE\\(\\w+, (\\w+),') AS name
Expand All @@ -48,12 +53,12 @@ These settings are autogenerated from [source](https://github.com/ClickHouse/Cli
' AS prefix
SELECT prefix || (SELECT groupConcat(*) FROM main_content)
INTO OUTFILE 'docs/en/operations/settings/settings-formats.md' TRUNCATE FORMAT LineAsString
"
" || handle_error "oh no, something went wrong while generating Format settings"

# Autogenerate settings
# Autogenerate core settings
./clickhouse -q "
WITH
'Settings.cpp' AS cpp_file,
'scripts/settings/Settings.cpp' AS cpp_file,
settings_from_cpp AS
(
SELECT extract(line, 'DECLARE\\(\\w+, (\\w+),') AS name
Expand All @@ -78,12 +83,16 @@ All below settings are also available in table [system.settings](/docs/en/operat
' AS prefix
SELECT prefix || (SELECT groupConcat(*) FROM main_content)
INTO OUTFILE 'docs/en/operations/settings/settings.md' TRUNCATE FORMAT LineAsString
"
" || handle_error "oh no, something went wrong while generating core settings"

# Delete ClickHouse
if [ -f ./clickhouse ]; then
echo -e "\n[$SCRIPT_NAME] Deleting ClickHouse binary"
rm ./clickhouse
fi

echo "[$SCRIPT_NAME] Autogenerating settings completed"
# Cleanup files used to autogenerate settings
rm scripts/settings/FormatFactorySettings.h &&
rm scripts/settings/Settings.cpp || handle_error "could not delete source files used to autogenerate settings"

echo -e "[$SCRIPT_NAME] \033[0;32mAuto generation of settings completed successfully\033[0m"
Loading