@@ -9,7 +9,7 @@ yellow=$(tput setaf 3)
99green=$( tput setaf 2)
1010reset=$( tput sgr0)
1111bold=$( tput bold)
12- pythagora_dir=" pythagora "
12+ pythagora_dir=" $1 "
1313
1414function exit_handler {
1515 while [ ! -f " ./.pythagora/finishingup" ]
@@ -25,26 +25,6 @@ function exit_handler {
2525 exit 0
2626}
2727
28- commands=(basename realpath dirname)
29- found_all=true
30-
31- for cmd in " ${commands[@]} " ; do
32- if ! command -v " $cmd " > /dev/null 2>&1 ; then
33- echo " $cmd command not found"
34- found_all=false
35- fi
36- done
37-
38- if [ " $found_all " = true ] ;
39- then
40- pythagora_dir=$( basename " $( dirname " $( dirname " $( dirname " $( realpath " $0 " ) " ) " ) " ) " )
41- fi
42-
43- if [ " $pythagora_dir " == " pythagora-dev" ]
44- then
45- pythagora_dir=" @pythagora.io/pythagora-dev"
46- fi
47-
4828for (( i= 0 ; i< ${# args[@]} ; i++ ))
4929do
5030 if [[ " ${args[$i]} " =~ ^--init[-_]command$ ]]
7151 exit 0
7252 elif [[ " ${args[$i]} " == " --review" ]]
7353 then
74- PYTHAGORA_CONFIG=" $@ " node " ./node_modules/ ${pythagora_dir} /src/scripts/review.js"
54+ PYTHAGORA_CONFIG=" $@ " node " ${pythagora_dir} /src/scripts/review.js"
7555 exit 0
7656 elif [[ " ${args[$i]} " == " --tests-eligible-for-export" ]]
7757 then
7858 echo " ${yellow}${bold} Tests eligible for export:${reset} "
79- PYTHAGORA_CONFIG=" $@ " node " ./node_modules/ ${pythagora_dir} /src/scripts/testsEligibleForExport.js"
59+ PYTHAGORA_CONFIG=" $@ " node " ${pythagora_dir} /src/scripts/testsEligibleForExport.js"
8060 exit 0
8161 elif [[ " ${args[$i]} " == " --unit-tests" ]]
8262 then
8363 echo " ${green}${bold} Generating unit tests...${reset} "
84- PYTHAGORA_CONFIG=" $@ " node " ./node_modules/ ${pythagora_dir} /src/scripts/unit.js"
64+ PYTHAGORA_CONFIG=" $@ " node " ${pythagora_dir} /src/scripts/unit.js"
8565 exit 0
8666 elif [[ " ${args[$i]} " == " --export-setup" ]]
8767 then
88- PYTHAGORA_CONFIG=" $@ " node " ./node_modules/ ${pythagora_dir} /src/scripts/enterData.js"
68+ PYTHAGORA_CONFIG=" $@ " node " ${pythagora_dir} /src/scripts/enterData.js"
8969 exit 0
9070 elif [[ " ${args[$i]} " =~ ^--rename[-_]tests$ ]]
9171 then
92- node " ./node_modules/ ${pythagora_dir} /src/scripts/renameTests.js"
72+ node " ${pythagora_dir} /src/scripts/renameTests.js"
9373 exit 0
9474 elif [[ " ${args[$i]} " =~ ^--delete[-_]all[-_]failed$ ]]
9575 then
96- node " ./node_modules/ ${pythagora_dir} /src/scripts/deleteAllFailed.js"
76+ node " ${pythagora_dir} /src/scripts/deleteAllFailed.js"
9777 exit 0
9878 elif [[ " ${args[$i]} " == " --delete" ]]
9979 then
100- PYTHAGORA_CONFIG=" $@ " node " ./node_modules/ ${pythagora_dir} /src/scripts/deleteTest.js"
80+ PYTHAGORA_CONFIG=" $@ " node " ${pythagora_dir} /src/scripts/deleteTest.js"
10181 exit 0
10282 elif [[ " ${args[$i]} " == " --export" ]]
10383 then
104- PYTHAGORA_CONFIG=" $@ " node -e " require('./node_modules/ ${pythagora_dir} /src/commands/export.js').runExport()"
84+ PYTHAGORA_CONFIG=" $@ " node -e " require('${pythagora_dir} /src/commands/export.js').runExport()"
10585 exit 0
10686 elif [[ " ${args[$i]} " == " --mode" ]]
10787 then
11898if [[ " ${args[@]} " =~ " --no-code-coverage " ]] || ([[ ! " ${args[@]} " =~ " --mode test " ]] && [[ ! " ${args[@]} " =~ " --mode=test " ]])
11999then
120100 args=( " ${args[@]// --no-code-coverage/ } " )
121- PYTHAGORA_CONFIG=" $@ " NODE_OPTIONS=" ${inspect} --require ./node_modules/ ${pythagora_dir} /src/RunPythagora.js" $init_command &
101+ PYTHAGORA_CONFIG=" $@ " NODE_OPTIONS=" ${inspect} --require ${pythagora_dir} /src/RunPythagora.js" $init_command &
122102else
123103 nyc_args=( " --reporter=text-summary" )
124104
@@ -129,11 +109,11 @@ else
129109 nyc_args+=( " --report-dir=./pythagora_tests/code_coverage_report" )
130110 fi
131111
132- if [ -f " ./node_modules/ $pythagora_dir /node_modules/nyc/bin/nyc.js" ]
112+ if [ -f " $pythagora_dir /node_modules/nyc/bin/nyc.js" ]
133113 then
134- PYTHAGORA_CONFIG=" $@ " NODE_OPTIONS=" ${inspect} --require ./node_modules/ ${pythagora_dir} /src/RunPythagora.js" ./node_modules/ " $pythagora_dir " /node_modules/nyc/bin/nyc.js " ${nyc_args[@]} " $init_command &
114+ PYTHAGORA_CONFIG=" $@ " NODE_OPTIONS=" ${inspect} --require ${pythagora_dir} /src/RunPythagora.js" " $pythagora_dir " /node_modules/nyc/bin/nyc.js " ${nyc_args[@]} " $init_command &
135115 else
136- PYTHAGORA_CONFIG=" $@ " NODE_OPTIONS=" ${inspect} --require ./node_modules/ ${pythagora_dir} /src/RunPythagora.js" ./node_modules/nyc/bin/nyc.js " ${nyc_args[@]} " $init_command &
116+ PYTHAGORA_CONFIG=" $@ " NODE_OPTIONS=" ${inspect} --require ${pythagora_dir} /src/RunPythagora.js" ./node_modules/nyc/bin/nyc.js " ${nyc_args[@]} " $init_command &
137117 fi
138118
139119fi
0 commit comments