From 796b51be602f710d5eef100aaa44d9aae655bb4d Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Fri, 9 Jun 2023 03:23:29 -0400 Subject: [PATCH] Add copy button extension for documentation code blocks --- docs/conf.py | 7 +++++-- docs/installation.rst | 20 +++++++++++--------- docs/requirements.in | 3 ++- docs/requirements.txt | 3 +++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bcef09856..f45e6b786 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,10 @@ import sys, os # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.todo'] +extensions = [ + 'sphinx.ext.todo', + 'sphinx_copybutton' +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -41,7 +44,7 @@ master_doc = 'index' # General information about the project. project = u'CGRateS' -copyright = u'2012-2020, ITsysCOM GmbH' +copyright = u'2012-2023, ITsysCOM GmbH' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/installation.rst b/docs/installation.rst index cd236c1f5..b0dbbbaa7 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -14,7 +14,7 @@ Installation CGRateS can be installed either via packages or through an automated Go source installation. We recommend the latter for advanced users familiar with Go programming, and package installations for those not wanting to engage in the code building process. -After completing the installation, you need to perform the :ref:`post-install configuration ` steps to set up CGRateS properly and prepare it to run. After these steps, CGRateS will be configured in **/etc/cgrates/cgrates.json** and enabled in **/etc/default/cgrates**. +After completing the installation, you need to perform the :ref:`post-install configuration ` steps to set up CGRateS properly and prepare it to run. After these steps, CGRateS will be configured in **/etc/cgrates/cgrates.json** and the service can be managed using the **systemctl** command. Package Installation -------------------- @@ -55,7 +55,7 @@ Alternatively, you can manually install a specific .deb package as follows: Redhat-based Distributions ^^^^^^^^^^^^^^^^^^^^^^^^^^ -For .rpm distros, we are using Fedora Copr to manage the CGRateS packages: +For .rpm distros, we are using copr to manage the CGRateS packages: .. code-block:: bash @@ -72,18 +72,19 @@ To install a specific version of the package, run: .. note:: The entire archive of CGRateS rpm packages is available at https://copr.fedorainfracloud.org/coprs/cgrates/v0.10/packages/. -Building from Source --------------------- +Installing from Source +---------------------- Prerequisites: +^^^^^^^^^^^^^^ -- Git +- **Git** .. code-block:: bash sudo apt install git -- Go (refer to the official Go installation docs: https://go.dev/doc/install) +- **Go** (refer to the official Go installation docs: https://go.dev/doc/install) To install the latest Go version at the time of writing this documentation, run: @@ -96,7 +97,8 @@ To install the latest Go version at the time of writing this documentation, run: sudo tar -C /usr/local -xzf go1.20.5.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin -Configure the project using the following commands: +Installation: +^^^^^^^^^^^^^ .. code-block:: bash @@ -124,7 +126,7 @@ Creating Your Own Packages After compiling the source code, you may choose to create your own packages. For Debian-based distros: -~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash @@ -149,7 +151,7 @@ To install the generated package, run: sudo dpkg -i cgrates_*.deb For Redhat-based distros: -~~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash diff --git a/docs/requirements.in b/docs/requirements.in index 6a049cb10..9dc4cb150 100644 --- a/docs/requirements.in +++ b/docs/requirements.in @@ -1,2 +1,3 @@ sphinx_rtd_theme==1.2.0 -sphinx==6.2.1 \ No newline at end of file +sphinx==6.2.1 +sphinx_copybutton==0.5.2 \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index b32df955e..12e7cd9b7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -37,8 +37,11 @@ snowballstemmer==2.2.0 sphinx==6.2.1 # via # -r requirements.in + # sphinx-copybutton # sphinx-rtd-theme # sphinxcontrib-jquery +sphinx-copybutton==0.5.2 + # via -r requirements.in sphinx-rtd-theme==1.2.0 # via -r requirements.in sphinxcontrib-applehelp==1.0.4