<commit_before>package main

import (
	"bytes"
	"encoding/json"
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
	"text/template"
	"time"

	"github.com/fraenkel/candiedyaml"
	"github.com/gorilla/websocket"
	"github.com/mgutz/ansi"
	"github.com/pivotal-golang/archiver/compressor"
	"github.com/tedsuo/router"

	"github.com/winston-ci/redgreen/api/builds"
	"github.com/winston-ci/redgreen/routes"
)

type BuildConfig struct {
	Image  string   `yaml:"image"`
	Script string   `yaml:"script"`
	Env    []string `yaml:"env"`
}

var buildConfig = flag.String(
	"c",
	"build.yml",
	"build configuration file",
)

var buildDir = flag.String(
	"d",
	".",
	"source directory to build",
)

var redgreenURL = flag.String(
	"redgreenURL",
	os.Getenv("REDGREEN_URL"),
	"address denoting the redgreen service",
)

func main() {
	flag.Parse()

	if *redgreenURL == "" {
		println("must specify $REDGREEN_URL. for example:")
		println()
		println("export REDGREEN_URL=http://10.244.8.66:5637")
		os.Exit(1)
	}

	reqGenerator := router.NewRequestGenerator(*redgreenURL, routes.Routes)

	absConfig, err := filepath.Abs(*buildConfig)
	if err != nil {
		log.Fatalln("could not locate config file:", err)
	}

	build := create(reqGenerator, loadConfig(absConfig), filepath.Base(filepath.Dir(absConfig)))

	logOutput, err := reqGenerator.RequestForHandler(
		routes.LogOutput,
		router.Params{"guid": build.Guid},
		nil,
	)
	if err != nil {
		log.Fatalln(err)
	}

	logOutput.URL.Scheme = "ws"

	conn, res, err := websocket.DefaultDialer.Dial(logOutput.URL.String(), nil)
	if err != nil {<commit_msg>update suggested $REDGREEN_URL<commit_after>package main

import (
	"bytes"
	"encoding/json"
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
	"text/template"
	"time"

	"github.com/fraenkel/candiedyaml"
	"github.com/gorilla/websocket"
	"github.com/mgutz/ansi"
	"github.com/pivotal-golang/archiver/compressor"
	"github.com/tedsuo/router"

	"github.com/winston-ci/redgreen/api/builds"
	"github.com/winston-ci/redgreen/routes"
)

type BuildConfig struct {
	Image  string   `yaml:"image"`
	Script string   `yaml:"script"`
	Env    []string `yaml:"env"`
}

var buildConfig = flag.String(
	"c",
	"build.yml",
	"build configuration file",
)

var buildDir = flag.String(
	"d",
	".",
	"source directory to build",
)

var redgreenURL = flag.String(
	"redgreenURL",
	os.Getenv("REDGREEN_URL"),
	"address denoting the redgreen service",
)

func main() {
	flag.Parse()

	if *redgreenURL == "" {
		println("must specify $REDGREEN_URL. for example:")
		println()
		println("export REDGREEN_URL=http://10.244.8.2:5637")
		os.Exit(1)
	}

	reqGenerator := router.NewRequestGenerator(*redgreenURL, routes.Routes)

	absConfig, err := filepath.Abs(*buildConfig)
	if err != nil {
		log.Fatalln("could not locate config file:", err)
	}

	build := create(reqGenerator, loadConfig(absConfig), filepath.Base(filepath.Dir(absConfig)))

	logOutput, err := reqGenerator.RequestForHandler(
		routes.LogOutput,
		router.Params{"guid": build.Guid},
		nil,
	)
	if err != nil {
		log.Fatalln(err)
	}

	logOutput.URL.Scheme = "ws"

	conn, res, err := websocket.DefaultDialer.Dial(logOutput.URL.String(), nil)
	if err != nil {
{'fraction_non_alphanumeric': 0.16391941391941392, 'fraction_numerical': 0.007631257631257631, 'mean_word_length': 4.398682042833608, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6656101', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1281, 'n_words': 236}