|
3 | 3 | source common.sh
|
4 | 4 | source validation/configurationValidation.sh
|
5 | 5 |
|
6 |
| -function downloadGithubFile { |
| 6 | +function downloadGitHubFile { |
7 | 7 | local file=$1
|
8 | 8 | local url="https://raw.githubusercontent.com/phpbenchmarks/$slugToCopy/$GITHUB_BRANCH/$file"
|
9 | 9 | local showValidationSuccess=true
|
@@ -32,9 +32,9 @@ function downloadFilesFromGithub {
|
32 | 32 |
|
33 | 33 | readonly GITHUB_BRANCH="$slugToCopy"_"$versionToCopy"_"$RESULT_TYPE_SLUG"
|
34 | 34 | echoValidationGroupStart "Downloading files from https://github.com/phpbenchmarks/$slugToCopy/tree/$GITHUB_BRANCH"
|
35 |
| - downloadGithubFile ".phpbenchmarks/configuration.sh" |
36 |
| - downloadGithubFile ".phpbenchmarks/initBenchmark.sh" |
37 |
| - downloadGithubFile ".phpbenchmarks/vhost.conf" |
| 35 | + downloadGitHubFile ".phpbenchmarks/configuration.sh" |
| 36 | + downloadGitHubFile ".phpbenchmarks/initBenchmark.sh" |
| 37 | + downloadGitHubFile ".phpbenchmarks/vhost.conf" |
38 | 38 | source $RESULT_TYPE_PATH/downloadFilesFromGithub.sh
|
39 | 39 | echoValidationGroupEnd
|
40 | 40 | }
|
@@ -140,6 +140,43 @@ function createConfigurationFile {
|
140 | 140 | echoValidationGroupEnd
|
141 | 141 | }
|
142 | 142 |
|
| 143 | +function createInitBenchmarkFile { |
| 144 | + local initBenchmarkPath="$INSTALLATION_PATH/.phpbenchmarks/initBenchmark.sh" |
| 145 | + |
| 146 | + if [ ! -f "$initBenchmarkPath" ]; then |
| 147 | + echoValidationGroupStart "Create .phpbenchmarks/initBenchmark.sh" |
| 148 | + |
| 149 | + cp validation/mainRepository/.phpbenchmarks/initBenchmark.sh $INSTALLATION_PATH/.phpbenchmarks/ |
| 150 | + [ $? != "0" ] && exitScript "Error while writing $initBenchmarkPath." |
| 151 | + echoValidatedTest "File created." |
| 152 | + echoValidatedTest "Function initBenchmark() created." |
| 153 | + echoValidationWarning ".phpbenchmarks/initBenchmark.sh::initBenchmark() has been created, but is nearly empty. Add commands to initialize benchmark here." |
| 154 | + |
| 155 | + if [ $VERBOSE_LEVEL -eq 0 ]; then |
| 156 | + echo "" |
| 157 | + fi |
| 158 | + echoValidationGroupEnd |
| 159 | + fi |
| 160 | +} |
| 161 | + |
| 162 | +function createVhostFile { |
| 163 | + local vhostPath="$INSTALLATION_PATH/.phpbenchmarks/vhost.conf" |
| 164 | + |
| 165 | + if [ ! -f "$vhostPath" ]; then |
| 166 | + echoValidationGroupStart "Create .phpbenchmarks/vhost.conf" |
| 167 | + |
| 168 | + cp validation/mainRepository/.phpbenchmarks/vhost.conf $INSTALLATION_PATH/.phpbenchmarks/ |
| 169 | + [ $? != "0" ] && exitScript "Error while writing $vhostPath." |
| 170 | + echoValidatedTest "File created." |
| 171 | + echoValidationWarning ".phpbenchmarks/vhost.conf has been created with default nginx virtual host configuration. Edit it if needed." |
| 172 | + |
| 173 | + if [ $VERBOSE_LEVEL -eq 0 ]; then |
| 174 | + echo "" |
| 175 | + fi |
| 176 | + echoValidationGroupEnd |
| 177 | + fi |
| 178 | +} |
| 179 | + |
143 | 180 | createPhpbenchmarksDirectories
|
144 | 181 |
|
145 | 182 | echoAsk "Copy configuration files from another location? [github/NONE]" false
|
|
156 | 193 |
|
157 | 194 | createCodeLinkFile
|
158 | 195 | createConfigurationFile
|
| 196 | +createInitBenchmarkFile |
| 197 | +createVhostFile |
| 198 | +assertReadMe false |
| 199 | +source $RESULT_TYPE_PATH/initializeBranch.sh |
0 commit comments