Skip to content

Commit 861dcad

Browse files
committed
Add a __VERSION__ file to reduce duplicate info
- Make sure to update and commit `__VERSION__` before tagging a new release - CMake pulls it's version info from here - FORD files can include the latest stable version string with `{!__VERSION__!}` - Other Markdown pages (README.md, CONTRIBUTING.md and CHANGELOG.md) must be manually updated since GitHub flavored markdown has no include syntax - Throw errors when tags don't match __VERSION__
1 parent 1f554d3 commit 861dcad

File tree

6 files changed

+40
-15
lines changed

6 files changed

+40
-15
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ before_script:
7373
mv $f src/tests/jf_test_${f%.md}.f90
7474
done
7575
fi
76+
- |
77+
if [ "$TRAVIS_TAG" ]; then
78+
if [[ "v$TRAVIS_TAG" != "v$(cat __VERSION__)" ]]; then
79+
echo "ERROR: You are trying to tag a new release but have a version missmatch in \`__VERSION__\`"
80+
false # throw an error
81+
fi
82+
fi
7683
7784
script:
7885
- echo $BUILD_SCRIPT

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ include ( "cmake/checkOutOfSource.cmake" )
3131
project ( jsonfortran NONE )
3232

3333
#----------------------------------
34-
# Set version (semantic versioning)
34+
# Get version (semantic versioning)
3535
# C.F. semver.org
3636
#----------------------------------
37-
set ( VERSION_MAJOR 4 )
38-
set ( VERSION_MINOR 1 )
39-
set ( VERSION_PATCH 1 )
40-
set ( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
37+
file ( STRINGS "${CMAKE_SOURCE_DIR}/__VERSION__" VERSION )
38+
string( REPLACE "." ";" VERSION_LIST ${VERSION} )
39+
list(GET VERSION_LIST 0 VERSION_MAJOR)
40+
list(GET VERSION_LIST 1 VERSION_MINOR)
41+
list(GET VERSION_LIST 2 VERSION_PATCH)
42+
message ( STATUS "CMake build configuration for JSON-Fortran ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
4143

4244
#-------------------------------------
4345
# Collect source files for the library

__VERSION__

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.1.1

json-fortran.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project: json-fortran
1+
project: JSON-Fortran
22
favicon: ./media/json-fortran-32x32.png
33
project_dir: ./src
44
output_dir: ./doc
@@ -28,18 +28,28 @@ md_extensions: markdown.extensions.toc
2828
# Brief description
2929

3030
A user-friendly and object-oriented API for reading and writing JSON files, written in
31-
modern Fortran (Fortran 2003+). The source code is a single Fortran module file ([json_module.F90](https://github.com/jacobwilliams/json-fortran/blob/master/src/json_module.F90)).
31+
modern Fortran (Fortran 2003+). The source code is a single Fortran
32+
module file
33+
([json_module.F90](|url|/sourcefile/json_module.f90.html)).
3234

3335
# License
3436

35-
The json-fortran source code and related files and documentation are distributed under a permissive free software license (BSD-style). See the [LICENSE](https://raw.githubusercontent.com/jacobwilliams/json-fortran/master/LICENSE) file for more details.
37+
The JSON-Fortran source code and related files and documentation are
38+
distributed under a permissive free software license (BSD-style). See
39+
the
40+
[LICENSE](|url|/page/development-resources/LICENSE.html)
41+
file for more details.
3642

37-
# Offficial Releases
43+
# Official Releases
3844

39-
Browse the documentation for a particular release
45+
The **current stable release** is **{!__VERSION__!}** and can be [downloaded
46+
on GitHub](https://github.com/jacobwilliams/json-fortran/releases/latest)
47+
or installed with [Homebrew](http://brew.sh) on Mac OSX.
48+
49+
Browse the documentation for current and past releases
4050
[here](|url|/page/releases/index.html) or download the latest official
4151
release
42-
[here](https://github.com/jacobwilliams/json-fortran/releases/tag/4.1.1).
52+
[here](https://github.com/jacobwilliams/json-fortran/releases/latest).
4353

4454
# Miscellaneous
4555

pages/index.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
title: Additional Documentation
22

3-
# Past releases
3+
# Current Stable Release
4+
5+
[**{!__VERSION__!}**](http://jacobwilliams.github.io/json-fortran/{!__VERSION__!}/index.html)
6+
7+
# Past Releases
48

59
Docementation for official, tagged releases can be found
610
[here](releases/index.html), including the changelog, and download links.
711

8-
# Development documentation
12+
# DeveLopment Documentation
913

1014
Additional documentation useful to JSON-Fortran contributors can be
1115
found [here](development-resources/index.html), including contributing guidlines
1216
and test coverage reports.
1317

14-
# General documentation
18+
# General Documentation
1519

1620
A [README](README.html), the same one that's posted on
1721
[Github](https://github.com/jacobwilliams/json-fortran), can be found

pages/releases/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ of the `master` branch, please head back to the
1111

1212
## Latest Stable Release
1313

14-
**Documentation:** [4.1.1](http://jacobwilliams.github.io/json-fortran/4.1.1/json_module_F90.html)
14+
**Documentation:**
15+
[{!__VERSION__!}](http://jacobwilliams.github.io/json-fortran/{!__VERSION__!}/index.html)
1516

1617
**Download:**
1718
<https://github.com/jacobwilliams/json-fortran/releases/latest>

0 commit comments

Comments
 (0)