apply plugin: 'elasticsearch.build'

Map<String, String> vagrantEnvVars = [
        'VAGRANT_CWD'           : "${project.projectDir.absolutePath}",
        'VAGRANT_VAGRANTFILE'   : 'Vagrantfile',
        'VAGRANT_PROJECT_DIR'   : "${project.projectDir.absolutePath}"
]

String box = "test.shibboleth.elastic.local"

task update(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
    command 'box'
    subcommand 'update'
    boxName box
    environmentVars vagrantEnvVars
}

task up(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
    command 'up'
    args '--provision', '--provider', 'virtualbox'
    boxName box
    environmentVars vagrantEnvVars
    dependsOn update
}

task halt(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
    command 'halt'
    boxName box
    environmentVars vagrantEnvVars
}

task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
    command 'destroy'
    args '-f'
    boxName box
    environmentVars vagrantEnvVars
    dependsOn halt
}

thirdPartyAudit.enabled = false
unitTest.enabled = false
jarHell.enabled = false