Search in sources :

Example 16 with Command

use of org.jreleaser.util.command.Command in project jreleaser by jreleaser.

the class Upx method compress.

public void compress(Path parent, List<String> args) throws CommandException {
    Command command = tool.asCommand().args(args);
    executeCommand(() -> new CommandExecutor(context.getLogger()).executeCommand(parent, command));
}
Also used : Command(org.jreleaser.util.command.Command) CommandExecutor(org.jreleaser.util.command.CommandExecutor)

Example 17 with Command

use of org.jreleaser.util.command.Command in project jreleaser by jreleaser.

the class ChocolateyPackagerProcessor method createChocolateyPackage.

private void createChocolateyPackage(Distribution distribution, Map<String, Object> props) throws PackagerProcessingException {
    Path packageDirectory = (Path) props.get(KEY_DISTRIBUTION_PACKAGE_DIRECTORY);
    Path execDirectory = packageDirectory.resolve(distribution.getName());
    Command cmd = new Command("choco").arg("pack").arg(packager.getPackageName() + ".nuspec");
    context.getLogger().debug(String.join(" ", cmd.getArgs()));
    executeCommand(execDirectory, cmd);
}
Also used : Path(java.nio.file.Path) Command(org.jreleaser.util.command.Command)

Example 18 with Command

use of org.jreleaser.util.command.Command in project jreleaser by jreleaser.

the class DockerPackagerProcessor method publish.

private void publish(Registry registry, String imageName, Map<String, Object> props) throws PackagerProcessingException {
    imageName = resolveTemplate(imageName, props);
    String tag = imageName;
    String serverName = registry.getServerName();
    String server = registry.getServer();
    String repositoryName = registry.getRepositoryName();
    if (Registry.DEFAULT_NAME.equals(serverName)) {
        if (!tag.startsWith(repositoryName)) {
            int pos = tag.indexOf("/");
            if (pos < 0) {
                tag = repositoryName + "/" + tag;
            } else {
                tag = repositoryName + tag.substring(pos);
            }
        }
    } else {
        if (!tag.startsWith(server)) {
            int pos = tag.indexOf("/");
            if (pos < 0) {
                tag = server + "/" + repositoryName + "/" + tag;
            } else {
                tag = server + "/" + repositoryName + tag.substring(pos);
            }
        }
    }
    if (!tag.equals(imageName)) {
        Command cmd = createCommand("tag").arg(imageName).arg(tag);
        context.getLogger().debug(RB.$("docker.tag"), imageName, tag);
        if (!context.isDryrun())
            executeCommand(cmd);
    }
    Command cmd = createCommand("push").arg("-q").arg(tag);
    context.getLogger().info(" - {}", tag);
    context.getLogger().debug(RB.$("docker.push"), tag, registry.getServerName(), (isNotBlank(registry.getServer()) ? " (" + registry.getServer() + ")" : ""));
    if (!context.isDryrun())
        executeCommand(cmd);
}
Also used : Command(org.jreleaser.util.command.Command)

Example 19 with Command

use of org.jreleaser.util.command.Command in project jreleaser by jreleaser.

the class DockerPackagerProcessor method logout.

private void logout(Registry registry) throws PackagerProcessingException {
    Command cmd = createCommand("logout");
    if (isNotBlank(registry.getServer())) {
        cmd.arg(registry.getServerName());
    }
    context.getLogger().debug(RB.$("docker.logout"), registry.getServerName(), (isNotBlank(registry.getServer()) ? " (" + registry.getServer() + ")" : ""));
    if (!context.isDryrun())
        executeCommand(cmd);
}
Also used : Command(org.jreleaser.util.command.Command)

Example 20 with Command

use of org.jreleaser.util.command.Command in project jreleaser by jreleaser.

the class SnapPackagerProcessor method createSnap.

private void createSnap(Distribution distribution, Map<String, Object> props) throws PackagerProcessingException {
    Path packageDirectory = (Path) props.get(KEY_DISTRIBUTION_PACKAGE_DIRECTORY);
    String version = (String) props.get(KEY_PROJECT_EFFECTIVE_VERSION);
    String snapName = packager.getPackageName() + "-" + version + ".snap";
    Command cmd = new Command("snapcraft").arg("snap").arg("--output").arg(snapName);
    executeCommand(packageDirectory, cmd);
}
Also used : Path(java.nio.file.Path) Command(org.jreleaser.util.command.Command)

Aggregations

Command (org.jreleaser.util.command.Command)23 Path (java.nio.file.Path)12 IOException (java.io.IOException)6 CommandExecutor (org.jreleaser.util.command.CommandExecutor)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 CommandException (org.jreleaser.util.command.CommandException)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 AssemblerProcessingException (org.jreleaser.model.assembler.spi.AssemblerProcessingException)4 SigningException (org.jreleaser.util.signing.SigningException)3 PackagerProcessingException (org.jreleaser.model.packager.spi.PackagerProcessingException)2 Pattern (java.util.regex.Pattern)1 Artifact (org.jreleaser.model.Artifact)1 Jpackage (org.jreleaser.model.Jpackage)1 NativeImage (org.jreleaser.model.NativeImage)1