Sha256: 98995e48a12358090b7fd195d73a70e5f2e93598280eac713cf9101ade977daa

Contents?: true

Size: 967 Bytes

Versions: 22

Compression:

Stored size: 967 Bytes

Contents

using System.IO;
using System.Linq;
using LibGit2Sharp;

namespace Generators.Input
{
    public static class CanonicalDataFile
    {
        private const string CacheDir = "./.cache";
        private const string ProblemSpecificationsGitUrl = "https://github.com/exercism/problem-specifications.git";
        private const string RemoteName = "origin";

        static CanonicalDataFile()
        {
            if (!Directory.Exists(CacheDir))
                Repository.Clone(ProblemSpecificationsGitUrl, CacheDir);

            using (var repository = new Repository(CacheDir))
                Commands.Fetch(repository, RemoteName, Enumerable.Empty<string>(), new FetchOptions(), null);
        }

        public static string Contents(string exercise)
        {
            var exerciseCanonicalDataPath = Path.Combine(CacheDir, "exercises", exercise, "canonical-data.json");
            return File.ReadAllText(exerciseCanonicalDataPath);
        }
    }
}

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
trackler-2.2.1.12 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.11 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.10 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.9 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.8 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.7 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.6 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.5 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.4 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.3 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.2 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.1 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.1.0 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.6 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.5 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.4 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.3 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.2 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.1 tracks/csharp/generators/Input/CanonicalDataFile.cs
trackler-2.2.0.0 tracks/csharp/generators/Input/CanonicalDataFile.cs