Пример #1
0
func wireup() (*contract.Monitor, contract.Server) {
	log.Println("Constructing components...")
	working, err := os.Getwd()
	if err != nil {
		panic(err)
	}

	fs := system.NewFileSystem()
	shell := system.NewShell(gobin)

	watcher := watch.NewWatcher(fs, shell)
	watcher.Adjust(working)

	parser := parse.NewParser(parse.ParsePackageResults)
	tester := exec.NewConcurrentTester(shell)
	tester.SetBatchSize(packages)

	statusNotif := make(chan bool, 1)
	executor := exec.NewExecutor(tester, parser, statusNotif)
	server := api.NewHTTPServer(watcher, executor, statusNotif)
	scanner := watch.NewScanner(fs, watcher)
	monitor := contract.NewMonitor(scanner, watcher, executor, server, sleeper)

	return monitor, server
}
Пример #2
0
func wireup() (*contract.Monitor, contract.Server) {
	log.Println("Constructing components...")
	working, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}

	shellExecutor := system.NewCommandExecutor()
	cover = coverageEnabled(cover, reports, shellExecutor)

	depthLimit := system.NewDepthLimit(system.NewFileSystem(), depth)
	shell := system.NewShell(shellExecutor, gobin, short, cover, reports)

	watcher := watch.NewWatcher(depthLimit, shell)
	watcher.Adjust(working)

	parser := parser.NewParser(parser.ParsePackageResults)
	tester := executor.NewConcurrentTester(shell)
	tester.SetBatchSize(packages)

	longpollChan, pauseUpdate := make(chan chan string), make(chan bool, 1)
	executor := executor.NewExecutor(tester, parser, longpollChan)
	server := api.NewHTTPServer(watcher, executor, longpollChan, pauseUpdate)
	scanner := watch.NewScanner(depthLimit, watcher)
	monitor := contract.NewMonitor(scanner, watcher, executor, server, pauseUpdate, sleeper)

	return monitor, server
}