<commit_before>/*
 * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
 */
package play.sbtplugin

import java.security.SecureRandom
import sbt._

/**
 * Provides tasks for generating and updating application secrets
 */
object ApplicationSecretGenerator {

  def generateSecret = {
    val random = new SecureRandom()

    (1 to 64).map { _ =>
      (random.nextInt(75) + 48).toChar
    }.mkString.replaceAll("\\\\+", "/")
  }

  def generateSecretTask = Def.task[String] {
    val secret = generateSecret
    Keys.streams.value.log.info("Generated new secret: " + secret)
    secret
  }

  private val ApplicationSecret = """\s*application\.secret\s*[=:].*""".r

  def updateSecretTask = Def.task[File] {
    val secret: String = play.PlayImport.PlayKeys.generateSecret.value
    val baseDir: File = Keys.baseDirectory.value
    val log = Keys.streams.value.log

    val secretConfig = s"""application.secret="$secret""""

    val applicationConf = Option(System.getProperty("config.file")).getOrElse("conf/application.conf")
    val appConfFile = new File(baseDir, applicationConf)<commit_msg>Fix hardcoded reference to conf directory<commit_after>/*
 * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
 */
package play.sbtplugin

import play.PlayImport.PlayKeys._
import java.security.SecureRandom
import sbt._

/**
 * Provides tasks for generating and updating application secrets
 */
object ApplicationSecretGenerator {

  def generateSecret = {
    val random = new SecureRandom()

    (1 to 64).map { _ =>
      (random.nextInt(75) + 48).toChar
    }.mkString.replaceAll("\\\\+", "/")
  }

  def generateSecretTask = Def.task[String] {
    val secret = generateSecret
    Keys.streams.value.log.info("Generated new secret: " + secret)
    secret
  }

  private val ApplicationSecret = """\s*application\.secret\s*[=:].*""".r

  def updateSecretTask = Def.task[File] {
    val secret: String = play.PlayImport.PlayKeys.generateSecret.value
    val baseDir: File = Keys.baseDirectory.value
    val log = Keys.streams.value.log

    val secretConfig = s"""application.secret="$secret""""

    val appConfFile = Option(System.getProperty("config.file")) match {
      case Some(applicationConf) => new File(baseDir, applicationConf)
      case None => confDirectory.value / "application.conf"
    }
{'fraction_non_alphanumeric': 0.1347061347061347, 'fraction_numerical': 0.01287001287001287, 'mean_word_length': 3.664, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6724698', 'n_tokens_mistral': 743, 'n_tokens_neox': 685, 'n_words': 161}