Ejemplo n.º 1
0
func do(
	debianPackageCreatorArchive debian_package_creator_archive.DebianPackageCreator,
	config_parser debian_config_parser.ConfigParser,
	tarGzPath string,
	configpath string,
	version string,
	targetDir string,
) error {
	if len(tarGzPath) == 0 {
		return fmt.Errorf("parameter %s missing", PARAMETER_CONFLUENCE_TAR_GZ_PATH)
	}
	var err error
	config := createDefaultConfig()
	if len(configpath) > 0 {
		if config, err = config_parser.ParseFileToConfig(config, configpath); err != nil {
			return err
		}
	}
	config_builder := debian_config_builder.NewWithConfig(config)
	if len(version) > 0 {
		if err := config_builder.Version(version); err != nil {
			return err
		}
	}
	config = config_builder.Build()
	if len(config.Version) == 0 {
		return fmt.Errorf("paramter %s missing", PARAMETER_CONFLUENCE_VERSION)
	}
	sourceDir := fmt.Sprintf("atlassian-bamboo-%s", config.Version)
	return debianPackageCreatorArchive.CreatePackage(tarGzPath, config, sourceDir, targetDir)
}
Ejemplo n.º 2
0
func do(writer io.Writer, debianPackageCreator debian_package_creator_archive.DebianPackageCreator, config_parser debian_config_parser.ConfigParser, tarGzPath string, configpath string, version string) error {
	if len(tarGzPath) == 0 {
		return fmt.Errorf("parameter %s missing", PARAMETER_SONAR_TAR_GZ)
	}
	var err error
	config := createDefaultConfig()
	if len(configpath) > 0 {
		if config, err = config_parser.ParseFileToConfig(config, configpath); err != nil {
			return err
		}
	}
	config_builder := debian_config_builder.NewWithConfig(config)
	if len(version) > 0 {
		if err := config_builder.Version(version); err != nil {
			return err
		}
	}
	config = config_builder.Build()
	if len(config.Version) == 0 {
		return fmt.Errorf("paramter %s missing", PARAMETER_SONAR_VERSION)
	}
	sourceDir := fmt.Sprintf("nexus-%s-03", config.Version)
	targetDir := "/opt/nexus"
	return debianPackageCreator.CreatePackage(tarGzPath, config, sourceDir, targetDir)
}
Ejemplo n.º 3
0
func main() {
	defer glog.Flush()
	glog.CopyStandardLogTo("info")
	flag.Parse()
	runtime.GOMAXPROCS(runtime.NumCPU())

	commandListProvider := func() debian_command_list.CommandList {
		return debian_command_list.New()
	}
	configBuilderWithConfig := func(config *debian_config.Config) debian_config_builder.ConfigBuilder {
		return debian_config_builder.NewWithConfig(config)
	}
	config_parser := debian_config_parser.New()
	copier := debian_copier.New()
	zipExtractor := debian_zip_extractor.New()
	tarGzExtractor := debian_tar_gz_extractor.New()
	httpClientBuilder := http_client_builder.New().WithoutProxy()
	httpClient := httpClientBuilder.Build()
	requestbuilderProvider := http_requestbuilder.NewHTTPRequestBuilderProvider()
	debianPackageCreator := debian_package_creator.New(commandListProvider, copier, tarGzExtractor.ExtractTarGz, zipExtractor.ExtractZip, httpClient.Do, requestbuilderProvider.NewHTTPRequestBuilder)

	err := do(config_parser, configBuilderWithConfig, debianPackageCreator, *configPtr, *namePtr, *versionPtr, *sourcePtr, *targetPtr)
	if err != nil {
		glog.Exit(err)
	}
}
Ejemplo n.º 4
0
func (b *builder) createDebianPackageCommand() command.Command {
	return command_adapter.New(func() error {
		configBuilder := debian_config_builder.NewWithConfig(b.config)
		if err := configBuilder.AddFile(joinDirs(b.workingdirectory, b.sourceDir), b.targetDir); err != nil {
			return err
		}
		return b.packageCreator.CreatePackage(configBuilder.Build())
	}, func() error {
		return nil
	})
}
func do(writer io.Writer, createPackage CreatePackage, config_parser debian_config_parser.ConfigParser, configpath string) error {
	var err error
	config := createDefaultConfig()
	if len(configpath) > 0 {
		if config, err = config_parser.ParseFileToConfig(config, configpath); err != nil {
			return err
		}
	}
	config_builder := debian_config_builder.NewWithConfig(config)
	config = config_builder.Build()
	sourceDir := "go"
	targetDir := "/opt/go"
	return createPackage(config, sourceDir, targetDir)
}
Ejemplo n.º 6
0
func do(writer io.Writer, createPackage CreatePackage, parseFileToConfig ParseFileToConfig, latestSonarVersion LatestSonarVersion, configpath string) error {
	var err error
	config := createDefaultConfig()
	if len(configpath) > 0 {
		if config, err = parseFileToConfig(config, configpath); err != nil {
			return err
		}
	}
	config_builder := debian_config_builder.NewWithConfig(config)
	config = config_builder.Build()
	config.Version, err = latestSonarVersion()
	if err != nil {
		return err
	}
	sourceDir := fmt.Sprintf("sonarqube-%s", config.Version)
	targetDir := "/opt/sonar"
	return createPackage(config, sourceDir, targetDir)
}
func TestDo(t *testing.T) {
	var err error

	commandProvider := func() debian_command_list.CommandList {
		return debian_command_list.New()
	}
	configBuilderWithConfig := func(config *debian_config.Config) debian_config_builder.ConfigBuilder {
		return debian_config_builder.NewWithConfig(config)
	}
	copier := debian_copier.New()
	package_creator := debian_package_creator.New(commandProvider, copier, nil, nil, nil, nil)
	config_parser := debian_config_parser.New()

	err = do(config_parser, configBuilderWithConfig, package_creator, "", "", "", "", "")
	if err := AssertThat(err, NotNilValue()); err != nil {
		t.Fatal(err)
	}
}
func do(
	createPackage CreatePackage,
	config_parser debian_config_parser.ConfigParser,
	configpath string, latestVersion LatestVersion,
	targetDir string,
) error {
	var err error
	config := createDefaultConfig()
	if len(configpath) > 0 {
		if config, err = config_parser.ParseFileToConfig(config, configpath); err != nil {
			return err
		}
	}
	config_builder := debian_config_builder.NewWithConfig(config)
	config = config_builder.Build()
	config.Version, err = latestVersion()
	if err != nil {
		return err
	}
	sourceDir := fmt.Sprintf("atlassian-bamboo-%s", config.Version)
	return createPackage(config, sourceDir, targetDir)
}