<commit_before>import org.scalatest.{ BeforeAndAfter, FlatSpecLike, Matchers, OneInstancePerTest }
import scala.sys.process._
import scala.io.Source

class CacheKeyTestSpec extends FlatSpecLike with Matchers with OneInstancePerTest with BeforeAndAfter {
  private var cacheKey1: Option[String] = None
  private var cacheKey2: Option[String] = None
  private var originalGitCommit: String = ""

  // Helper methods
  def generateCacheKey(): Option[String] = {
    runStageAndCacheKey()
    getCacheKey()
  }

  def addADependency(): Unit = {
    Seq("bash", "-c", "echo libraryDependencies += \\\"org.apache.derby\\\" % \\\"derby\\\" % \\\"10.4.1.3\\\" >> test-projects/test-deploy/service/build.sbt").!!
  }

  def makeGitCommit(dir: String): Unit = {
    Seq("bash", "-c", s"""echo \"something\" >> ${dir}/forCommit.txt""").!!
    Seq("git", "add", s"""${dir}/forCommit.txt""").!!
    Seq("git", "commit", "-m", "\"commit for testing \"").!!
  }

  def runStageAndCacheKey(): Boolean = {
    Process(Seq("sbt", ";clean", ";stageAndCacheKey"), new java.io.File("./test-projects/test-deploy")).!!
    true
  }

  def getCacheKey(): Option[String] = {
    try {
      Some(Source.fromFile("./test-projects/test-deploy/service/target/universal/stage/conf/cacheKey.Sha1").getLines.mkString)
    } catch { case _ => None }<commit_msg>added documentation to CacheKeyTestSpec<commit_after>import org.scalatest.{ BeforeAndAfter, FlatSpecLike, Matchers, OneInstancePerTest }
import scala.sys.process._
import scala.io.Source
/* This Test Class is for testing cachekey generation functionality in the deployPlugin. When the stageAndCacheKey sbt task is called in that plugin, we generate * a cachekey for the current project that changes on dependency changes, and git commits to the projects src, and any git commits to local jars that the project
* depends on. We have to filter out the project & any jars that it depends on - this is a settingkey that the user needs to set themself in project/plugins.sbt*
*/
class CacheKeyTestSpec extends FlatSpecLike with Matchers with OneInstancePerTest with BeforeAndAfter {
  private var cacheKey1: Option[String] = None
  private var cacheKey2: Option[String] = None
  private var originalGitCommit: String = ""

  // Helper methods
  def generateCacheKey(): Option[String] = {
    runStageAndCacheKey()
    getCacheKey()
  }

  def addADependency(): Unit = {
    Seq("bash", "-c", "echo libraryDependencies += \\\"org.apache.derby\\\" % \\\"derby\\\" % \\\"10.4.1.3\\\" >> test-projects/test-deploy/service/build.sbt").!!
  }

  def makeGitCommit(dir: String): Unit = {
    Seq("bash", "-c", s"""echo \"something\" >> ${dir}/forCommit.txt""").!!
    Seq("git", "add", s"""${dir}/forCommit.txt""").!!
    Seq("git", "commit", "-m", "\"commit for testing \"").!!
  }

  def runStageAndCacheKey(): Boolean = {
    Process(Seq("sbt", ";clean", ";stageAndCacheKey"), new java.io.File("./test-projects/test-deploy")).!!
    true
  }

  def getCacheKey(): Option[String] = {
    try {
      Some(Source.fromFile("./test-projects/test-deploy/service/target/universal/stage/conf/cacheKey.Sha1").getLines.mkString)
    } catch { case _ => None }
{'fraction_non_alphanumeric': 0.16340694006309148, 'fraction_numerical': 0.005047318611987382, 'mean_word_length': 3.939252336448598, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7375697', 'n_tokens_mistral': 1027, 'n_tokens_neox': 978, 'n_words': 257}