<commit_before>// Do not forget to set the Grape settings (http://groovy.codehaus.org/Grape#Grape-CustomizeIvysettings)
@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.6')

import groovy.util.CliBuilder
import groovyx.net.http.*
import static groovyx.net.http.Method.*
import static groovyx.net.http.ContentType.*

println "Deploying on GitHub..."

// CLI arguments parsing

def cli = new CliBuilder(usage: 'deploy')
cli.u(longOpt: 'user', args: 1, argName: 'user', required: true, 'GitHub user')
cli.i(longOpt: 'token', args: 1, argName: 'token', required: true, 'GitHub API token')
cli.t(longOpt: 'tag', args: 1, argName: 'tag', required: true, 'GitHub tag name')
cli.d(longOpt: 'debug', 'Enables debugging')
cli.d(longOpt: 'verbose', 'Enables verbose')
cli.x(longOpt: 'delete', 'Deletes the release instead of creating it')
def options = cli.parse(args)
if (options == null) System.exit(-1)
gitHubUser = options.user
gitHubToken = options.token
def gitHubTag = options.tag
def debug = options.debug
def verbose = options.verbose
def delete = options.delete

// Summary

println "* GitHub user:  ${gitHubUser}"
println "* GitHub token: ${gitHubToken}"
println "* GitHub tag:   ${gitHubTag}"

// Globals
url = "https://api.github.com/repos/dcoraboeuf/ontrack/releases"

// Logging
System.setProperty('org.apache.commons.logging.Log', 'org.apache.commons.logging.impl.SimpleLog')
if (verbose) System.setProperty('org.apache.commons.logging.simplelog.log.org.apache.http.wire', 'DEBUG')
else if (debug) System.setProperty('org.apache.commons.logging.simplelog.log.org.apache.http.headers', 'DEBUG')

// Deletion mode
if (delete) {
    def release = findRelease(gitHubTag) { id ->
        def http = new HTTPBuilder("${url}/${id}")
        authSetup(http)
        http.request(DELETE) { req -><commit_msg>#230 Removing the trace for the API token<commit_after>// Do not forget to set the Grape settings (http://groovy.codehaus.org/Grape#Grape-CustomizeIvysettings)
@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.6')

import groovy.util.CliBuilder
import groovyx.net.http.*
import static groovyx.net.http.Method.*
import static groovyx.net.http.ContentType.*

println "Deploying on GitHub..."

// CLI arguments parsing

def cli = new CliBuilder(usage: 'deploy')
cli.u(longOpt: 'user', args: 1, argName: 'user', required: true, 'GitHub user')
cli.i(longOpt: 'token', args: 1, argName: 'token', required: true, 'GitHub API token')
cli.t(longOpt: 'tag', args: 1, argName: 'tag', required: true, 'GitHub tag name')
cli.d(longOpt: 'debug', 'Enables debugging')
cli.d(longOpt: 'verbose', 'Enables verbose')
cli.x(longOpt: 'delete', 'Deletes the release instead of creating it')
def options = cli.parse(args)
if (options == null) System.exit(-1)
gitHubUser = options.user
gitHubToken = options.token
def gitHubTag = options.tag
def debug = options.debug
def verbose = options.verbose
def delete = options.delete

// Summary

println "* GitHub user:  ${gitHubUser}"
println "* GitHub tag:   ${gitHubTag}"

// Globals
url = "https://api.github.com/repos/dcoraboeuf/ontrack/releases"

// Logging
System.setProperty('org.apache.commons.logging.Log', 'org.apache.commons.logging.impl.SimpleLog')
if (verbose) System.setProperty('org.apache.commons.logging.simplelog.log.org.apache.http.wire', 'DEBUG')
else if (debug) System.setProperty('org.apache.commons.logging.simplelog.log.org.apache.http.headers', 'DEBUG')

// Deletion mode
if (delete) {
    def release = findRelease(gitHubTag) { id ->
        def http = new HTTPBuilder("${url}/${id}")
        authSetup(http)
        http.request(DELETE) { req ->
{'fraction_non_alphanumeric': 0.15668202764976957, 'fraction_numerical': 0.004066142586066685, 'mean_word_length': 4.774647887323944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4474923', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1212, 'n_words': 309}