Skip to content

Commit 3e0fcfb

Browse files
committed
Support windows tested in git bash
1 parent 1c730f9 commit 3e0fcfb

File tree

7 files changed

+40
-14
lines changed

7 files changed

+40
-14
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Here are some reports that utilize Neo4j's [Graph Data Science Library](https://
3737

3838
## 🛠 Prerequisites
3939

40-
- Java 17 is required (June 2023 Neo4j 5.x requirement)
40+
- Java 17 is [required for Neo4j](https://neo4j.com/docs/operations-manual/current/installation/requirements/#deployment-requirements-software) (5.x requirement)
41+
- [jq](https://github.com/jqlang/jq) the "lightweight and flexible command-line JSON processor" needs to be installed. Latest releases: https://github.com/jqlang/jq/releases/latest. Check using `jq --version`.
4142
- Python and a conda package manager are required for Jupyter Notebook reports
4243
- Chromium will automatically be downloaded if needed for Jupyter Notebook reports in PDF format
4344

scripts/downloadMavenArtifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ DOWNLOAD_URL="${BASE_URL}/${GROUP_ID_FOR_API}/${artifactId}/${version}/${ARTIFAC
7070

7171
# Download Maven Artifact into the "targetDirectory"
7272
if [ ! -f "./${targetDirectory}/${ARTIFACT_FILENAME}" ] ; then
73-
source ${SCRIPTS_DIR}/download.sh --url "${DOWNLOAD_URL}"
73+
source "${SCRIPTS_DIR}/download.sh" --url "${DOWNLOAD_URL}"
7474

7575
# Create artifacts targetDirectory if it doen't exist
7676
mkdir -p "./${targetDirectory}"

scripts/executeQueryFunctions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ execute_cypher_expect_results() {
4949
# Function to execute a cypher query from the given file (first and only argument) using Neo4j's HTTP API
5050
execute_cypher_http() {
5151
# (Neo4j HTTP API Script) Execute the Cyper query contained in the file and print the results as CSV
52-
source $SCRIPTS_DIR/executeQuery.sh "${@}" # "${@}": Get all function arguments and forward them
52+
source "$SCRIPTS_DIR/executeQuery.sh" "${@}" # "${@}": Get all function arguments and forward them
5353
}
5454

5555
# Function to execute a cypher query from the given file (first and only argument) with a summarized (console) output using Neo4j's HTTP API

scripts/setupJQAssistant.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ JQASSISTANT_INSTALLATION_DIRECTORY="${TOOLS_DIRECTORY}/${JQASSISTANT_INSTALLATIO
5252
if [ ! -d "${JQASSISTANT_INSTALLATION_DIRECTORY}" ] ; then
5353
jqassistant_cli_fulldownload_url=${JQASSISTANT_CLI_DOWNLOAD_URL}/${JQASSISTANT_CLI_ARTIFACT}/${JQASSISTANT_CLI_VERSION}/${JQASSISTANT_CLI_ARTIFACT}-${JQASSISTANT_CLI_VERSION}-${JQASSISTANT_CLI_DISTRIBUTION}
5454
jqassistant_cli_fulldownload_file="${JQASSISTANT_INSTALLATION_NAME}.zip"
55-
source ${SCRIPTS_DIR}/download.sh --url "${jqassistant_cli_fulldownload_url}" --filename "${jqassistant_cli_fulldownload_file}"
55+
source "${SCRIPTS_DIR}/download.sh" --url "${jqassistant_cli_fulldownload_url}" --filename "${jqassistant_cli_fulldownload_file}"
5656

5757
# Unpack the ZIP file (-q option for less verbose output)
5858
unzip -q "${SHARED_DOWNLOADS_DIRECTORY}/${jqassistant_cli_fulldownload_file}" -d "${TOOLS_DIRECTORY}"

scripts/setupNeo4j.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,22 @@ fi
7171
# Download and extract Neo4j
7272
if [ ! -d "${NEO4J_INSTALLATION_DIRECTORY}" ] ; then
7373

74-
neo4jDownloadArchiveFileName="${NEO4J_INSTALLATION_NAME}-unix.tar.gz"
75-
source ${SCRIPTS_DIR}/download.sh --url "https://dist.neo4j.org/${neo4jDownloadArchiveFileName}" || exit 1
74+
neo4jInstallationSystemPostfix="unix.tar.gz"
75+
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
76+
neo4jInstallationSystemPostfix="windows.zip"
77+
fi
78+
echo "setupNeo4j: Using ${neo4jInstallationSystemPostfix} for operating system type ${OSTYPE}"
79+
80+
neo4jDownloadArchiveFileName="${NEO4J_INSTALLATION_NAME}-${neo4jInstallationSystemPostfix}"
81+
source "${SCRIPTS_DIR}/download.sh" --url "https://dist.neo4j.org/${neo4jDownloadArchiveFileName}" || exit 1
7682

77-
# Extract the tar file
78-
tar -xf "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jDownloadArchiveFileName}" --directory "${TOOLS_DIRECTORY}" || exit 1
83+
if [[ ${neo4jInstallationSystemPostfix} == "unix.tar.gz" ]]; then
84+
# Extract the unix tar file
85+
tar -xf "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jDownloadArchiveFileName}" --directory "${TOOLS_DIRECTORY}" || exit 1
86+
else
87+
# Unpack the windows ZIP file (-q option for less verbose output, ignore warnings (backslash) with || true)
88+
unzip -q "${SHARED_DOWNLOADS_DIRECTORY}/${neo4jDownloadArchiveFileName}" -d "${TOOLS_DIRECTORY}" || true
89+
fi
7990

8091
# Fail if Neo4j hadn't been downloaded successfully
8192
if [ ! -d "${NEO4J_INSTALLATION_DIRECTORY}" ] ; then
@@ -136,7 +147,7 @@ if [ ! -d "${NEO4J_INSTALLATION_DIRECTORY}" ] ; then
136147

137148
# Set initial password for user "neo4j" otherwise the default password "neo4j" would need to be changed immediately (prompt).
138149
# This needs to be done after the configuration changes.
139-
source ${SCRIPTS_DIR}/setupNeo4jInitialPassword.sh
150+
source "${SCRIPTS_DIR}/setupNeo4jInitialPassword.sh"
140151

141152
echo "setupNeo4j: Installed sucessfully"
142153
else
@@ -146,7 +157,7 @@ fi
146157
# Download and Install the Neo4j Plugin "Awesome Procedures for Neo4j" (APOC)
147158
if [ ! -f "${NEO4J_PLUGINS}/${NEO4J_APOC_PLUGIN_ARTIFACT}" ] ; then
148159

149-
source ${SCRIPTS_DIR}/download.sh --url "https://github.com/${NEO4J_APOC_PLUGIN_GITHUB}/releases/download/${NEO4J_APOC_PLUGIN_VERSION}/${NEO4J_APOC_PLUGIN_ARTIFACT}" || exit 1
160+
source "${SCRIPTS_DIR}/download.sh" --url "https://github.com/${NEO4J_APOC_PLUGIN_GITHUB}/releases/download/${NEO4J_APOC_PLUGIN_VERSION}/${NEO4J_APOC_PLUGIN_ARTIFACT}" || exit 1
150161

151162
# Uninstall previously installed Neo4j Plugin "Awesome Procedures for Neo4j" (APOC)
152163
rm -f "${NEO4J_PLUGINS}/apoc*.jar"
@@ -192,7 +203,7 @@ fi
192203

193204
if [ ! -f "${NEO4J_PLUGINS}/${neo4jGraphDataScienceReleaseArtifact}" ] ; then
194205
# Download the Neo4j Plugin "Graph Data Science" (GDS)
195-
source ${SCRIPTS_DIR}/download.sh --url "${neo4jGraphDataScienceDownloadUrl}/${neo4jGraphDataScienceReleaseArtifact}" || exit 1
206+
source "${SCRIPTS_DIR}/download.sh" --url "${neo4jGraphDataScienceDownloadUrl}/${neo4jGraphDataScienceReleaseArtifact}" || exit 1
196207

197208
# Uninstall previously installed Neo4j Plugin "Graph Data Science" (GDS)
198209
rm -f "${NEO4J_PLUGINS}/*graph-data-science*.jar"

scripts/setupNeo4jInitialPassword.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ fi
3030
# Print the environment variable NEO4J_HOME that is used to execute the command
3131
echo "setupNeo4jInitialPassword: Using ${NEO4J_INSTALLATION_DIRECTORY} as NEO4J_HOME"
3232

33+
isWindows=false
34+
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
35+
isWindows=true
36+
fi
37+
echo "setupNeo4jInitialPassword: Detected isWindows=${isWindows} for operating system type ${OSTYPE}"
38+
3339
# Extract the first component of the version number (=major version number)
3440
NEO4J_MAJOR_VERSION_NUMBER=$(echo "$NEO4J_VERSION" | cut -d'.' -f1)
3541

@@ -38,12 +44,20 @@ if [[ "$NEO4J_MAJOR_VERSION_NUMBER" -ge 5 ]]; then
3844
echo "setupNeo4jInitialPassword: Neo4j v5 or higher detected"
3945
# Neo4j version < 5
4046
# Set the initial password using a temporary NEO4J_HOME environment variable pointing to the current setup
41-
NEO4J_HOME="${NEO4J_INSTALLATION_DIRECTORY}" ${NEO4J_INSTALLATION_DIRECTORY}/bin/neo4j-admin dbms set-initial-password "${NEO4J_INITIAL_PASSWORD}"
47+
if [ "${isWindows}" = true ] ; then
48+
NEO4J_HOME="${NEO4J_INSTALLATION_DIRECTORY}" "${NEO4J_INSTALLATION_DIRECTORY}/bin/neo4j-admin.bat" dbms set-initial-password "${NEO4J_INITIAL_PASSWORD}"
49+
else
50+
NEO4J_HOME="${NEO4J_INSTALLATION_DIRECTORY}" "${NEO4J_INSTALLATION_DIRECTORY}/bin/neo4j-admin" dbms set-initial-password "${NEO4J_INITIAL_PASSWORD}"
51+
fi
4252
else
4353
echo "setupNeo4jInitialPassword: Neo4j v4 or lower detected"
4454
# Neo4j version >= 5
4555
# Set the initial password using a temporary NEO4J_HOME environment variable pointing to the current setup
46-
NEO4J_HOME="${NEO4J_INSTALLATION_DIRECTORY}" ${NEO4J_INSTALLATION_DIRECTORY}/bin/neo4j-admin set-initial-password "${NEO4J_INITIAL_PASSWORD}"
56+
if [ "${isWindows}" = true ] ; then
57+
NEO4J_HOME="${NEO4J_INSTALLATION_DIRECTORY}" "${NEO4J_INSTALLATION_DIRECTORY}/bin/neo4j-admin.bat" set-initial-password "${NEO4J_INITIAL_PASSWORD}"
58+
else
59+
NEO4J_HOME="${NEO4J_INSTALLATION_DIRECTORY}" "${NEO4J_INSTALLATION_DIRECTORY}/bin/neo4j-admin" set-initial-password "${NEO4J_INITIAL_PASSWORD}"
60+
fi
4761
fi
4862

4963
echo "setupNeo4jInitialPassword: Initial password set sucessfully"

scripts/startNeo4j.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ if [ -n "${neo4jNotRunning}" ]; then
8383
exit 1
8484
fi
8585

86-
source ${SCRIPTS_DIR}/waitForNeo4jHttp.sh || exit 1
86+
source "${SCRIPTS_DIR}/waitForNeo4jHttp.sh" || exit 1

0 commit comments

Comments
 (0)