Exemple #1
0
        private static void GenerateAllVersions(RepositoryUrl repositoryUrl)
        {
            var mongo = new MongoRepository();
            var commits = mongo.GetCommits().Where(x => x.RepositoryUrl.Equals(repositoryUrl.Url));

            commits.ToList().ForEach(x => GenerateVersion(repositoryUrl, x.SHA));
        }
        public ActionResult GetNodeMetrics(string repositoryUrl, string node)
        {
            var mongo = new MongoRepository();
            var pieces = HttpUtility.HtmlDecode(node).Split('>');
            var commits = mongo.GetCommits().Where(x => x.RepositoryUrl == repositoryUrl).OrderBy(x => x.Date);

            if (pieces.Length == 1)
            {
                var result = commits.Select(commit => ExtractModuleInfo(commit, pieces[0]));
                return Json(result, JsonRequestBehavior.AllowGet);
            }

            if (pieces.Length == 2)
            {
                var result = commits.Select(commit => ExtractNamespaceInfo(commit, pieces[0], pieces[1]));
                return Json(result, JsonRequestBehavior.AllowGet);
            }

            if (pieces.Length == 3)
            {
                var result = commits.Select(commit => ExtractTypeInfo(commit, pieces[0], pieces[1], pieces[2]));
                return Json(result, JsonRequestBehavior.AllowGet);
            }

            if (pieces.Length == 4)
            {
                var result = commits.Select(commit => ExtractMemberInfo(commit, pieces[0], pieces[1], pieces[2], pieces[3]));
                return Json(result, JsonRequestBehavior.AllowGet);
            }

            return null;
        }
Exemple #3
0
        private static void CalculateMetrics(RepositoryUrl repositoryUrl)
        {
            var mongo = new MongoRepository();
            var commits = mongo.GetCommits().Where(x => x.RepositoryUrl.Equals(repositoryUrl.Url)).ToList();

            commits.ForEach(x =>
                {
                    //try
                    //{
                        var solution = new Solution(repositoryUrl, x.SHA);
                        solution.Build();
                        solution.CalculateMetrics();
                        solution.SaveMetrics();
                        WriteToConsole(x.SHA + "- OK");
                    //}
                    //catch (Exception ex)
                    //{
                    //    WriteToConsole(x.SHA + "- ERROR - " + ex.Message);
                    //}

                });
        }