Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0929fe7

Browse files
committed
Initial commit.
0 parents  commit 0929fe7

40 files changed

+2567
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 2
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{cake,cs,fsd}]
11+
indent_size = 4
12+
indent_style = tab

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.vs/
2+
bin/
3+
cake/
4+
obj/
5+
packages/
6+
release/
7+
8+
*.cache
9+
*.ncrunchproject
10+
*.ncrunchsolution
11+
*.user

FacilityJavaScript.sln

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{A219E328-B15A-41FF-BAA5-5F46679EF9C8}"
7+
ProjectSection(SolutionItems) = preProject
8+
.gitignore = .gitignore
9+
build.cake = build.cake
10+
SolutionInfo.cs = SolutionInfo.cs
11+
EndProjectSection
12+
EndProject
13+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fsdgenjs", "src\fsdgenjs\fsdgenjs.csproj", "{3B9A5F61-E874-4A5A-BB5F-436990E521F3}"
14+
EndProject
15+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facility.JavaScript", "src\Facility.JavaScript\Facility.JavaScript.csproj", "{B6EA1C94-27CD-4602-8544-6D16D225917F}"
16+
EndProject
17+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facility.JavaScript.UnitTests", "tests\Facility.JavaScript.UnitTests\Facility.JavaScript.UnitTests.csproj", "{EADECDC8-65A8-47A7-91ED-10CA49F15B97}"
18+
EndProject
19+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{06D7A4F7-94FF-457B-9BA7-407B226FBBDF}"
20+
ProjectSection(SolutionItems) = preProject
21+
src\Facility.JavaScript.nuspec = src\Facility.JavaScript.nuspec
22+
src\fsdgenjs.nuspec = src\fsdgenjs.nuspec
23+
src\README.md = src\README.md
24+
EndProjectSection
25+
EndProject
26+
Global
27+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
28+
Debug|Any CPU = Debug|Any CPU
29+
Release|Any CPU = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
32+
{3B9A5F61-E874-4A5A-BB5F-436990E521F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{3B9A5F61-E874-4A5A-BB5F-436990E521F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{3B9A5F61-E874-4A5A-BB5F-436990E521F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{3B9A5F61-E874-4A5A-BB5F-436990E521F3}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{B6EA1C94-27CD-4602-8544-6D16D225917F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{B6EA1C94-27CD-4602-8544-6D16D225917F}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{B6EA1C94-27CD-4602-8544-6D16D225917F}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{B6EA1C94-27CD-4602-8544-6D16D225917F}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{EADECDC8-65A8-47A7-91ED-10CA49F15B97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{EADECDC8-65A8-47A7-91ED-10CA49F15B97}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{EADECDC8-65A8-47A7-91ED-10CA49F15B97}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{EADECDC8-65A8-47A7-91ED-10CA49F15B97}.Release|Any CPU.Build.0 = Release|Any CPU
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
EndGlobal

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Ed Ball
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Facility for JavaScript
2+
3+
JavaScript and TypeScript support for the [Facility API Framework](https://github.com/FacilityApi/Facility).

SolutionInfo.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyVersion("0.1.3.0")]
4+
[assembly: AssemblyCompany("")]
5+
[assembly: AssemblyCopyright("Copyright 2016 Ed Ball")]
6+
[assembly: AssemblyTrademark("")]
7+
[assembly: AssemblyCulture("")]

appveyor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '{build}'
2+
environment:
3+
COVERALLSAPIKEY:
4+
secure: P/ta9dfRyNJlTkwH50tW84vP9FdfDXSGN9Af4k4CgWHUMOAxkppdW3ndhOdSzyBJ
5+
build_script:
6+
- ps: .\build.ps1 -target=CoveragePublish -configuration=Debug "-coverallsApiKey=$env:COVERALLSAPIKEY"
7+
test: off

build.cake

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
#addin "nuget:?package=Cake.Git&version=0.10.0"
2+
#addin "nuget:?package=Octokit&version=0.23.0"
3+
#tool "nuget:?package=coveralls.io&version=1.3.4"
4+
#tool "nuget:?package=gitlink&version=2.3.0"
5+
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.5.0"
6+
#tool "nuget:?package=OpenCover&version=4.6.519"
7+
#tool "nuget:?package=ReportGenerator&version=2.5.0"
8+
9+
using LibGit2Sharp;
10+
11+
var target = Argument("target", "Default");
12+
var configuration = Argument("configuration", "Release");
13+
var nugetApiKey = Argument("nugetApiKey", "");
14+
var githubApiKey = Argument("githubApiKey", "");
15+
var coverallsApiKey = Argument("coverallsApiKey", "");
16+
17+
var solutionFileName = "FacilityJavaScript.sln";
18+
var githubOwner = "FacilityApi";
19+
var githubRepo = "FacilityJavaScript";
20+
var githubRawUri = "http://raw.githubusercontent.com";
21+
var nugetSource = "https://www.nuget.org/api/v2/package";
22+
var coverageAssemblies = new[] { "Facility.JavaScript" };
23+
24+
var gitRepository = new LibGit2Sharp.Repository(MakeAbsolute(Directory(".")).FullPath);
25+
26+
var githubClient = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("build.cake"));
27+
if (!string.IsNullOrEmpty(githubApiKey))
28+
githubClient.Credentials = new Octokit.Credentials(githubApiKey);
29+
30+
string headSha = null;
31+
string version = null;
32+
33+
string GetSemVerFromFile(string path)
34+
{
35+
var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(path);
36+
return $"{versionInfo.FileMajorPart}.{versionInfo.FileMinorPart}.{versionInfo.FileBuildPart}";
37+
}
38+
39+
Task("Clean")
40+
.Does(() =>
41+
{
42+
CleanDirectories($"src/**/bin");
43+
CleanDirectories($"src/**/obj");
44+
CleanDirectories($"tests/**/bin");
45+
CleanDirectories($"tests/**/obj");
46+
CleanDirectories("release");
47+
});
48+
49+
Task("Build")
50+
.IsDependentOn("Clean")
51+
.Does(() =>
52+
{
53+
NuGetRestore(solutionFileName);
54+
MSBuild(solutionFileName, settings => settings.SetConfiguration(configuration));
55+
});
56+
57+
Task("Test")
58+
.IsDependentOn("Build")
59+
.Does(() => NUnit3($"tests/**/bin/**/*.UnitTests.dll", new NUnit3Settings { NoResults = true }));
60+
61+
Task("SourceIndex")
62+
.IsDependentOn("Test")
63+
.WithCriteria(() => configuration == "Release")
64+
.Does(() =>
65+
{
66+
var dirtyEntry = gitRepository.RetrieveStatus().FirstOrDefault(x => x.State != FileStatus.Unaltered && x.State != FileStatus.Ignored);
67+
if (dirtyEntry != null)
68+
throw new InvalidOperationException($"The git working directory must be clean, but '{dirtyEntry.FilePath}' is dirty.");
69+
70+
headSha = gitRepository.Head.Tip.Sha;
71+
try
72+
{
73+
githubClient.Repository.Commit.GetSha1(githubOwner, githubRepo, headSha).GetAwaiter().GetResult();
74+
}
75+
catch (Octokit.NotFoundException exception)
76+
{
77+
throw new InvalidOperationException($"The current commit '{headSha}' must be pushed to GitHub.", exception);
78+
}
79+
80+
GitLink(MakeAbsolute(Directory(".")).FullPath, new GitLinkSettings
81+
{
82+
RepositoryUrl = $"{githubRawUri}/{githubOwner}/{githubRepo}",
83+
ArgumentCustomization = args => args.Append($"-ignore Bom,BomTest"),
84+
});
85+
86+
version = GetSemVerFromFile(GetFiles($"src/**/bin/**/{coverageAssemblies[0]}.dll").First().ToString());
87+
});
88+
89+
Task("NuGetPackage")
90+
.IsDependentOn("SourceIndex")
91+
.Does(() =>
92+
{
93+
CreateDirectory("release");
94+
95+
foreach (var nuspecPath in GetFiles($"src/*.nuspec"))
96+
{
97+
NuGetPack(nuspecPath, new NuGetPackSettings
98+
{
99+
Version = version,
100+
OutputDirectory = "release",
101+
});
102+
}
103+
});
104+
105+
Task("NuGetPublish")
106+
.IsDependentOn("NuGetPackage")
107+
.WithCriteria(() => !string.IsNullOrEmpty(nugetApiKey) && !string.IsNullOrEmpty(githubApiKey))
108+
.Does(() =>
109+
{
110+
foreach (var nupkgPath in GetFiles($"release/*.nupkg"))
111+
{
112+
NuGetPush(nupkgPath, new NuGetPushSettings
113+
{
114+
ApiKey = nugetApiKey,
115+
Source = nugetSource,
116+
});
117+
}
118+
119+
var tagName = $"nuget-{version}";
120+
Information($"Creating git tag '{tagName}'...");
121+
githubClient.Git.Reference.Create(githubOwner, githubRepo,
122+
new Octokit.NewReference($"refs/tags/{tagName}", headSha)).GetAwaiter().GetResult();
123+
});
124+
125+
Task("Coverage")
126+
.IsDependentOn("Build")
127+
.Does(() =>
128+
{
129+
CreateDirectory("release");
130+
if (FileExists("release/coverage.xml"))
131+
DeleteFile("release/coverage.xml");
132+
133+
string filter = string.Concat(coverageAssemblies.Select(x => $@" ""-filter:+[{x}]*"""));
134+
135+
foreach (var testDllPath in GetFiles($"tests/**/bin/**/*.UnitTests.dll"))
136+
{
137+
ExecuteProcess(@"cake\OpenCover\tools\OpenCover.Console.exe",
138+
$@"-register:user -mergeoutput ""-target:cake\NUnit.ConsoleRunner\tools\nunit3-console.exe"" ""-targetargs:{testDllPath} --noresult"" ""-output:release\coverage.xml"" -skipautoprops -returntargetcode" + filter);
139+
}
140+
});
141+
142+
Task("CoverageReport")
143+
.IsDependentOn("Coverage")
144+
.Does(() =>
145+
{
146+
ExecuteProcess(@"cake\ReportGenerator\tools\ReportGenerator.exe", $@"""-reports:release\coverage.xml"" ""-targetdir:release\coverage""");
147+
});
148+
149+
Task("CoveragePublish")
150+
.IsDependentOn("Coverage")
151+
.Does(() =>
152+
{
153+
ExecuteProcess(@"cake\coveralls.io\tools\coveralls.net.exe", $@"--opencover ""release\coverage.xml"" --full-sources --repo-token {coverallsApiKey}");
154+
});
155+
156+
Task("Default")
157+
.IsDependentOn("Test");
158+
159+
void ExecuteProcess(string exePath, string arguments)
160+
{
161+
int exitCode = StartProcess(exePath, arguments);
162+
if (exitCode != 0)
163+
throw new InvalidOperationException($"{exePath} failed with exit code {exitCode}.");
164+
}
165+
166+
RunTarget(target);

build.ps1

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<#
2+
.SYNOPSIS
3+
This is a Powershell script to bootstrap a Cake build.
4+
#>
5+
6+
[CmdletBinding()]
7+
Param(
8+
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
9+
[string[]]$ScriptArgs
10+
)
11+
12+
# create cake directory
13+
$CakeDirPath = Join-Path $PSScriptRoot "cake"
14+
New-Item -Path $CakeDirPath -Type Directory -ErrorAction SilentlyContinue | Out-Null
15+
16+
# create packages.config
17+
$PackagesConfigPath = Join-Path $CakeDirPath "packages.config"
18+
If (!(Test-Path $PackagesConfigPath)) {
19+
[System.IO.File]::WriteAllLines($PackagesConfigPath, @(
20+
"<?xml version=`"1.0`" encoding=`"utf-8`"?>",
21+
"<packages>",
22+
"`t<package id=`"Cake`" version=`"0.14.0`" />",
23+
"</packages>"))
24+
}
25+
26+
# download nuget.exe if not in path and not already downloaded
27+
$NuGetExe = Get-Command "nuget.exe" -ErrorAction SilentlyContinue
28+
If ($NuGetExe -ne $null) {
29+
$NuGetExePath = $NuGetExe.Path
30+
}
31+
Else {
32+
$NuGetExePath = Join-Path $CakeDirPath "nuget.exe"
33+
If (!(Test-Path $NuGetExePath)) {
34+
Invoke-WebRequest -Uri http://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NuGetExePath
35+
}
36+
}
37+
38+
# use NuGet to download Cake
39+
Push-Location $CakeDirPath
40+
Invoke-Expression "&`"$NuGetExePath`" install -ExcludeVersion -OutputDirectory ."
41+
If ($LASTEXITCODE -ne 0) {
42+
Throw "An error occured while restoring NuGet tools."
43+
}
44+
Pop-Location
45+
46+
# run Cake with specified arguments
47+
$CakeExePath = Join-Path $CakeDirPath "Cake/Cake.exe"
48+
Invoke-Expression "& `"$CakeExePath`" --paths_tools=cake -experimental $ScriptArgs"
49+
Exit $LASTEXITCODE

0 commit comments

Comments
 (0)