Example #1
0
        private static void LogConfig(SugarRushConfiguration config)
        {
            _log($"Config: ");

            config.GetType().GetProperties()
            .ForEach(x => {
                var value = x.GetValue(config);

                if (value is HashSet <string> )
                {
                    var set = (HashSet <string>)value;

                    _log($"  {x.Name}: ");
                    foreach (var setValue in set)
                    {
                        _log($"    {setValue}");
                    }
                }

                else
                {
                    _log($"  {x.Name}: {value}");
                }
            });
        }
Example #2
0
        public static List <string> GetValidationErrors(SugarRushConfiguration config)
        {
            var errorMessages = new List <string>();

            if (config.folderPath.IsEmpty())
            {
                errorMessages.Add("Missing folderPath");
            }

            if (config.packageID.IsEmpty())
            {
                errorMessages.Add("Missing packageID");
            }

            if (config.packageVersion.IsEmpty())
            {
                errorMessages.Add("Missing packageVersion");
            }

            if (config.nugetRepoUrl.IsEmpty())
            {
                errorMessages.Add("Missing nugetRepoUrl");
            }

            return(errorMessages);
        }
Example #3
0
 private static void UpdatePackageFiles(IEnumerable <FileInfo> files, SugarRushConfiguration config, Dictionary <string, string> assDic)
 {
     Parallel.ForEach <FileInfo>(files, pf => {
         Console.WriteLine("Updating file: " + pf.FullName);
         var doc = SugarRushHandler.GetXmlDoc(pf.FullName);
         doc.UpdatePackageConfig(config.packageID, config.packageVersion);
     });
 }
Example #4
0
 private static void UpdateRefreshFiles(IEnumerable <FileInfo> files, SugarRushConfiguration config, Dictionary <string, string> assDic)
 {
     Parallel.ForEach <FileInfo>(files, rf =>
     {
         Console.WriteLine("Updating file: " + rf.FullName);
         rf.UpdateRefreshFile(config.packageID + "." + config.packageVersion, assDic);
     });
 }
Example #5
0
        public static bool IsValidConfig(SugarRushConfiguration config)
        {
            if (config.folderPath.IsEmpty())
            {
                return(false);
            }

            if (config.packageID.IsEmpty())
            {
                return(false);
            }

            if (config.packageVersion.IsEmpty())
            {
                return(false);
            }

            if (config.nugetRepoUrl.IsEmpty())
            {
                return(false);
            }

            return(true);
        }
Example #6
0
        public static IEnumerable <IPackage> GetPackages(SugarRushConfiguration config)
        {
            var repo = PackageRepositoryFactory.Default.CreateRepository(config.nugetRepoUrl);

            return(repo.FindPackagesById(config.packageID));
        }
Example #7
0
 public static IPackage GetPackage(SugarRushConfiguration config)
 {
     return(GetPackages(config).Where(p => p.Version.ToString() == config.packageVersion).FirstOrDefault());
 }