Exemplo n.º 1
0
func main() {
	defer glog.Flush()
	glog.CopyStandardLogTo("info")
	flag.Parse()
	runtime.GOMAXPROCS(runtime.NumCPU())

	httpClientBuilder := http_client_builder.New()
	httpClient := httpClientBuilder.Build()
	latestVersion := sonar_latest_version.New(httpClient.Get)
	urlByVersion := url_by_version.New()
	latestUrl := sonar_latest_zip_url.New(latestVersion.LatestSonarVersion, urlByVersion.SonarZipUrlForVersion)

	commandListProvider := func() command_list.CommandList {
		return command_list.New()
	}
	config_parser := debian_config_parser.New()
	copier := debian_copier.New()
	zipExtractor := debian_zip_extractor.New()
	tarGzExtractor := debian_tar_gz_extractor.New()
	requestbuilderProvider := http_requestbuilder.NewHTTPRequestBuilderProvider()
	debianPackageCreator := debian_package_creator.New(commandListProvider, copier, tarGzExtractor.ExtractTarGz, zipExtractor.ExtractZip, httpClient.Do, requestbuilderProvider.NewHTTPRequestBuilder)
	creatorByReader := debian_package_creator_by_reader.New(commandListProvider, debianPackageCreator, zipExtractor.ExtractZip)
	latestDebianPackageCreator := debian_latest_package_creator.New(httpClient.Get, latestUrl.LatestSonarZipUrl, latestVersion.LatestSonarVersion, creatorByReader.CreatePackage)

	writer := os.Stdout
	err := do(writer, latestDebianPackageCreator.CreateLatestDebianPackage, config_parser.ParseFileToConfig, latestVersion.LatestSonarVersion, *configPtr)
	if err != nil {
		glog.Exit(err)
	}
}
Exemplo n.º 2
0
func main() {
	defer glog.Flush()
	glog.CopyStandardLogTo("info")
	flag.Parse()
	runtime.GOMAXPROCS(runtime.NumCPU())

	writer := os.Stdout
	httpClientBuilder := http_client_builder.New()
	httpClient := httpClientBuilder.Build()
	latestVersion := latest_version.New(httpClient.Get)
	urlByVersion := url_by_version.New()
	latestZipUrl := latest_zip_url.New(latestVersion.LatestSonarVersion, urlByVersion.SonarZipUrlForVersion)
	err := do(writer, latestZipUrl.LatestSonarZipUrl)
	if err != nil {
		glog.Exit(err)
	}
}