Skip to content

Instantly share code, notes, and snippets.

@johnazariah
Forked from davidfowl/gist:0fc85f3215adf4eab294
Last active August 29, 2015 14:21
Show Gist options
  • Save johnazariah/2e0585ce0fc89a8e2ca8 to your computer and use it in GitHub Desktop.
Save johnazariah/2e0585ce0fc89a8e2ca8 to your computer and use it in GitHub Desktop.
public class Program
{
public void Main()
{
var solution = new Directory
{
["global.json"] = new JObject
{
["projects"] = new JArray { "src", "test" }
},
["src"] = new Directory
{
["MyProject"] = new Directory
{
["Startup.cs"] = "public class Startup { }",
["project.json"] = new JObject
{
["dependencies"] = new JObject
{
["Newtonsoft.Json"] = "6.0.6"
},
["frameworks"] = new JObject
{
["dnx451"] = new JObject { }
}
}
}
}
};
}
}
type Solution =
| SolutionItems of SolutionItem seq
and SolutionItem =
| GlobalSettings of GlobalSettings
| Projects of (string * Project) seq
and GlobalSettings =
| ProjectNames of string seq
and Project =
| ProjectDirectories of (string * ProjectDirectory) seq
and ProjectDirectory =
| ProjectItems of (string * ProjectItem) seq
and ProjectItem =
| ProjectSettings of (string * ProjectSettingItem) seq
| SourceFile of string
and ProjectSettingItem =
| ProjectDependencies of (string * (ProjectDependency option)) seq
| ProjectFrameworks of (string * (ProjectFramework option)) seq
and ProjectDependency =
| DependencyVersion of string
and ProjectFramework =
| FrameworkVersion of string
let solution =
SolutionItems [
GlobalSettings (ProjectNames ["src"; "test"])
Projects [
("src", ProjectDirectories [
("MyProject", ProjectItems [
("Startup.cs", SourceFile ("public class Startup { }"))
("project.json", ProjectSettings [
("dependencies", ProjectDependencies [
("Newtonsoft.Json", Some (DependencyVersion "6.0.6"))
])
("frameworks", ProjectFrameworks [
("dnx451", None)
])
])
])
])
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment