| 310 | } |
| 311 | |
| 312 | func parseProjectConfiguration(configuration Configuration, path string) Configuration { |
| 313 | file, err := os.Open(path) |
| 314 | |
| 315 | if err != nil { |
| 316 | say.Debug("No project configuration file found. (" + path + ") Error: " + err.Error()) |
| 317 | return configuration |
| 318 | } else { |
| 319 | say.Debug("Found project configuration file at " + path) |
| 320 | } |
| 321 | |
| 322 | fileScanner := bufio.NewScanner(file) |
| 323 | |
| 324 | for fileScanner.Scan() { |
| 325 | line := strings.TrimSpace(fileScanner.Text()) |
| 326 | say.Debug(line) |
| 327 | if !strings.Contains(line, "=") { |
| 328 | say.Debug("Skip line because line contains no =. Line=" + line) |
| 329 | continue |
| 330 | } |
| 331 | key := line[0:strings.Index(line, "=")] |
| 332 | value := strings.TrimPrefix(line, key+"=") |
| 333 | say.Debug("Key is " + key) |
| 334 | say.Debug("Value is " + value) |
| 335 | switch key { |
| 336 | case "MOB_VOICE_COMMAND", "MOB_VOICE_MESSAGE", "MOB_NOTIFY_COMMAND", "MOB_NOTIFY_MESSAGE", "MOB_OPEN_COMMAND": |
| 337 | say.Warning("Skipped overwriting key " + key + " from project/.mob file out of security reasons!") |
| 338 | case "MOB_CLI_NAME": |
| 339 | setUnquotedString(&configuration.CliName, key, value) |
| 340 | case "MOB_REMOTE_NAME": |
| 341 | setUnquotedString(&configuration.RemoteName, key, value) |
| 342 | case "MOB_WIP_COMMIT_MESSAGE": |
| 343 | setUnquotedString(&configuration.WipCommitMessage, key, value) |
| 344 | case "MOB_START_COMMIT_MESSAGE": |
| 345 | setUnquotedString(&configuration.StartCommitMessage, key, value) |
| 346 | case "MOB_SKIP_CI_PUSH_OPTION_ENABLED": |
| 347 | setBoolean(&configuration.SkipCiPushOptionEnabled, key, value) |
| 348 | case "MOB_GIT_HOOKS_ENABLED": |
| 349 | setBoolean(&configuration.GitHooksEnabled, key, value) |
| 350 | case "MOB_REQUIRE_COMMIT_MESSAGE": |
| 351 | setBoolean(&configuration.RequireCommitMessage, key, value) |
| 352 | case "MOB_NEXT_STAY": |
| 353 | setBoolean(&configuration.NextStay, key, value) |
| 354 | case "MOB_START_CREATE": |
| 355 | setBoolean(&configuration.StartCreate, key, value) |
| 356 | case "MOB_WIP_BRANCH_QUALIFIER": |
| 357 | setUnquotedString(&configuration.WipBranchQualifier, key, value) |
| 358 | case "MOB_WIP_BRANCH_QUALIFIER_SEPARATOR": |
| 359 | setUnquotedString(&configuration.WipBranchQualifierSeparator, key, value) |
| 360 | case "MOB_WIP_BRANCH_PREFIX": |
| 361 | setUnquotedString(&configuration.WipBranchPrefix, key, value) |
| 362 | case "MOB_DONE_SQUASH": |
| 363 | setMobDoneSquash(&configuration, key, value) |
| 364 | case "MOB_TIMER": |
| 365 | setUnquotedString(&configuration.Timer, key, value) |
| 366 | case "MOB_TIMER_ROOM": |
| 367 | setUnquotedString(&configuration.TimerRoom, key, value) |
| 368 | case "MOB_TIMER_ROOM_USE_WIP_BRANCH_QUALIFIER": |
| 369 | setBoolean(&configuration.TimerRoomUseWipBranchQualifier, key, value) |