All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.graphql.buildSh Maven / Gradle / Ivy

package templates.graphql;

import java.io.IOException;
import com.fizzed.rocker.ForIterator;
import com.fizzed.rocker.RenderingException;
import com.fizzed.rocker.RockerContent;
import com.fizzed.rocker.RockerOutput;
import com.fizzed.rocker.runtime.DefaultRockerTemplate;
import com.fizzed.rocker.runtime.PlainTextUnloadedClassLoader;
// import @ [1:1]
import com.fasterxml.jackson.databind.JsonNode;

/*
 * Auto generated code to render template templates/graphql/buildSh.rocker.raw
 * Do not edit this file. Changes will eventually be overwritten by Rocker parser!
 */
@SuppressWarnings("unused")
public class buildSh extends com.fizzed.rocker.runtime.DefaultRockerModel {

    static public com.fizzed.rocker.ContentType getContentType() { return com.fizzed.rocker.ContentType.RAW; }
    static public String getTemplateName() { return "buildSh.rocker.raw"; }
    static public String getTemplatePackageName() { return "templates.graphql"; }
    static public String getHeaderHash() { return "-1193805788"; }
    static public long getModifiedAt() { return 1645995245871L; }
    static public String[] getArgumentNames() { return new String[] { "config", "serviceId" }; }

    // argument @ [2:2]
    private JsonNode config;
    // argument @ [2:2]
    private String serviceId;

    public buildSh config(JsonNode config) {
        this.config = config;
        return this;
    }

    public JsonNode config() {
        return this.config;
    }

    public buildSh serviceId(String serviceId) {
        this.serviceId = serviceId;
        return this;
    }

    public String serviceId() {
        return this.serviceId;
    }

    static public buildSh template(JsonNode config, String serviceId) {
        return new buildSh()
            .config(config)
            .serviceId(serviceId);
    }

    @Override
    protected DefaultRockerTemplate buildTemplate() throws RenderingException {
        // optimized for convenience (runtime auto reloading enabled if rocker.reloading=true)
        return com.fizzed.rocker.runtime.RockerRuntime.getInstance().getBootstrap().template(this.getClass(), this);
    }

    static public class Template extends com.fizzed.rocker.runtime.DefaultRockerTemplate {

        // \n#!/bin/bash\n\nset -ex\n\nVERSION=$1\nIMAGE_NAME=\"
        static private final byte[] PLAIN_TEXT_0_0;
        // /
        static private final byte[] PLAIN_TEXT_1_0;
        // \"\n\nshowHelp() {\n    echo \" \"\n    echo \"Error: $1\"\n    echo \" \"\n    echo \"    build.sh [VERSION]\"\n    echo \" \"\n    echo \"    where [VERSION] version of the docker image that you want to publish (example: 0.0.1)\"\n    echo \" \"\n    echo \"    example: ./build.sh 0.0.1\"\n    echo \" \"\n}\n\nbuild() {\n    echo \"Building ...\"\n    
        static private final byte[] PLAIN_TEXT_2_0;
        // \n    mvn clean install -Prelease\n    
        static private final byte[] PLAIN_TEXT_3_0;
        // \n    ./gradlew clean build\n    
        static private final byte[] PLAIN_TEXT_4_0;
        // \n    echo \"Successfully built!\"\n}\n\ncleanup() {\n    if [[ \"$(docker images -q $IMAGE_NAME 2> /dev/null)\" != \"\" ]]; then\n        echo \"Removing old $IMAGE_NAME images\"\n        docker images | grep $IMAGE_NAME | awk '{print $3}' | xargs docker rmi -f\n        echo \"Cleanup completed!\"\n    fi\n}\n\npublish() {\n    echo \"Building Docker image with version $VERSION\"\n    docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true\n    doc...
        static private final byte[] PLAIN_TEXT_5_0;

        static {
            PlainTextUnloadedClassLoader loader = PlainTextUnloadedClassLoader.tryLoad(buildSh.class.getClassLoader(), buildSh.class.getName() + "$PlainText", "UTF-8");
            PLAIN_TEXT_0_0 = loader.tryGet("PLAIN_TEXT_0_0");
            PLAIN_TEXT_1_0 = loader.tryGet("PLAIN_TEXT_1_0");
            PLAIN_TEXT_2_0 = loader.tryGet("PLAIN_TEXT_2_0");
            PLAIN_TEXT_3_0 = loader.tryGet("PLAIN_TEXT_3_0");
            PLAIN_TEXT_4_0 = loader.tryGet("PLAIN_TEXT_4_0");
            PLAIN_TEXT_5_0 = loader.tryGet("PLAIN_TEXT_5_0");
        }

        // argument @ [2:2]
        protected final JsonNode config;
        // argument @ [2:2]
        protected final String serviceId;

        public Template(buildSh model) {
            super(model);
            __internal.setCharset("UTF-8");
            __internal.setContentType(getContentType());
            __internal.setTemplateName(getTemplateName());
            __internal.setTemplatePackageName(getTemplatePackageName());
            this.config = model.config();
            this.serviceId = model.serviceId();
        }

        @Override
        protected void __doRender() throws IOException, RenderingException {
            // PlainText @ [2:42]
            __internal.aboutToExecutePosInTemplate(2, 42);
            __internal.writeValue(PLAIN_TEXT_0_0);
            // ValueExpression @ [8:13]
            __internal.aboutToExecutePosInTemplate(8, 13);
            __internal.renderValue(config.get("dockerOrganization").textValue(), false);
            // PlainText @ [8:58]
            __internal.aboutToExecutePosInTemplate(8, 58);
            __internal.writeValue(PLAIN_TEXT_1_0);
            // ValueExpression @ [8:59]
            __internal.aboutToExecutePosInTemplate(8, 59);
            __internal.renderValue(serviceId, false);
            // PlainText @ [8:69]
            __internal.aboutToExecutePosInTemplate(8, 69);
            __internal.writeValue(PLAIN_TEXT_2_0);
            // IfBlockBegin @ [24:5]
            __internal.aboutToExecutePosInTemplate(24, 5);
            if (config.get("buildMaven").booleanValue()) {
                // PlainText @ [24:50]
                __internal.aboutToExecutePosInTemplate(24, 50);
                __internal.writeValue(PLAIN_TEXT_3_0);
                // IfBlockElse @ [26:5]
                __internal.aboutToExecutePosInTemplate(26, 5);
            } else { // else @ [26:5]
                // PlainText @ [26:11]
                __internal.aboutToExecutePosInTemplate(26, 11);
                __internal.writeValue(PLAIN_TEXT_4_0);
                // IfBlockEnd @ [24:5]
                __internal.aboutToExecutePosInTemplate(24, 5);
            } // if end @ [24:5]
            // PlainText @ [28:6]
            __internal.aboutToExecutePosInTemplate(28, 6);
            __internal.writeValue(PLAIN_TEXT_5_0);
        }
    }

    private static class PlainText {

        static private final String PLAIN_TEXT_0_0 = "\n#!/bin/bash\n\nset -ex\n\nVERSION=$1\nIMAGE_NAME=\"";
        static private final String PLAIN_TEXT_1_0 = "/";
        static private final String PLAIN_TEXT_2_0 = "\"\n\nshowHelp() {\n    echo \" \"\n    echo \"Error: $1\"\n    echo \" \"\n    echo \"    build.sh [VERSION]\"\n    echo \" \"\n    echo \"    where [VERSION] version of the docker image that you want to publish (example: 0.0.1)\"\n    echo \" \"\n    echo \"    example: ./build.sh 0.0.1\"\n    echo \" \"\n}\n\nbuild() {\n    echo \"Building ...\"\n    ";
        static private final String PLAIN_TEXT_3_0 = "\n    mvn clean install -Prelease\n    ";
        static private final String PLAIN_TEXT_4_0 = "\n    ./gradlew clean build\n    ";
        static private final String PLAIN_TEXT_5_0 = "\n    echo \"Successfully built!\"\n}\n\ncleanup() {\n    if [[ \"$(docker images -q $IMAGE_NAME 2> /dev/null)\" != \"\" ]]; then\n        echo \"Removing old $IMAGE_NAME images\"\n        docker images | grep $IMAGE_NAME | awk '{print $3}' | xargs docker rmi -f\n        echo \"Cleanup completed!\"\n    fi\n}\n\npublish() {\n    echo \"Building Docker image with version $VERSION\"\n    docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true\n    docker build -t $IMAGE_NAME:$VERSION-slim -f ./docker/Dockerfile-Slim . --no-cache=true\n    echo \"Images built with version $VERSION\"\n    echo \"Pushing image to DockerHub\"\n    docker push $IMAGE_NAME -a\n    echo \"Image successfully published!\"\n}\n\nif [ -z $VERSION ]; then\n    showHelp \"[VERSION] parameter is missing\"\n    exit\nfi\n\nbuild;\ncleanup;\npublish;\n";

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy