text: "use strict";
  const model = require("../../models/model");
  const utils = require("../../utils/utils");
  const fs = require("fs");
  
  module.exports = {
    getInstance: function() {
      var projectBuild = new model.ProjectBuild();
  
      projectBuild.getBuildScript = function() {
        return getBuildScript();
      };
  
      projectBuild.getArtifact = function(pomPath) {
        var pom = utils.getPom(pomPath);
  
        var artifact = new model.Artifact();
        artifact.name = pom.artifactId;
        artifact.version = pom.version;
        artifact.buildPath = "./omod/target";
        artifact.extension = "omod";
        artifact.filename =
          artifact.name + "-" + artifact.version + "." + artifact.extension;
        artifact.destFilename = artifact.filename;
  
        // encapsulating the Maven project
        {
          var mavenProject = new model.MavenProject();
          mavenProject.groupId = pom.groupId;
          mavenProject.artifactId = pom.artifactId;
          mavenProject.version = pom.version;
          artifact.mavenProject = mavenProject;
        }
  
        return artifact;
      };
  
      projectBuild.getDeployScript = function() {
        return getDeployScript();
      };
  
      projectBuild.getDeployScript = function() {
        return getDeployScript();
      };
  
      return projectBuild;
    }
  };
  
  var getBuildScript = function() {
    var buildScript = new model.Script();
  
    buildScript.type = "#!/bin/bash";
    buildScript.comments =
      "# Autogenerated script to build 'openmrscore' type of projects";
    buildScript.value = "mvn clean install\n";
  
    return buildScript;
  };
  
  var getDeployScript = function() {
    var deployScript = new model.Script();
  
    deployScript.type = "#!/bin/bash";
    deployScript.comments =
      "# Autogenerated script to deploy 'openmrscore' type of projects";
    deployScript.value = "nexus_envvars=$1 ; . $nexus_envvars\n";
    deployScript.value =
      deployScript.value +
      "mvn clean deploy -DskipTests -DaltDeploymentRepository=${NEXUS_REPO_ID}::default::${ARTIFACT_UPLOAD_URL_openmrscore}\n";
  
    return deployScript;
  };
  