<commit_before>package cz.alenkacz.gradle.marathon.deploy

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction

class DeployTask extends DefaultTask {
    def PluginExtension pluginExtension

    public DeployTask() {
        group = 'publishing'
        description = 'Deploys your application to Marathon'
    }
    @TaskAction
    def deployToMarathon() {
        project.exec { execSpec ->
            if (!pluginExtension.url) {
                throw new Exception("Missing required property marathon url")
            }

            if (!pluginExtension.dockerImageName) {
                throw new Exception("Missing required property dockerImageName")
            }

            if (!pluginExtension.pathToJsonFile || !new File(pluginExtension.pathToJsonFile).exists()) {
                throw new Exception("Invalid path to marathon json ${pluginExtension.pathToJsonFile}")
            }

            def jsonAbsolutePath = file(pluginExtension.pathToJsonFile).absolutePath
            ArrayList<Object> dockerRunCmd = []

            dockerRunCmd.addAll(['docker', 'run', '-v', "$jsonAbsolutePath:/marathon.json",
                                 '-e', "MARATHON_URL=${pluginExtension.url}",
                                 '-e', "DOCKER_IMAGE_NAME=${pluginExtension.dockerImageName}"])

            dockerRunCmd << 'avastsoftware/marathon-deployer:latest'

            execSpec.commandLine 'docker', 'pull', '-a', 'avastsoftware/marathon-deployer:latest'

            execSpec.commandLine dockerRunCmd.toArray()
        }
    }
}<commit_msg>Use java.io File class directly<commit_after>package cz.alenkacz.gradle.marathon.deploy

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction

class DeployTask extends DefaultTask {
    def PluginExtension pluginExtension

    public DeployTask() {
        group = 'publishing'
        description = 'Deploys your application to Marathon'
    }
    @TaskAction
    def deployToMarathon() {
        project.exec { execSpec ->
            if (!pluginExtension.url) {
                throw new Exception("Missing required property marathon url")
            }

            if (!pluginExtension.dockerImageName) {
                throw new Exception("Missing required property dockerImageName")
            }

            if (!pluginExtension.pathToJsonFile || !new File(pluginExtension.pathToJsonFile).exists()) {
                throw new Exception("Invalid path to marathon json ${pluginExtension.pathToJsonFile}")
            }

            def jsonAbsolutePath = new File(pluginExtension.pathToJsonFile).absolutePath
            ArrayList<Object> dockerRunCmd = []

            dockerRunCmd.addAll(['docker', 'run', '-v', "$jsonAbsolutePath:/marathon.json",
                                 '-e', "MARATHON_URL=${pluginExtension.url}",
                                 '-e', "DOCKER_IMAGE_NAME=${pluginExtension.dockerImageName}"])

            dockerRunCmd << 'avastsoftware/marathon-deployer:latest'

            execSpec.commandLine 'docker', 'pull', '-a', 'avastsoftware/marathon-deployer:latest'

            execSpec.commandLine dockerRunCmd.toArray()
        }
    }
}
{'fraction_non_alphanumeric': 0.10189274447949527, 'fraction_numerical': 0.0, 'mean_word_length': 2.4133476856835308, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3436960', 'n_tokens_mistral': 850, 'n_tokens_neox': 784, 'n_words': 163}