Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Commit 25ea185

Browse files
author
Daniel Kaminski de Souza
committed
🎨 Code format.
1 parent 3d1b14d commit 25ea185

18 files changed

+110
-114
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"vars":[{"line":0,"kind":2,"name":"strict","containerName":""},{"line":1,"name":"$regex","containerName":null,"kind":13,"localvar":"my","defintion":"my"},{"line":4,"name":"@ARGV","containerName":null,"kind":13}],"version":3}

scripts/helpers/cache.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
22

33
get_latest_download() {
4-
local cache="$1" # Save first argument in a variable
4+
local cache="$1" # Save first argument in a variable
55
local filename_glob="$2"
66
cd $cache
77
{ # try
88
latest_download="$(ls -r $filename_glob | head -1)"
99
#save your output
10-
} 2> /dev/null || {
10+
} 2>/dev/null || {
1111
# catch
1212
# save log for exception
1313
latest_download=()
@@ -16,30 +16,29 @@ get_latest_download() {
1616
}
1717

1818
check_if_there_is_need_to_download() {
19-
local cache="$1" # Save first argument in a variable
20-
local file_URL="$2" # Save first argument in a variable
21-
local filename="$3" # Save first argument in a variable
19+
local cache="$1" # Save first argument in a variable
20+
local file_URL="$2" # Save first argument in a variable
21+
local filename="$3" # Save first argument in a variable
2222
get_latest_download $cache $filename*
2323

2424
file_to_download=()
2525
if [ ! "$latest_download" ]; then
2626
file_to_download=($file_URL/$filename)
2727
fi
2828
}
29-
get_list_of_files_to_download(){
29+
get_list_of_files_to_download() {
3030
# $1 cache folder
3131
# $2..n files to check if available in cache
32-
local cache="$1" # Save first argument in a variable
33-
shift # Shift all arguments to the left (original $1 gets lost)
32+
local cache="$1" # Save first argument in a variable
33+
shift # Shift all arguments to the left (original $1 gets lost)
3434
local files_info=("$@") # Rebuild the array with rest of arguments
3535
local pattern='(.*):+(.*)'
3636

3737
files_to_download=()
3838

39-
for file_info in "${files_info[@]}"
40-
do
39+
for file_info in "${files_info[@]}"; do
4140
[[ $file_info =~ $pattern ]]
4241
check_if_there_is_need_to_download $cache ${BASH_REMATCH[1]} ${BASH_REMATCH[2]}
4342
files_to_download+=($file_to_download)
4443
done
45-
}
44+
}

scripts/helpers/cached_download.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22

33
source=${BASH_SOURCE[0]}
44

5-
cached_download(){
5+
cached_download() {
66
. $(dirname $source)/get_source_dir.sh
77
local this_directory=$(get_source_dir $source)
88
. $this_directory/cache.sh
99
. $this_directory/download_files.sh
1010
. $this_directory/delete_duplicates.sh
1111
# $1 download_info
1212
# $2 cache_folder
13-
local cache="$1" # Save first argument in a variable
14-
shift # Shift all arguments to the left (original $1 gets lost)
13+
local cache="$1" # Save first argument in a variable
14+
shift # Shift all arguments to the left (original $1 gets lost)
1515
local files_info=("$@") # Rebuild the array with rest of arguments
1616
get_list_of_files_to_download $cache "${files_info[@]}"
1717
download_files $cache "${files_to_download[@]}"
1818
delete_duplicates $cache # just in case
1919
cached_downloads=()
2020
local pattern='(.*):+(.*)'
21-
for file_info in ${files_info[@]}
22-
do
21+
for file_info in ${files_info[@]}; do
2322
[[ $file_info =~ $pattern ]]
2423
local file_name=${BASH_REMATCH[2]}
2524
get_latest_download $cache $file_name
2625
cached_downloads+=($cache/$latest_download)
2726
done
28-
}
27+
}

scripts/helpers/delete_duplicates.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# sudo apt-get install fdupes
44

5-
delete_duplicates(){
5+
delete_duplicates() {
66
local folder_to_look_for_duplicates="$1"
77
fdupes -rdN $folder_to_look_for_duplicates
8-
}
8+
}

scripts/helpers/download_files.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
source=${BASH_SOURCE[0]}
44
. $(dirname $source)/get_source_dir.sh
55

6-
download_files(){
6+
download_files() {
77
local this_directory=$(get_source_dir $source)
8-
local cache="$1" # Save first argument in a variable
9-
shift # Shift all arguments to the left (original $1 gets lost)
8+
local cache="$1" # Save first argument in a variable
9+
shift # Shift all arguments to the left (original $1 gets lost)
1010
local files_to_download=("$@") # Rebuild the array with rest of arguments
1111
local number_of_files_to_download=${#files_to_download[@]}
1212

@@ -15,4 +15,4 @@ download_files(){
1515
get_number_of_logical_processors
1616
echo ${files_to_download[@]} | xargs -n 1 -P $logical_cpus wget -q -P $cache --show-progress
1717
fi
18-
}
18+
}

scripts/helpers/execute_start.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,25 @@ if [ ! -d "neo4j/data/databases/graph.db" ]; then
1010
echo "Neo4j not installed correctly, run ./scripts/install_neo4j"
1111
exit 1
1212
else
13-
echo "dbms.allow_upgrade=true" >> ./neo4j/conf/neo4j.conf
14-
echo "dbms.recovery.fail_on_missing_files=false" >> ./neo4j/conf/neo4j.conf
13+
echo "dbms.allow_upgrade=true" >>./neo4j/conf/neo4j.conf
14+
echo "dbms.recovery.fail_on_missing_files=false" >>./neo4j/conf/neo4j.conf
1515
# Set initial and max heap to workaround JVM in docker issues
1616
dbms_memory_heap_initial_size="2048m" dbms_memory_heap_max_size="2048m" ./neo4j/bin/neo4j start
1717
echo "Waiting up to 2 minutes for neo4j bolt port ($BOLT_PORT)"
1818

1919
echo "Endpoint is $localhost:$BOLT_PORT"
20-
for i in {1..120};
21-
do
22-
nc -z $localhost $BOLT_PORT -w 2
23-
is_up=$?
24-
if [ $is_up -eq 0 ]; then
25-
echo
26-
echo "Successfully started, neo4j bolt available on $BOLT_PORT"
27-
break
28-
fi
29-
sleep 1
30-
echo -n "."
20+
for i in {1..120}; do
21+
nc -z $localhost $BOLT_PORT -w 2
22+
is_up=$?
23+
if [ $is_up -eq 0 ]; then
24+
echo
25+
echo "Successfully started, neo4j bolt available on $BOLT_PORT"
26+
break
27+
fi
28+
sleep 1
29+
echo -n "."
3130
done
3231
echo
3332
# Wait a further 5 seconds after the port is available
3433
sleep 5
35-
fi
34+
fi

scripts/helpers/execute_stop.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ rm -r neo4j/data/databases/graph.db
1212

1313
echo "Waiting up to 2 minutes for neo4j bolt port ($BOLT_PORT)"
1414

15-
for i in {1..120};
16-
do
17-
nc -z $localhost $BOLT_PORT -w 2
18-
is_up=$?
19-
if [ $is_up -eq 0 ]; then
20-
echo
21-
echo "Successfully started, neo4j bolt available on $BOLT_PORT"
22-
break
23-
fi
24-
sleep 1
25-
echo -n "."
15+
for i in {1..120}; do
16+
nc -z $localhost $BOLT_PORT -w 2
17+
is_up=$?
18+
if [ $is_up -eq 0 ]; then
19+
echo
20+
echo "Successfully started, neo4j bolt available on $BOLT_PORT"
21+
break
22+
fi
23+
sleep 1
24+
echo -n "."
2625
done
2726
echo
2827
# Wait a further 5 seconds after the port is available
29-
sleep 5
28+
sleep 5

scripts/helpers/execute_wait.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ load_env_vars
99
echo "Waiting up to 2 minutes for graphql http port ($HTTP_PORT)"
1010

1111
. $this_directory/helpers/get_local_host.sh
12-
for i in {1..120};
13-
do
14-
nc -z $(get_local_host) $HTTP_PORT -w 2
15-
is_up=$?
16-
if [ $is_up -eq 0 ]; then
17-
echo
18-
echo "Successfully started, graphql http available on $HTTP_PORT"
19-
break
20-
fi
21-
sleep 1
22-
echo -n "."
12+
for i in {1..120}; do
13+
nc -z $(get_local_host) $HTTP_PORT -w 2
14+
is_up=$?
15+
if [ $is_up -eq 0 ]; then
16+
echo
17+
echo "Successfully started, graphql http available on $HTTP_PORT"
18+
break
19+
fi
20+
sleep 1
21+
echo -n "."
2322
done
24-
echo
23+
echo

scripts/helpers/get_local_host.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
source=${BASH_SOURCE[0]}
33
. $(dirname $source)/get_source_dir.sh
44

5-
get_local_host(){
5+
get_local_host() {
66
local this_directory=$(get_source_dir $source)
77
local localhost=$(perl $this_directory/regex.pl "$(cat /etc/resolv.conf)")
88
echo $localhost
99
}
10-
# echo "$(get_local_host)"
10+
# echo "$(get_local_host)"
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
get_number_of_logical_processors(){
4-
logical_cpus=$([ $(uname) = 'Darwin' ] &&
5-
sysctl -n hw.logicalcpu_max ||
6-
lscpu -p | egrep -v '^#' | wc -l)
7-
}
3+
get_number_of_logical_processors() {
4+
logical_cpus=$([ $(uname) = 'Darwin' ] &&
5+
sysctl -n hw.logicalcpu_max ||
6+
lscpu -p | egrep -v '^#' | wc -l)
7+
}

0 commit comments

Comments
 (0)