Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

N2 upgrade #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@ pip-log.txt

# Mac crap
.DS_Store
/src/HereSay.Website/App_Data/Temp
/src/HereSay.Website/App_Data
Binary file removed lib/N2/Antlr3.Runtime.dll
Binary file not shown.
Binary file removed lib/N2/Castle.Components.Binder.dll
Binary file not shown.
Binary file removed lib/N2/Castle.Components.Validator.dll
Binary file not shown.
Binary file removed lib/N2/Castle.Core.dll
Binary file not shown.
Binary file removed lib/N2/Castle.Services.Transaction.dll
Binary file not shown.
Binary file removed lib/N2/Castle.Windsor.dll
Binary file not shown.
Binary file removed lib/N2/EcmaScript.NET.modified.dll
Binary file not shown.
Binary file removed lib/N2/Iesi.Collections.dll
Binary file not shown.
Binary file removed lib/N2/Ionic.Zip.dll
Binary file not shown.
Binary file removed lib/N2/Lucene.Net.dll
Binary file not shown.
Binary file removed lib/N2/N2.Extensions.dll
Binary file not shown.
Binary file removed lib/N2/N2.Management.dll
Binary file not shown.
Binary file removed lib/N2/N2.Packaging.dll
Binary file not shown.
Binary file removed lib/N2/N2.Security.dll
Binary file not shown.
Binary file removed lib/N2/N2.dll
Binary file not shown.
11,719 changes: 0 additions & 11,719 deletions lib/N2/N2.xml

This file was deleted.

Binary file removed lib/N2/NHibernate.ByteCode.Castle.dll
Binary file not shown.
Binary file removed lib/N2/NHibernate.Caches.SysCache2.dll
Binary file not shown.
Binary file removed lib/N2/NHibernate.dll
Binary file not shown.
Binary file removed lib/N2/Remotion.Data.Linq.dll
Binary file not shown.
Binary file removed lib/N2/log4net.dll
Binary file not shown.
Binary file modified src/HereSay.Plugins/.nuget/NuGet.exe
Binary file not shown.
53 changes: 23 additions & 30 deletions src/HereSay.Plugins/.nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>
Expand All @@ -28,19 +29,17 @@
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
<PackagesDir>$(SolutionDir)packages</PackagesDir>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
Expand All @@ -49,11 +48,16 @@
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>

<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- Make the build depend on restore packages -->
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
Expand All @@ -69,8 +73,16 @@
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>

<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
Expand Down Expand Up @@ -109,7 +121,7 @@

Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);

return true;
}
Expand All @@ -121,23 +133,4 @@
</Code>
</Task>
</UsingTask>

<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<EnvKey ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
}
catch {
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
31 changes: 20 additions & 11 deletions src/HereSay.Plugins/HereSay.Plugins.Caching/CachingDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,47 @@
using HereSay.Definitions;
using N2.Web;
using HereSay;
using N2.Engine;

namespace HereSay.Plugins.Caching
{
/// <summary>
/// Decorates pages within HereSay with properties to manage caching.
/// </summary>
[AutoInitialize]
[Service, AutoInitialize]
public class CachingDecorator : AutoStarter
{
private readonly IDefinitionManager definitions;

public CachingDecorator() { }
public CachingDecorator(IDefinitionManager definitions)
{
this.definitions = definitions;
}

/// <summary>
/// Modifies the given response's <see cref="System.Web.HttpResponse.Cache"/> to use the
/// desired cache settings.
/// </summary>
private static void ApplicationInstance_AcquireRequestState(object sender, EventArgs e)
{
N2.ContentItem page = Find.CurrentPage;

if (page == null)
return;

//
// Set cacheability

int cacheability = (int)(page.GetDetail<Cacheability>(CacheabilityName, Cacheability.Default));
cacheability = (cacheability == (int)Cacheability.Default)
? (int)HttpCacheability.Private

cacheability = (cacheability == (int)Cacheability.Default)
? (int)HttpCacheability.Private
: cacheability;

HttpCacheability httpCacheability = (HttpCacheability)cacheability;
HttpResponse response = ((HttpApplication)sender).Response;

response.Cache.SetCacheability(httpCacheability);

//
Expand All @@ -57,9 +66,9 @@ private static void ApplicationInstance_AcquireRequestState(object sender, Event
}

#region Constants
public const string
public const string
CacheabilityHelpTitle = "Cacheability Values",
CacheabilityHelpText =
CacheabilityHelpText =
"<ul><li><strong>NoCache</strong> sets the Cache-Control: no-cache header.<br/>"
+ "<li><strong>Private</strong> (default) sets Cache-Control: private to specify that the response is cacheable only on the client and not by shared (proxy server) caches.</li>"
+ "<li><strong>ServerAndNoCache</strong> Applies the settings of both Server and NoCache to indicate that the content is cached at the server but all others are explicitly denied the ability to cache the response.</li>"
Expand All @@ -70,7 +79,7 @@ public const string

public const string
CacheDurationTitle = "Cache Duration (minutes)",
CacheDurationHelpText =
CacheDurationHelpText =
"Specifies the number of minutes content is cached. A negative value will cause the server default to be used. "
+ "1 hour = 60, 1 day = 1440, 1 week = 10080, 30 days = 43200, 1 month = 43829 (average), 1 year = 525948.",
CacheDurationHelpTitle = "Cache Duration",
Expand All @@ -85,8 +94,8 @@ public const string
/// </summary>
public override void Start()
{
// foreach (ItemDefinition definition in this.Definitions)
Parallel.ForEach<ItemDefinition>(this.Definitions, definition =>
// foreach (ItemDefinition definition in definitions.GetDefinitions())
Parallel.ForEach<ItemDefinition>(this.definitions.GetDefinitions(), definition =>
{
Type itemType = definition.ItemType;
if (IsPage(itemType))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HereSay.Plugins.Caching</RootNamespace>
<AssemblyName>HereSay.Plugins.Caching</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -23,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -31,10 +33,38 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="N2">
<HintPath>..\..\..\lib\N2\N2.dll</HintPath>
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="N2, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\N2CMS.Library.2.6.3.1\lib\net45\N2.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.3.3.3.4001\lib\Net35\NHibernate.dll</HintPath>
</Reference>
<Reference Include="Rolcore">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Data">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Data.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Net">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Net.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Repository">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Repository.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Web">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Web.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Xml.Linq">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Xml.Linq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -57,12 +87,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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.
<Target Name="BeforeBuild">
Expand Down
5 changes: 4 additions & 1 deletion src/HereSay.Plugins/HereSay.Plugins.Caching/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Rolcore" version="0.0.0.12" targetFramework="net40" />
<package id="Iesi.Collections" version="3.2.0.4000" targetFramework="net45" />
<package id="N2CMS.Library" version="2.6.3.1" targetFramework="net45" />
<package id="NHibernate" version="3.3.3.4001" targetFramework="net45" />
<package id="Rolcore" version="0.0.4988.19960" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HereSay.Plugins.Forms</RootNamespace>
<AssemblyName>HereSay.Plugins.Forms</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -23,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -31,25 +33,38 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="N2">
<HintPath>..\..\..\lib\N2\N2.dll</HintPath>
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="N2, Version=2.6.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\N2CMS.Library.2.6.3.1\lib\net45\N2.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.3.3.3.4001\lib\Net35\NHibernate.dll</HintPath>
</Reference>
<Reference Include="Rolcore">
<HintPath>..\packages\Rolcore.0.0.0.12\lib\net40\Rolcore.dll</HintPath>
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Data">
<HintPath>..\packages\Rolcore.0.0.0.12\lib\net40\Rolcore.Data.dll</HintPath>
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Data.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Net">
<HintPath>..\packages\Rolcore.0.0.0.12\lib\net40\Rolcore.Net.dll</HintPath>
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Net.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Repository">
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Repository.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Web">
<HintPath>..\packages\Rolcore.0.0.0.12\lib\net40\Rolcore.Web.dll</HintPath>
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Web.dll</HintPath>
</Reference>
<Reference Include="Rolcore.Xml.Linq">
<HintPath>..\packages\Rolcore.0.0.0.12\lib\net40\Rolcore.Xml.Linq.dll</HintPath>
<HintPath>..\packages\Rolcore.0.0.4988.19960\lib\net45\Rolcore.Xml.Linq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -87,7 +102,7 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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.
<Target Name="BeforeBuild">
Expand Down
5 changes: 4 additions & 1 deletion src/HereSay.Plugins/HereSay.Plugins.Forms/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Rolcore" version="0.0.0.12" targetFramework="net40" />
<package id="Iesi.Collections" version="3.2.0.4000" targetFramework="net45" />
<package id="N2CMS.Library" version="2.6.3.1" targetFramework="net45" />
<package id="NHibernate" version="3.3.3.4001" targetFramework="net45" />
<package id="Rolcore" version="0.0.4988.19960" targetFramework="net45" />
</packages>
22 changes: 0 additions & 22 deletions src/HereSay.Website/App_Data/n2_host.config

This file was deleted.

Loading