Skip to content

Commit d76ff5b

Browse files
committed
Dusting off this projects cobwebs...
Enabled nuget package restore. Updated dependencies on Castle and RestSharp. RestSharp update to 103 has removed dependency on Newtonsoft.Json.
1 parent b0333d4 commit d76ff5b

11 files changed

Lines changed: 107 additions & 28 deletions

File tree

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,14 @@ obj/
2828
_ReSharper*/
2929
[Tt]est[Rr]esult*
3030
*.*~
31+
[Pp]ackages/
3132

3233
#Ignore Secrets.json
3334
[Ss]ecrets.json
3435

35-
#Ignore the nubular config store
36-
.nu
37-
3836
#Ignore UppercuT output
3937
deployment/
4038
build_output/
4139
code_drop/
4240
gems/
4341
SolutionVersion.cs
44-
45-
#ignore password stuff
46-
secrets.json

.nuget/NuGet.Config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<add key="disableSourceControlIntegration" value="true" />
5+
</solution>
6+
</configuration>

.nuget/NuGet.exe

554 KB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Windows specific commands -->
7+
<NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
8+
<PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
9+
<PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
10+
11+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
12+
<NuGetToolsPath Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir).nuget</NuGetToolsPath>
13+
<PackagesConfig Condition=" '$(OS)' != 'Windows_NT' ">packages.config</PackagesConfig>
14+
<PackagesDir Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)packages</PackagesDir>
15+
16+
<!-- NuGet command -->
17+
<NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
18+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
19+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
20+
21+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
22+
23+
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
24+
<PackageSources>""</PackageSources>
25+
26+
<!-- Enable the restore command to run before builds -->
27+
<RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
28+
29+
<!-- Property that enables building a package from a project -->
30+
<BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
31+
32+
<!-- Commands -->
33+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
34+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
35+
36+
<!-- Make the build depend on restore packages -->
37+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
38+
RestorePackages;
39+
$(BuildDependsOn);
40+
</BuildDependsOn>
41+
42+
<!-- Make the build depend on restore packages -->
43+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
44+
$(BuildDependsOn);
45+
BuildPackage;
46+
</BuildDependsOn>
47+
</PropertyGroup>
48+
49+
<Target Name="CheckPrerequisites">
50+
<!-- Raise an error if we're unable to locate nuget.exe -->
51+
<Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
52+
</Target>
53+
54+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
55+
<Exec Command="$(RestoreCommand)"
56+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
57+
58+
<Exec Command="$(RestoreCommand)"
59+
LogStandardErrorAsError="true"
60+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
61+
</Target>
62+
63+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
64+
<Exec Command="$(BuildCommand)"
65+
Condition=" '$(OS)' != 'Windows_NT' " />
66+
67+
<Exec Command="$(BuildCommand)"
68+
LogStandardErrorAsError="true"
69+
Condition=" '$(OS)' == 'Windows_NT' " />
70+
</Target>
71+
</Project>

csharp-github-api.2010.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
LICENSE.txt = LICENSE.txt
1313
EndProjectSection
1414
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{A399513F-82FF-4E02-94A0-6F7C76430C35}"
16+
ProjectSection(SolutionItems) = preProject
17+
.nuget\NuGet.exe = .nuget\NuGet.exe
18+
.nuget\NuGet.targets = .nuget\NuGet.targets
19+
EndProjectSection
20+
EndProject
1521
Global
1622
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1723
Debug|Any CPU = Debug|Any CPU

csharp-github-api.IntegrationTests/csharp-github-api.IntegrationTests.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
</UpgradeBackupLocation>
1919
<OldToolsVersion>3.5</OldToolsVersion>
2020
<TargetFrameworkProfile />
21+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
22+
<RestorePackages>true</RestorePackages>
2123
</PropertyGroup>
2224
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2325
<DebugSymbols>true</DebugSymbols>
@@ -39,20 +41,17 @@
3941
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
4042
</PropertyGroup>
4143
<ItemGroup>
42-
<Reference Include="FluentAssertions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
44+
<Reference Include="FluentAssertions, Version=1.7.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
4345
<SpecificVersion>False</SpecificVersion>
44-
<HintPath>..\packages\FluentAssertions.1.5.0.0\Lib\.NetFramework 4.0\FluentAssertions.dll</HintPath>
45-
</Reference>
46-
<Reference Include="Newtonsoft.Json">
47-
<HintPath>..\packages\Newtonsoft.Json.4.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
46+
<HintPath>..\packages\FluentAssertions.1.7.1.1\Lib\net40\FluentAssertions.dll</HintPath>
4847
</Reference>
4948
<Reference Include="nunit.framework, Version=2.5.7.10213, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
5049
<SpecificVersion>False</SpecificVersion>
5150
<HintPath>..\lib\nunit\net-2.0\nunit.framework.dll</HintPath>
5251
</Reference>
53-
<Reference Include="RestSharp, Version=102.0.0.0, Culture=neutral, processorArchitecture=MSIL">
52+
<Reference Include="RestSharp, Version=102.7.0.0, Culture=neutral, processorArchitecture=MSIL">
5453
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\packages\RestSharp.102.0\lib\net4\RestSharp.dll</HintPath>
54+
<HintPath>..\packages\RestSharp.103.0.0\lib\net35\RestSharp.dll</HintPath>
5655
</Reference>
5756
<Reference Include="StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
5857
<SpecificVersion>False</SpecificVersion>
@@ -99,6 +98,7 @@
9998
<PostBuildEvent>
10099
</PostBuildEvent>
101100
</PropertyGroup>
101+
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
102102
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
103103
Other similar extension points exist, see Microsoft.Common.targets.
104104
<Target Name="BeforeBuild">
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="FluentAssertions" version="1.5.0.0" />
4-
<package id="Newtonsoft.Json" version="4.0.2" />
5-
<package id="RestSharp" version="102.0" />
3+
<package id="FluentAssertions" version="1.7.1.1" />
4+
<package id="RestSharp" version="103.0.0" />
65
<package id="structuremap" version="2.6.3" />
76
</packages>

csharp-github-api/Core/GitHubResponseException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected GitHubResponseException(
3535
/// <summary>
3636
/// Gets or sets the raw error response from GitHub.
3737
/// </summary>
38-
public RestResponseBase Response
38+
public object Response
3939
{
4040
get; set;
4141
}

csharp-github-api/Extensions/MiscExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
// </copyright>
1717
//----------------------------------------------------------------------
1818

19+
using System.Collections.Generic;
1920
using csharp_github_api.Core;
2021
using RestSharp;
22+
using csharp_github_api.Models;
2123

2224
namespace csharp_github_api.Extensions
2325
{
@@ -39,7 +41,7 @@ public static bool ShouldBe(this HttpStatusCode response, HttpStatusCode expecte
3941
return response.Equals(expected);
4042
}
4143

42-
public static void IfNotRaiseAnError(this bool ok, RestResponseBase response)
44+
public static void IfNotRaiseAnError<TModel>(this bool ok, IRestResponse<List<TModel>> response)
4345
{
4446
if (ok) return;
4547

csharp-github-api/csharp-github-api.csproj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
</FileUpgradeFlags>
1717
<OldToolsVersion>3.5</OldToolsVersion>
1818
<UpgradeBackupLocation />
19+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
20+
<RestorePackages>true</RestorePackages>
1921
</PropertyGroup>
2022
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2123
<DebugSymbols>true</DebugSymbols>
@@ -37,15 +39,13 @@
3739
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
3840
</PropertyGroup>
3941
<ItemGroup>
40-
<Reference Include="Castle.Core">
41-
<HintPath>..\packages\Castle.Core.2.5.2\lib\NET35\Castle.Core.dll</HintPath>
42-
</Reference>
43-
<Reference Include="Newtonsoft.Json.Net35">
44-
<HintPath>..\packages\Newtonsoft.Json.4.0.2\lib\net35\Newtonsoft.Json.Net35.dll</HintPath>
42+
<Reference Include="Castle.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>..\packages\Castle.Core.3.0.0.4001\lib\net35\Castle.Core.dll</HintPath>
4545
</Reference>
46-
<Reference Include="RestSharp, Version=102.0.0.0, Culture=neutral, processorArchitecture=MSIL">
46+
<Reference Include="RestSharp, Version=102.7.0.0, Culture=neutral, processorArchitecture=MSIL">
4747
<SpecificVersion>False</SpecificVersion>
48-
<HintPath>..\packages\RestSharp.102.0\lib\net35\RestSharp.dll</HintPath>
48+
<HintPath>..\packages\RestSharp.103.0.0\lib\net35\RestSharp.dll</HintPath>
4949
</Reference>
5050
<Reference Include="System" />
5151
<Reference Include="System.Core">
@@ -77,6 +77,7 @@
7777
<None Include="packages.config" />
7878
</ItemGroup>
7979
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
80+
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
8081
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8182
Other similar extension points exist, see Microsoft.Common.targets.
8283
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)