Difference between revisions of "Test Documentation in Linux"

From GnuCash
Jump to: navigation, search
(Install Updated Documentation Locally: reorder)
(Tell Development GnuCash Where to Find Docs: several minor improvements)
Line 45: Line 45:
  
 
===Tell Development GnuCash Where to Find Docs===
 
===Tell Development GnuCash Where to Find Docs===
At first verify, what is already set: <SyntaxHighlight lang="sh">
+
At first verify, what is already set: <SyntaxHighlight lang="sh" inline>
 
echo ${XDG_DATA_DIRS}
 
echo ${XDG_DATA_DIRS}
 
</SyntaxHighlight>
 
</SyntaxHighlight>
<SyntaxHighlight lang="sh">
+
Then execute <SyntaxHighlight lang="sh">
 
GCASH=/home/$USER/code/gnucash-install          # For convenience if you built gnucash yourself, otherwise:
 
GCASH=/home/$USER/code/gnucash-install          # For convenience if you built gnucash yourself, otherwise:
 
GCASH=/usr                                      # For convenience if you use a default installed gnucash
 
GCASH=/usr                                      # For convenience if you use a default installed gnucash
 
GCASHDOCS=/home/$USER/code/gnucash-docs-install # For convenience
 
GCASHDOCS=/home/$USER/code/gnucash-docs-install # For convenience
GLANG=<your-language>                          # To choose a language different from your system default, can be any of the supported languages: C, de, it, pt, ja,...
+
GLANG=<your-language>                          # To choose a language different from your user default, can be any of the supported languages: C, de, it, pt, ja,...
 +
# To start gnucash with your own help files:
 
# From the following line add only the parts which are not already set:
 
# From the following line add only the parts which are not already set:
 
LANG=$GLANG XDG_DATA_DIRS="$GCASHDOCS/share:$XDG_DATA_DIRS:/usr/local/share:/usr/share" $GCASH/bin/gnucash &
 
LANG=$GLANG XDG_DATA_DIRS="$GCASHDOCS/share:$XDG_DATA_DIRS:/usr/local/share:/usr/share" $GCASH/bin/gnucash &
 
</SyntaxHighlight>
 
</SyntaxHighlight>
  
That last line, with XDG_DATA_DIRS, is the crux of it. That environment variable tells GnuCash, among other things, where to look for the documentation. In fact, it tells any tool which uses Yelp (and Yelp itself) where to look for documentation. For example, try the following:
+
That last line, with XDG_DATA_DIRS, is the crux of it. That environment variable tells GnuCash, among other things, where to look for the documentation. In fact, it tells any tool which follows XDG standards (and Yelp itself) where to look for documentation.  
 +
 
 +
To directly start yelp with a ''document'' and optionally a ''topic'', try the following:
 
<SyntaxHighlight lang="sh">
 
<SyntaxHighlight lang="sh">
LANG=$GLANG XDG_DATA_DIRS="$GCASHDOCS/share:$XDG_DATA_DIRS" yelp gnome-help:gnucash-help &
+
LANG=$GLANG XDG_DATA_DIRS="$GCASHDOCS/share:$XDG_DATA_DIRS" yelp ghelp:gnucash-help#Using-Help &
 +
# 'ghelp:' is a shortcut for 'gnome-help:'
 +
# '#' separates the topic from the filename
 
</SyntaxHighlight>
 
</SyntaxHighlight>
  

Revision as of 05:07, 30 April 2021

Test Documentation in Linux

For our purposes, “Linux” means any system that’s not Windows or Mac OS X. GnuCash uses Yelp, the GNOME documentation browser, to display its help--both the User Manual and the Concepts Guide. This documentation gets installed in the old GNOME 2 standard help directory hierarchy. Although not tested, it's very likely that a cygwin environment on Windows or a fink/homebrew/macports environment on OS X can equally be configured to run these documentation tests. GnuCash as installed from the Windows Installer package or the OS X/Quarz dmg on the other hand can not.

Aside from the above limitations you can test the documentation changes with any installed gnucash, version 2.6 or higher. Of course if you have written context help for a feature that is not present in your installed version of gnucash, you won't be able to test the direct context help button for that feature. You will however still be able to open the new help or guide in general from your installed (2.6+) version of gnucash.

If you want to test the changes you just made to the documentation without interfering with the already-installed versions, you need to install a development version of GnuCash locally first.

To test the changes,

  1. install the changed documentation locally, and
  2. tell your (locally) installed (2.6+) version of gnucash where to find it.

If you don’t want to test interaction with GnuCash, see below for a way to do that.

Install Development GnuCash Locally

Remember this can be skipped if you prefer and have version 2.6+ of gnucash installed. It's only required to run context help tests.

Without any special configuration the default installation directory will be /usr/local/... on Linux based systems. This is usually not a good location during development (or documentation changing), because this would interfere with your stable, running system and that's generally not what you want on a modern system where installing software is usually done via a package manager. So for development purposes we need to tell the build system to use another final location. This is done by running configure with the --prefix option. The installation directory should meet the following requirements:

  • it should be a writable location for the user that runs make install
  • it should not be in the default paths /usr or /usr/local

Build and install GnuCash locally as per Building. Let's say you've installed GnuCash in

 /home/$USER/code/gnucash-install

Install Updated Documentation Locally

Let's say you wish to build your modified documentation in /home/$USER/code/gnucash-docs-install

These are the commands for that using …

CMake
cd /home/$USER/code/gnucash-docs
mkdir build
cd build
cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/home/$USER/code/gnucash-docs-install /home/$USER/code/gnucash-docs # Add any other needed options...
make install
Autotools (deprecated)
cd /home/$USER/code/gnucash-docs
./autogen.sh # First time only, when building from repository copy
mkdir build
cd build
../configure --prefix=/home/$USER/code/gnucash-docs-install # Add any other needed options...
make install

Tell Development GnuCash Where to Find Docs

At first verify, what is already set: echo ${XDG_DATA_DIRS}

Then execute
GCASH=/home/$USER/code/gnucash-install          # For convenience if you built gnucash yourself, otherwise:
GCASH=/usr                                      # For convenience if you use a default installed gnucash
GCASHDOCS=/home/$USER/code/gnucash-docs-install # For convenience
GLANG=<your-language>                           # To choose a language different from your user default, can be any of the supported languages: C, de, it, pt, ja,...
# To start gnucash with your own help files:
# From the following line add only the parts which are not already set:
LANG=$GLANG XDG_DATA_DIRS="$GCASHDOCS/share:$XDG_DATA_DIRS:/usr/local/share:/usr/share" $GCASH/bin/gnucash &

That last line, with XDG_DATA_DIRS, is the crux of it. That environment variable tells GnuCash, among other things, where to look for the documentation. In fact, it tells any tool which follows XDG standards (and Yelp itself) where to look for documentation.

To directly start yelp with a document and optionally a topic, try the following:

LANG=$GLANG XDG_DATA_DIRS="$GCASHDOCS/share:$XDG_DATA_DIRS" yelp ghelp:gnucash-help#Using-Help &
# 'ghelp:' is a shortcut for 'gnome-help:'
# '#' separates the topic from the filename

That should open up your development-version GnuCash docs without first starting GnuCash itself. Handy if you don’t need to test GnuCash along with the docs--i.e., if you’re just updating sections that are already in the docs.

Conclusion

Now you can update both your local GnuCash and GnuCash docs freely and test their interaction.