예제 #1
0
        public static void Process(string[] args)
        {
            bool initialPause = !ArgExists(args, "-nowait");

            //read configs
            List <string> configs = ConfigFileHandler.LoadConfiguration();
            string        release = ListParser.Get("RELEASE=", configs);
            string        build   = ListParser.Get("BUILD=", configs);

            if (initialPause)
            {
                Display.Output("You are about to deploy SMART build " + release + "." + build + ".  Close this window to abort.");
                Display.Pause();
            }

            Display.Header("Starting deployment of " + release + "." + build);


            //backup
            Deploy.Backup(configs);

            //configure ports
            PortSetter.Process(configs);

            //deploy
            Deploy.Process(configs);

            Display.Header("Deployment complete");

            Display.Pause();
        }
예제 #2
0
        public static void Process(List <string> configs)
        {
            string websiteTargetPath    = ListParser.Get("WEBSITE-TARGET-PATH=", configs);
            string serviceTargetPath    = ListParser.Get("SERVICE-TARGET-PATH=", configs);
            string crmServiceTargetPath = ListParser.Get("CRM-SERVICE-TARGET-PATH=", configs);
            string deploymentSourcePath = ListParser.Get("SOURCE-PATH=", configs);
            string release          = ListParser.Get("RELEASE=", configs);
            string build            = ListParser.Get("BUILD=", configs);
            string branch           = ListParser.Get("BRANCH=", configs);
            string configBackupPath = ListParser.Get("CONFIG-BACKUP-PATH=", configs);
            string sevenZip         = ListParser.Get("ZIP=", configs);

            string where = ListParser.Get("WHERE=", configs);

            if (ValidateSource(deploymentSourcePath, release, build, branch))
            {
                ClearTargetDirectories(websiteTargetPath, serviceTargetPath, crmServiceTargetPath);
                ExtractFiles(websiteTargetPath, serviceTargetPath, crmServiceTargetPath, sevenZip, deploymentSourcePath, branch,
                             release, build);
                UpdateXapFiles(websiteTargetPath, sevenZip, configBackupPath);
                FixXapPermissions(websiteTargetPath);
                RestoreConfigs(websiteTargetPath, serviceTargetPath, crmServiceTargetPath, configBackupPath);
                DeployWhere(where, websiteTargetPath);
            }
            else
            {
                Display.Error("ERROR: Are the parameters correct?  The specified build could not be found.", true);
            }
        }
예제 #3
0
        private static List <string> GetTargets(List <string> configs)
        {
            List <string> targets = ListParser.FindInList(configs, TARGET, true);
            List <string> result  = new List <string>();

            targets.ForEach(x => result.Add(x.Replace(TARGET, string.Empty)));

            return(result);
        }
예제 #4
0
        private static void ProcessATarget(string target, List <string> parms)
        {
            string siteId      = ListParser.Get("SITE-ID=", parms);
            string serviceUrl  = ListParser.Get("SERVICE-URL=", parms);
            string servicePort = ListParser.Get("SERVICE-PORT=", parms);
            string crmUrl      = ListParser.Get("CRM-URL=", parms);
            string crmPort     = ListParser.Get("CRM-PORT=", parms);

            TargetSetter.Open(target);
            try
            {
                TargetSetter.Replace(BuildUrl(serviceUrl, servicePort, "0"), BuildUrl(serviceUrl, servicePort, siteId));
                TargetSetter.Replace(BuildUrl(crmUrl, crmPort, "0"), BuildUrl(crmUrl, crmPort, siteId));
            }
            finally
            {
                TargetSetter.Close();
            }
        }
예제 #5
0
        public static void Backup(List <string> configs)
        {
            string websiteTargetPath    = ListParser.Get("WEBSITE-TARGET-PATH=", configs);
            string serviceTargetPath    = ListParser.Get("SERVICE-TARGET-PATH=", configs);
            string crmServiceTargetPath = ListParser.Get("CRM-SERVICE-TARGET-PATH=", configs);
            string configBackupPath     = ListParser.Get("CONFIG-BACKUP-PATH=", configs);
            string sevenZip             = ListParser.Get("ZIP=", configs);

            Display.Header("Backing up configs");
            CreateConfigBackupFolders(configBackupPath);

            if (File.Exists(websiteTargetPath + "\\ClientBin\\OrderDetails.xap"))
            {
                Display.Output("Extract ServiceReferences.ClientConfig");
                FileManagement.RenameFile(websiteTargetPath + "\\ClientBin\\OrderDetails.xap", websiteTargetPath + "\\ClientBin\\OrderDetails.zip");
                File.Delete(websiteTargetPath + "\\ClientBin\\ServiceReferences.ClientConfig");
                Execute.Command(sevenZip, "e -y " + websiteTargetPath + "\\ClientBin\\OrderDetails.zip ServiceReferences.ClientConfig");
                Display.Output("Copy ServiceReferences.ClientConfig");
                Directory.CreateDirectory(configBackupPath);
                FileManagement.CopyFile("ServiceReferences.ClientConfig", configBackupPath + "\\Client\\ServiceReferences.ClientConfig", true);
                File.Delete("ServiceReferences.ClientConfig");
            }
            else
            {
                Display.Error("ERROR ServiceReferences.ClientConfig was NOT backed up.", false);
                Display.Error("You will have to check that the xap files have the correct configs.", false);
                Display.Error("If you are installing to empty folders (no previous install) this is normal", false);
                Display.Error("and you will probably need to create the correct configs manually.");
            }

            if (File.Exists(websiteTargetPath + "\\web.config"))
            {
                Display.Output("Copy Client\\web.config");
                FileManagement.CopyFile(websiteTargetPath + "\\web.config", configBackupPath + "\\Client\\web.config", true);
            }
            else
            {
                Display.Error(websiteTargetPath + "\\web.config may need to be manually installed.", false);
            }

            if (File.Exists(serviceTargetPath + "\\web.config"))
            {
                Display.Output("Copy Service\\web.config");
                FileManagement.CopyFile(serviceTargetPath + "\\web.config", configBackupPath + "\\Service\\web.config", true);
            }
            else
            {
                Display.Error(serviceTargetPath + "\\web.config may need to be manually installed.", false);
            }

            if (File.Exists(crmServiceTargetPath + "\\web.config"))
            {
                Display.Output("Copy SMART_CRM_Webservice\\web.config");
                FileManagement.CopyFile(crmServiceTargetPath + "\\web.config",
                                        configBackupPath + "\\SMART_CRM_Webservice\\web.config", true);
            }
            else
            {
                Display.Error(crmServiceTargetPath + "\\web.config may need to be manually installed.", false);
            }

            if (File.Exists(websiteTargetPath + "\\App_Data\\authorizationManager.xml"))
            {
                Display.Output("Copy authorizationManager.xml");
                FileManagement.CopyFile(websiteTargetPath + "\\App_Data\\authorizationManager.xml",
                                        configBackupPath + "\\authorizationManager.xml", true);
            }
            else
            {
                Display.Error(websiteTargetPath + "\\App_Data\\authorizationManager.xml may need to be manually installed.", false);
            }
        }
예제 #6
0
 private static List <string> GetParams(List <string> configs)
 {
     return(ListParser.FindInList(configs, TARGET, false));
 }