Example #1
0
 private void initBot(String botName) {
   log.info("creating bot...");
   try {
     botLock.lock();
     bot = new Bot(botName, arguments.getBasePath());
     chats.clear();
   } finally {
     botLock.unlock();
   }
   log.info("bot created");
 }
Example #2
0
  private void reload(String botName) throws IOException, GitAPIException {
    log.info("Starting bot reload");
    FileRepositoryBuilder builder = new FileRepositoryBuilder();
    Repository repository =
        builder.setGitDir(new File(arguments.getBasePath() + "/.git")).readEnvironment().build();
    log.info("Starting repository update");
    Git git = new Git(repository);
    git.reset().setMode(ResetCommand.ResetType.HARD).call();
    log.info("Reset complete");
    git.clean().call();
    log.info("Clean compete");
    git.fetch().call();
    log.info("Fetch complete");
    git.pull().call();
    log.info("Repository update finished");

    initBot(botName);
    log.info("Bot reloaded");
  }