From 5c44b6345d98faab587c2102e582f9ee2f091394 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Mon, 20 Jun 2016 10:47:24 -0400 Subject: [PATCH] minor tweaks, add constructors to exception, add nuspec file to core library --- .gitignore | 1 + CompressR.sln | 5 +++++ gulpfile.js | 11 ++++++----- src/CompressR.WebApi/CompressAttribute.cs | 7 ++++++- src/CompressR/CompressR.csproj | 3 +++ src/CompressR/CompressR.nuspec | 17 +++++++++++++++++ src/CompressR/Exceptions/CompressRException.cs | 17 +++++++++++++++-- 7 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/CompressR/CompressR.nuspec diff --git a/.gitignore b/.gitignore index 3a2238d..e1af492 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ bld/ [Bb]in/ [Oo]bj/ +nuget.exe # Visual Studio 2015 cache/options directory .vs/ diff --git a/CompressR.sln b/CompressR.sln index 9a3d652..bb250b5 100644 --- a/CompressR.sln +++ b/CompressR.sln @@ -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 diff --git a/gulpfile.js b/gulpfile.js index 6e5cfb3..4267866 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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'})); }); \ No newline at end of file diff --git a/src/CompressR.WebApi/CompressAttribute.cs b/src/CompressR.WebApi/CompressAttribute.cs index 2b94105..3ef0d48 100644 --- a/src/CompressR.WebApi/CompressAttribute.cs +++ b/src/CompressR.WebApi/CompressAttribute.cs @@ -36,9 +36,14 @@ 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); diff --git a/src/CompressR/CompressR.csproj b/src/CompressR/CompressR.csproj index 35ff630..5f3c693 100644 --- a/src/CompressR/CompressR.csproj +++ b/src/CompressR/CompressR.csproj @@ -43,6 +43,9 @@ + + +