Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
Updated to Nancy v0.12 and fixed compile and unit tests errors caused…
Browse files Browse the repository at this point in the history
… by the upgrade.
  • Loading branch information
csainty committed Oct 3, 2012
1 parent 74fb91e commit 156e2de
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 60 deletions.
3 changes: 2 additions & 1 deletion Apphbify.Tests/App.config
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="CRYPTO_PASSPHRASE" value="testing passphrase that is replaced on production" />
<add key="CRYPTO_SALT" value="41DB82B0-070A-449D-BBDE-0FA7791E907F" />
<add key="webPages:Enabled" value="false" />
</appSettings>
</configuration>
29 changes: 13 additions & 16 deletions Apphbify.Tests/Apphbify.Tests.csproj
Expand Up @@ -36,26 +36,23 @@
<Reference Include="AppHarbor.Sdk">
<HintPath>..\packages\AppHarbor.NET.2.0.0\lib\net35\AppHarbor.Sdk.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Testing.0.11.0\lib\net40\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPlus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Testing.0.11.0\lib\net40\HtmlAgilityPlus.dll</HintPath>
<Reference Include="CsQuery">
<HintPath>..\packages\CsQuery.1.2.1\lib\net40\CsQuery.dll</HintPath>
</Reference>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="Nancy, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Nancy, Version=0.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.0.11.0\lib\net40\Nancy.dll</HintPath>
<HintPath>..\packages\Nancy.0.12.1\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Testing, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Nancy.Testing, Version=0.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Testing.0.11.0\lib\net40\Nancy.Testing.dll</HintPath>
<HintPath>..\packages\Nancy.Testing.0.12.1\lib\net40\Nancy.Testing.dll</HintPath>
</Reference>
<Reference Include="Nancy.ViewEngines.Razor, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Nancy.ViewEngines.Razor, Version=0.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.11.0\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.12.1\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=103.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand All @@ -65,16 +62,16 @@
<Reference Include="System.Core" />
<Reference Include="System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.11.0\lib\net40\System.Web.Razor.dll</HintPath>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.12.1\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit, Version=1.9.0.1566, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<Reference Include="xunit, Version=1.9.1.1600, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\xunit.1.9.0.1566\lib\xunit.dll</HintPath>
<HintPath>..\packages\xunit.1.9.1\lib\net20\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -145,8 +142,8 @@
<PropertyGroup>
<PostBuildEvent>
if $(ConfigurationName) == Debug (
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.11.0\BuildProviders\Nancy.ViewEngines.Razor.BuildProviders.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.11.0\lib\Net40\Nancy.ViewEngines.Razor.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.12.1\BuildProviders\Nancy.ViewEngines.Razor.BuildProviders.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.12.1\lib\Net40\Nancy.ViewEngines.Razor.dll" "$(ProjectDir)bin"
)
</PostBuildEvent>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion Apphbify.Tests/Testing.cs
Expand Up @@ -32,7 +32,6 @@ static Testing()
{
cfg.Module<TModule>();
config.Dependencies(cfg);
cfg.DisableAutoRegistration();
cfg.NancyEngine<NancyEngine>();
cfg.ViewEngines(typeof(TestingViewEngine));
});
Expand Down
9 changes: 5 additions & 4 deletions Apphbify.Tests/packages.config
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AppHarbor.NET" version="2.0.0" />
<package id="CsQuery" version="1.2.1" targetFramework="net40" />
<package id="Moq" version="4.0.10827" />
<package id="Nancy" version="0.11.0" />
<package id="Nancy.Testing" version="0.11.0" />
<package id="Nancy.Viewengines.Razor" version="0.11.0" />
<package id="Nancy" version="0.12.1" targetFramework="net40" />
<package id="Nancy.Testing" version="0.12.1" targetFramework="net40" />
<package id="Nancy.Viewengines.Razor" version="0.12.1" targetFramework="net40" />
<package id="RestSharp" version="103.1" />
<package id="xunit" version="1.9.0.1566" />
<package id="xunit" version="1.9.1" targetFramework="net40" />
</packages>
22 changes: 13 additions & 9 deletions Apphbify/Apphbify.csproj
Expand Up @@ -23,6 +23,10 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -46,17 +50,17 @@
<HintPath>..\packages\AppHarbor.NET.2.0.0\lib\net35\AppHarbor.Sdk.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Nancy, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Nancy, Version=0.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.0.11.0\lib\net40\Nancy.dll</HintPath>
<HintPath>..\packages\Nancy.0.12.1\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Hosting.Aspnet, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Nancy.Hosting.Aspnet, Version=0.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Hosting.Aspnet.0.11.0\lib\net40\Nancy.Hosting.Aspnet.dll</HintPath>
<HintPath>..\packages\Nancy.Hosting.Aspnet.0.12.1\lib\net40\Nancy.Hosting.Aspnet.dll</HintPath>
</Reference>
<Reference Include="Nancy.ViewEngines.Razor, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Nancy.ViewEngines.Razor, Version=0.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.11.0\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.12.1\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
Expand All @@ -75,7 +79,7 @@
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.11.0\lib\net40\System.Web.Razor.dll</HintPath>
<HintPath>..\packages\Nancy.Viewengines.Razor.0.12.1\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
Expand Down Expand Up @@ -269,8 +273,8 @@
<PropertyGroup>
<PostBuildEvent>
if $(ConfigurationName) == Debug (
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.11.0\BuildProviders\Nancy.ViewEngines.Razor.BuildProviders.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.11.0\lib\Net40\Nancy.ViewEngines.Razor.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.12.1\BuildProviders\Nancy.ViewEngines.Razor.BuildProviders.dll" "$(ProjectDir)bin"
xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.12.1\lib\Net40\Nancy.ViewEngines.Razor.dll" "$(ProjectDir)bin"
)
</PostBuildEvent>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions Apphbify/OAuthModule.cs
Expand Up @@ -17,20 +17,20 @@ public OAuthModule(IOAuth api)
Get["/callback"] = Callback;
}

private Response SignIn(dynamic parameters)
private dynamic SignIn(dynamic parameters)
{
string redirect = Request.Query.redirect.HasValue ? Request.Query.redirect : "";
Session[SessionKeys.SIGN_IN_REDIRECT] = redirect;
return View["SignIn", new SignInViewModel(_OAuth, Request.Session)];
}

private Response SignOut(dynamic parameters)
private dynamic SignOut(dynamic parameters)
{
Request.Session.DeleteAll();
return Response.AsRedirect("/").WithSuccessFlash(Session, "Signed out!");
}

private Response Callback(dynamic parameters)
private dynamic Callback(dynamic parameters)
{
string access_token = "";
if (Request.Query.code.HasValue) access_token = _OAuth.GetAccessToken(Request.Query.code);
Expand Down
8 changes: 4 additions & 4 deletions Apphbify/PagesModule.Secure.cs
Expand Up @@ -27,12 +27,12 @@ public SecuredPagesModule(DataStore data, IApiService api, IDeploymentService de
Post["/Deploy/{key}"] = DoDeploy;
}

private Response Sites(dynamic parameters)
private dynamic Sites(dynamic parameters)
{
return View["Sites", new SitesViewModel(_Api, Request.Session)];
}

private Response EnableEmailNotification(dynamic parameters)
private dynamic EnableEmailNotification(dynamic parameters)
{
if (!Request.Form.email.HasValue)
return Response.AsJson(JsonResult.Error("Please provide an email address."), HttpStatusCode.BadRequest);
Expand All @@ -47,15 +47,15 @@ private Response EnableEmailNotification(dynamic parameters)
return Response.AsJson(JsonResult.OK());
}

private Response Deploy(dynamic parameters)
private dynamic Deploy(dynamic parameters)
{
var app = _Data.GetAppByKey((string)parameters.key);
if (app == null) return Response.AsRedirect("/Apps").WithErrorFlash(Session, String.Format("App {0} not found.", (string)parameters.key));

return View["Deploy", new DeployViewModel(app, _Data, Request.Session)];
}

private Response DoDeploy(dynamic parameters)
private dynamic DoDeploy(dynamic parameters)
{
var app = _Data.GetAppByKey((string)parameters.key);
if (app == null) return Response.AsRedirect("/Apps").WithErrorFlash(Session, String.Format("App {0} not found.", (string)parameters.key));
Expand Down
6 changes: 3 additions & 3 deletions Apphbify/PagesModule.cs
Expand Up @@ -16,17 +16,17 @@ public PagesModule(DataStore store)
Get["/About"] = About;
}

private Response Home(dynamic parameters)
private dynamic Home(dynamic parameters)
{
return View["Home", new BaseViewModel("Home", Request.Session)];
}

private Response Apps(dynamic parameters)
private dynamic Apps(dynamic parameters)
{
return View["Apps", new AppsViewModel(_Store, Request.Session)];
}

private Response About(dynamic parameters)
private dynamic About(dynamic parameters)
{
return View["About", new BaseViewModel("About", Request.Session)];
}
Expand Down
8 changes: 1 addition & 7 deletions Apphbify/Resources/StaticResources.cs
Expand Up @@ -29,14 +29,8 @@ private static byte[] ReadFile(string name)
}
}

public class StaticResourceStartup : IStartup
public class StaticResourceStartup : IApplicationStartup
{
public IEnumerable<CollectionTypeRegistration> CollectionTypeRegistrations { get { return null; } }

public IEnumerable<InstanceRegistration> InstanceRegistrations { get { return null; } }

public IEnumerable<TypeRegistration> TypeRegistrations { get { return null; } }

public void Initialize(IPipelines pipelines)
{
RegisterFile("/robots.txt", StaticResources.Robots, pipelines);
Expand Down
19 changes: 10 additions & 9 deletions Apphbify/Web.config
Expand Up @@ -11,29 +11,30 @@
<add key="OAUTH_KEY" value="" />
<add key="GA_KEY" value="" />
<add key="WSS" value="" />
<add key="webPages:Enabled" value="false" />
<add key="CRYPTO_PASSPHRASE" value="testing passphrase that is replaced on production" />
<add key="CRYPTO_SALT" value="41DB82B0-070A-449D-BBDE-0FA7791E907F" />
<add key="webPages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</httpHandlers>
<compilation debug="true" targetFramework="4.0">
<buildProviders>
<add extension=".cshtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyCSharpRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
<add extension=".vbhtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyVisualBasicRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
</buildProviders>
</compilation>
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</httpHandlers>
</system.web>
<razor disableAutoIncludeModelNamespace="false">
<assemblies>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</razor>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</handlers>
</system.webServer>
<razor disableAutoIncludeModelNamespace="false">
<assemblies>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</razor>
</configuration>
6 changes: 3 additions & 3 deletions Apphbify/packages.config
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AppHarbor.NET" version="2.0.0" />
<package id="Nancy" version="0.11.0" />
<package id="Nancy.Hosting.Aspnet" version="0.11.0" />
<package id="Nancy.Viewengines.Razor" version="0.11.0" />
<package id="Nancy" version="0.12.1" targetFramework="net40" />
<package id="Nancy.Hosting.Aspnet" version="0.12.1" targetFramework="net40" />
<package id="Nancy.Viewengines.Razor" version="0.12.1" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.7" />
<package id="RestSharp" version="103.1" />
</packages>

0 comments on commit 156e2de

Please sign in to comment.