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)
}
Esempio 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)
}