예제 #1
0
        public List <RubyHash> CalculateDeployments()
        {
            List <RubyHash> deployments = new List <RubyHash>();

            foreach (string d in AllDeployments())
            {
                string             deploymentDateTime = new DirectoryInfo(d).Name;
                DeploymentMetadata deploymentMetadata = DeploymentMetadataFor(deploymentDateTime);
                deployments.Add(new RubyHash()
                {
                    { "id", deploymentMetadata.Id },
                    { "ref", deploymentMetadata.GitRef },
                    { "sha1", deploymentMetadata.GitSha },
                    { "force_clean_build", deploymentMetadata.ForceCleanBuild },
                    { "hot_deploy", deploymentMetadata.HotDeploy },
                    { "created_at", RubyCompatibility.DateTimeToEpochSeconds(DateTime.Parse(deploymentDateTime)) },
                    { "activations", deploymentMetadata.Activations }
                });
            }

            return(deployments);
        }
예제 #2
0
        public void Test_RubyCompatibility()
        {
            int epochValue = RubyCompatibility.DateTimeToEpochSeconds(new DateTime(1970, 1, 1));

            Assert.AreEqual(0, epochValue);
        }
        public static bool CheckUrlAge(string url)
        {
            Uri uri    = new Uri(url);
            int urlAge = int.Parse(HttpUtility.ParseQueryString(uri.Query)["timestamp"]) - RubyCompatibility.DateTimeToEpochSeconds(DateTime.Now);

            if (urlAge > 60 * 60)
            {
                return(false);
            }
            return(true);
        }