<commit_before>package io.sledge.deployer.crx

import com.github.ajalt.clikt.output.TermUi.echo
import io.sledge.deployer.crx.command.*
import io.sledge.deployer.http.HttpClient
import io.sledge.deployer.zip.Unarchiver
import io.sledge.deployer.zip.Unarchiver.Companion.VLT_PROPERTIES
import java.io.File

class CrxDeployer {

    fun deploy(configuration: CrxConfiguration) {

        if (configuration == null) {
            echo("ERROR: Deployment definition name not found in Sledge file.", err = true)
        }

        val httpClient = HttpClient(configuration)
        configuration.deploymentDefinition.let {
            echo("Start deployment for ${configuration.deploymentDefinition.name}")
            for (artifact in configuration.deploymentDefinition.deploymentArtifacts) {
                val packageName = Unarchiver().unzipPropertiesFile(artifact.filePath, VLT_PROPERTIES)
                executePost(httpClient, Uninstall, packageName)
                executePost(httpClient, Remove, "x")
                executePost(httpClient, Upload, "x", Pair("file", File(artifact.filePath)))
                executePost(httpClient, Install, packageName)
            }
        }

    }
}<commit_msg>Fixing issue with hardcoded package name.<commit_after>package io.sledge.deployer.crx

import com.github.ajalt.clikt.output.TermUi.echo
import io.sledge.deployer.crx.command.*
import io.sledge.deployer.http.HttpClient
import io.sledge.deployer.zip.Unarchiver
import io.sledge.deployer.zip.Unarchiver.Companion.VLT_PROPERTIES
import java.io.File

class CrxDeployer {

    fun deploy(configuration: CrxConfiguration) {

        if (configuration == null) {
            echo("ERROR: Deployment definition name not found in Sledge file.", err = true)
        }

        val httpClient = HttpClient(configuration)
        configuration.deploymentDefinition.let {
            echo("Start deployment for ${configuration.deploymentDefinition.name}")
            for (artifact in configuration.deploymentDefinition.deploymentArtifacts) {
                val packageName = Unarchiver().unzipPropertiesFile(artifact.filePath, VLT_PROPERTIES)
                executePost(httpClient, Uninstall, packageName)
                executePost(httpClient, Remove, packageName)
                executePost(httpClient, Upload, packageName, Pair("file", File(artifact.filePath)))
                executePost(httpClient, Install, packageName)
            }
        }

    }
}
{'fraction_non_alphanumeric': 0.09161237785016287, 'fraction_numerical': 0.0, 'mean_word_length': 3.074626865671642, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5212770', 'n_tokens_mistral': 699, 'n_tokens_neox': 660, 'n_words': 131}