<commit_before>import groovy.text.SimpleTemplateEngine
import org.vertx.groovy.core.http.RouteMatcher

def grails = ['1.3.7','1.3.8','1.3.9','2.0.0','2.0.1','2.0.2','2.0.3','2.0.4','2.1.0','2.1.1']
def candidates = [grails:grails]
def defaults = [grails:'2.1.1']

def gvmVersion = '0.4'
def serverVersion = '0.2'
def vertxVersion = '1.2.3.final'

final MONGO = "mongo-persistor"
def config = [address: MONGO, db_name: 'gvm']
container.deployModule("vertx.mongo-persistor-v1.1", config)

def templateEngine = new SimpleTemplateEngine()

def rm = new RouteMatcher()

rm.get("/") { req ->
	addPlainTextHeader req
	req.response.sendFile('srv/scripts/install.sh')
}

rm.get("/res/init") { req ->
	log 'init', 'n/a', 'n/a', req
	addPlainTextHeader req
	req.response.sendFile 'srv/scripts/gvm-init.sh'
}

rm.get("/res/gvm") { req ->
	addPlainTextHeader req
	req.response.sendFile('srv/scripts/gvm')
}

rm.get("/candidates") { req ->
	addPlainTextHeader req<commit_msg>Load mongo config from srv/mongo.json if present.<commit_after>import groovy.text.SimpleTemplateEngine
import org.vertx.groovy.core.http.RouteMatcher
import org.vertx.java.core.json.JsonObject

def grails = ['1.3.7','1.3.8','1.3.9','2.0.0','2.0.1','2.0.2','2.0.3','2.0.4','2.1.0','2.1.1']
def candidates = [grails:grails]
def defaults = [grails:'2.1.1']

def gvmVersion = '0.4'
def serverVersion = '0.2'
def vertxVersion = '1.2.3.final'

def config
def mongoJson = new File('srv/mongo.json')
if(mongoJson.exists()){
	config = new JsonObject(mongoJson.text).toMap()
} else {
	config = [address: 'mongo-persistor', db_name: 'gvm']
}
container.deployModule('vertx.mongo-persistor-v1.1', config)

def templateEngine = new SimpleTemplateEngine()

def rm = new RouteMatcher()

rm.get("/") { req ->
	addPlainTextHeader req
	req.response.sendFile('srv/scripts/install.sh')
}

rm.get("/res/init") { req ->
	log 'init', 'n/a', 'n/a', req
	addPlainTextHeader req
	req.response.sendFile 'srv/scripts/gvm-init.sh'
}

rm.get("/res/gvm") { req ->
	addPlainTextHeader req
	req.response.sendFile('srv/scripts/gvm')
}

rm.get("/candidates") { req ->
	addPlainTextHeader req
{'fraction_non_alphanumeric': 0.19659735349716445, 'fraction_numerical': 0.03969754253308128, 'mean_word_length': 4.527415143603133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2710913', 'n_tokens_mistral': 878, 'n_tokens_neox': 863, 'n_words': 146}