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/ bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/
nuget.exe
# Visual Studio 2015 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/

View File

@@ -15,6 +15,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompressR.Sample", "src\Com
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompressR", "src\CompressR\CompressR.csproj", "{C94378C3-4AA8-4F49-8720-77D14B62F72E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompressR", "src\CompressR\CompressR.csproj", "{C94378C3-4AA8-4F49-8720-77D14B62F72E}"
EndProject 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 Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\CompressR.MVC\CompressR.MVC.projitems*{b8889368-e350-4b1e-82f5-ea537d6da6e9}*SharedItemsImports = 4 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 download = require("gulp-download");
var del = require('del'); var del = require('del');
var assemblyInfo = require('gulp-dotnet-assembly-info'); var assemblyInfo = require('gulp-dotnet-assembly-info');
var version = '1.0.2'; var version = '1.1.0';
gulp.task('clean', ()=>{ 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'], ()=>{ gulp.task('downloadNuget', ['clean'], ()=>{
return download('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe') 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'], ()=>{ 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({ .pipe(nuget.pack({
build: false, build: false,
symbols: true, symbols: true,
properties: 'configuration=Release', properties: 'configuration=Release',
outputDirectory: './nupkgs' outputDirectory: './nupkgs',
includeReferencedProjects: true
})); }));
}); });
gulp.task('publish', ['pack'], ()=>{ gulp.task('publish', ['pack'], ()=>{
return gulp.src('./nupkgs/*.nupkg') 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,9 +36,14 @@ namespace CompressR.WebApi
if (string.IsNullOrWhiteSpace(acceptedEncoding)) if (string.IsNullOrWhiteSpace(acceptedEncoding))
{ {
if (RequireCompression) 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 else
{
return; return;
}
} }
actionExecutedContext.Response.Content = new CompressedContent(actionExecutedContext.Response.Content, acceptedEncoding); actionExecutedContext.Response.Content = new CompressedContent(actionExecutedContext.Response.Content, acceptedEncoding);

View File

@@ -43,6 +43,9 @@
<Compile Include="Exceptions\CompressRException.cs" /> <Compile Include="Exceptions\CompressRException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="CompressR.nuspec" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,18 @@ namespace CompressR.Exceptions
{ {
public class CompressRException: Exception public class CompressRException: Exception
{ {
public CompressRException(string message) : base(message) { } 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)
{
}
}
} }