minor tweaks, add constructors to exception, add nuspec file to core library

This commit is contained in:
Tommy Parnell
2016-06-20 10:47:24 -04:00
parent dd922411ae
commit 5c44b6345d
7 changed files with 53 additions and 8 deletions

1
.gitignore vendored
View File

@@ -21,6 +21,7 @@
bld/
[Bb]in/
[Oo]bj/
nuget.exe
# Visual Studio 2015 cache/options directory
.vs/

View File

@@ -15,6 +15,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompressR.Sample", "src\Com
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompressR", "src\CompressR\CompressR.csproj", "{C94378C3-4AA8-4F49-8720-77D14B62F72E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{99494CD9-7FF3-4FFF-B1A4-51CE56BA2D94}"
ProjectSection(SolutionItems) = preProject
gulpfile.js = gulpfile.js
EndProjectSection
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\CompressR.MVC\CompressR.MVC.projitems*{b8889368-e350-4b1e-82f5-ea537d6da6e9}*SharedItemsImports = 4

View File

@@ -4,10 +4,10 @@ var msbuild = require('gulp-msbuild');
var download = require("gulp-download");
var del = require('del');
var assemblyInfo = require('gulp-dotnet-assembly-info');
var version = '1.0.2';
var version = '1.1.0';
gulp.task('clean', ()=>{
return del(['src/**/obj/', 'src/**/bin/Release', 'nuget.exe', 'nupkgs', 'packages'])
return del(['src/**/obj/', 'src/**/bin/Release', 'nuget.exe', 'nupkgs'])
});
gulp.task('downloadNuget', ['clean'], ()=>{
return download('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe')
@@ -36,16 +36,17 @@ gulp.task('build', ['restore', 'patchAssemblyInfo'], ()=>{
});
gulp.task('pack', ['build'], ()=>{
return gulp.src(['src/CompressR.MVC4/*.csproj', 'src/CompressR.MVC5/*.csproj', 'src/CompressR.WebApi/*.csproj'])
return gulp.src(['src/CompressR.MVC4/*.csproj', 'src/CompressR.MVC5/*.csproj', 'src/CompressR.WebApi/*.csproj', 'src/CompressR/*.csproj'])
.pipe(nuget.pack({
build: false,
symbols: true,
properties: 'configuration=Release',
outputDirectory: './nupkgs'
outputDirectory: './nupkgs',
includeReferencedProjects: true
}));
});
gulp.task('publish', ['pack'], ()=>{
return gulp.src('./nupkgs/*.nupkg')
.pipe(nuget.push({ nuget: "nuget.exe", source: 'https://www.nuget.org/api/v2/package', apiKey: process.env.nugetApiKey}));
.pipe(nuget.push({ nuget: "nuget.exe", source: 'https://www.nuget.org/api/v2/package', apiKey: '9d1cc8fb-2c00-47cc-93ff-153a8871052d'}));
});

View File

@@ -36,11 +36,16 @@ namespace CompressR.WebApi
if (string.IsNullOrWhiteSpace(acceptedEncoding))
{
if (RequireCompression)
throw new CompressRException("Compression required but client did not send accept header");
{
throw new CompressRException("Compression required but client did not send accept header")
}
else
{
return;
}
}
actionExecutedContext.Response.Content = new CompressedContent(actionExecutedContext.Response.Content, acceptedEncoding);
}

View File

@@ -43,6 +43,9 @@
<Compile Include="Exceptions\CompressRException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="CompressR.nuspec" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<package>
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>https://github.com/tparnell8/CompressR</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Help you compress your actions</description>
<releaseNotes></releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>Compression MVC</tags>
</metadata>
</package>

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
@@ -8,6 +9,18 @@ namespace CompressR.Exceptions
{
public class CompressRException: Exception
{
public CompressRException()
{
}
public CompressRException(string message) : base(message) { }
public CompressRException(string message, Exception innerException) : base(message, innerException)
{
}
protected CompressRException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}