<commit_before>package com.github.jrubygradle.war

import org.gradle.api.Project
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.bundling.War

/**
  *
  * @author <NAME>
  */
class JRubyWar extends War {

    static final String JRUBYWAR_MAINCLASS = 'com.lookout.jruby.WarMain'
    static final String JRUBYWAR_CONFIG = 'jrubyWar'

    /** Setting the main class allows for a runnable War.
     * By default the value is {@code JRUBYWAR_MAINCLASS}
     */
    @Input
    String mainClass = JRUBYWAR_MAINCLASS

    JRubyWar() {
        super()

        // Bring in any compiled classes from our project
        from "$project.buildDir/classes/main"

        // note that zipTree call is wrapped in closure so that configuration
        // is only resolved at execution time. This will take the embeds
        // from within the `jrubyEmbeds` configuration and dump them into the war
        from {
            project.configurations.jrubyEmbeds.collect {
                project.zipTree(it)
            }
        }
    }

    @Override
    void copy() {
        // Bring our vendored gems into the created war file
        webInf {
            from project.jruby.gemInstallDir
            into 'gems'
        }

        manifest {
            attributes 'Main-Class' : mainClass
        }
        super.copy()
    }

    /** Update dependencies on the project to include those necessary for
     * building JRubyWar's
     */
    static void updateJRubyDependencies(Project project) {
        project.dependencies {
            jrubyWar group: 'org.jruby', name: 'jruby-complete', version: project.jruby.defaultVersion
            jrubyWar (group: 'org.jruby.rack', name: 'jruby-rack', version: '1.1.+') {
                exclude module : 'jruby-complete'
            }
        }
    }
}
<commit_msg>Relocate the code for copying resources into the .war into the copy() method where they belong<commit_after>package com.github.jrubygradle.war

import org.gradle.api.Project
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.bundling.War

/**
  *
  * @author <NAME>
  */
class JRubyWar extends War {

    static final String JRUBYWAR_MAINCLASS = 'com.lookout.jruby.WarMain'
    static final String JRUBYWAR_CONFIG = 'jrubyWar'

    /** Setting the main class allows for a runnable War.
     * By default the value is {@code JRUBYWAR_MAINCLASS}
     */
    @Input
    String mainClass = JRUBYWAR_MAINCLASS

    JRubyWar() {
        super()
    }

    @Override
    void copy() {
        // Bring our vendored gems into the created war file
        webInf {
            from project.jruby.gemInstallDir
            into 'gems'
        }

        // Bring in any compiled classes from our project
        from "$project.buildDir/classes/main"

        // note that zipTree call is wrapped in closure so that configuration
        // is only resolved at execution time. This will take the embeds
        // from within the `jrubyEmbeds` configuration and dump them into the war
        from {
            project.configurations.jrubyEmbeds.collect {
                project.zipTree(it)
            }
        }

        manifest {
            attributes 'Main-Class' : mainClass
        }
        super.copy()
    }

    /** Update dependencies on the project to include those necessary for
     * building JRubyWar's
     */
    static void updateJRubyDependencies(Project project) {
        project.dependencies {
            jrubyWar group: 'org.jruby', name: 'jruby-complete', version: project.jruby.defaultVersion
            jrubyWar (group: 'org.jruby.rack', name: 'jruby-rack', version: '1.1.+') {
                exclude module : 'jruby-complete'
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.08605341246290801, 'fraction_numerical': 0.0010790396547073105, 'mean_word_length': 2.0977443609022557, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2366941', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1022, 'n_words': 311}