Skip to content

Commit 390185c

Browse files
authored
Merge branch 'develop' into server_definitions2
2 parents 103e9ba + 44d21b8 commit 390185c

File tree

20 files changed

+881
-280
lines changed

20 files changed

+881
-280
lines changed

.github/scripts/rename/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ run from the repository root.
3131
the `xrpld` binary.
3232
5. `.github/scripts/rename/namespace.sh`: This script will rename the C++
3333
namespaces from `ripple` to `xrpl`.
34+
6. `.github/scripts/rename/config.sh`: This script will rename the config from
35+
`rippled.cfg` to `xrpld.cfg`, and updating the code accordingly. The old
36+
filename will still be accepted.
3437

3538
You can run all these scripts from the repository root as follows:
3639

@@ -40,4 +43,5 @@ You can run all these scripts from the repository root as follows:
4043
./.github/scripts/rename/cmake.sh .
4144
./.github/scripts/rename/binary.sh .
4245
./.github/scripts/rename/namespace.sh .
46+
./.github/scripts/rename/config.sh .
4347
```

.github/scripts/rename/config.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
# Exit the script as soon as an error occurs.
4+
set -e
5+
6+
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
7+
SED_COMMAND=sed
8+
if [[ "${OSTYPE}" == 'darwin'* ]]; then
9+
if ! command -v gsed &> /dev/null; then
10+
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
11+
exit 1
12+
fi
13+
SED_COMMAND=gsed
14+
fi
15+
16+
# This script renames the config from `rippled.cfg` to `xrpld.cfg`, and updates
17+
# the code accordingly. The old filename will still be accepted.
18+
# Usage: .github/scripts/rename/config.sh <repository directory>
19+
20+
if [ "$#" -ne 1 ]; then
21+
echo "Usage: $0 <repository directory>"
22+
exit 1
23+
fi
24+
25+
DIRECTORY=$1
26+
echo "Processing directory: ${DIRECTORY}"
27+
if [ ! -d "${DIRECTORY}" ]; then
28+
echo "Error: Directory '${DIRECTORY}' does not exist."
29+
exit 1
30+
fi
31+
pushd ${DIRECTORY}
32+
33+
# Add the xrpld.cfg to the .gitignore.
34+
if ! grep -q 'xrpld.cfg' .gitignore; then
35+
${SED_COMMAND} -i '/rippled.cfg/a\
36+
/xrpld.cfg' .gitignore
37+
fi
38+
39+
# Rename the files.
40+
if [ -e rippled.cfg ]; then
41+
mv rippled.cfg xrpld.cfg
42+
fi
43+
if [ -e cfg/rippled-example.cfg ]; then
44+
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
45+
fi
46+
47+
# Rename inside the files.
48+
DIRECTORIES=("cfg" "cmake" "include" "src")
49+
for DIRECTORY in "${DIRECTORIES[@]}"; do
50+
echo "Processing directory: ${DIRECTORY}"
51+
52+
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do
53+
echo "Processing file: ${FILE}"
54+
${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}"
55+
done
56+
done
57+
${SED_COMMAND} -i 's/rippled/xrpld/g' cfg/xrpld-example.cfg
58+
${SED_COMMAND} -i 's/rippled/xrpld/g' src/test/core/Config_test.cpp
59+
${SED_COMMAND} -i 's/ripplevalidators/xrplvalidators/g' src/test/core/Config_test.cpp
60+
${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' src/test/core/Config_test.cpp
61+
${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp
62+
${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp
63+
64+
65+
# Restore the old config file name in the code that maintains support for now.
66+
${SED_COMMAND} -i 's/configLegacyName = "xrpld.cfg"/configLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
67+
68+
# Restore an URL.
69+
${SED_COMMAND} -i 's/connect-your-xrpld-to-the-xrp-test-net.html/connect-your-rippled-to-the-xrp-test-net.html/g' cfg/xrpld-example.cfg
70+
71+
popd
72+
echo "Renaming complete."

.github/workflows/reusable-check-rename.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
run: .github/scripts/rename/binary.sh .
3030
- name: Check namespaces
3131
run: .github/scripts/rename/namespace.sh .
32+
- name: Check config name
33+
run: .github/scripts/rename/config.sh .
3234
- name: Check for differences
3335
env:
3436
MESSAGE: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ gmon.out
3535

3636
# Customized configs.
3737
/rippled.cfg
38+
/xrpld.cfg
3839
/validators.txt
3940

4041
# Locally patched Conan recipes

cfg/validators-example.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Default validators.txt
33
#
4-
# This file is located in the same folder as your rippled.cfg file
4+
# This file is located in the same folder as your xrpld.cfg file
55
# and defines which validators your server trusts not to collude.
66
#
77
# This file is UTF-8 with DOS, UNIX, or Mac style line endings.

0 commit comments

Comments
 (0)