Skip to content

Commit

Permalink
adds castle windsor package
Browse files Browse the repository at this point in the history
  • Loading branch information
Philo committed Aug 15, 2016
1 parent 143287f commit c3f416f
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Sitemapify.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitemapify.Umbraco", "src\S
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SitemapifyUmbracoSample", "sample\SitemapifyUmbracoSample\SitemapifyUmbracoSample.csproj", "{B9A91429-FB57-4568-8D88-804A9E00BAEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitemapify.CastleWindsor", "src\Sitemapify.CastleWindsor\Sitemapify.CastleWindsor.csproj", "{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -45,6 +47,10 @@ Global
{B9A91429-FB57-4568-8D88-804A9E00BAEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9A91429-FB57-4568-8D88-804A9E00BAEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9A91429-FB57-4568-8D88-804A9E00BAEA}.Release|Any CPU.Build.0 = Release|Any CPU
{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -55,5 +61,6 @@ Global
{4E4129F4-0FEB-4A66-8DEC-3E80D5764F80} = {F9DFA62C-7451-4648-BF0D-23C8E821D9E2}
{1BC1FBB9-9E9E-417B-8BDC-A519FE7D4296} = {84B1F178-A2EC-4349-A23F-85BE79C8BFF7}
{B9A91429-FB57-4568-8D88-804A9E00BAEA} = {F9DFA62C-7451-4648-BF0D-23C8E821D9E2}
{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4} = {84B1F178-A2EC-4349-A23F-85BE79C8BFF7}
EndGlobalSection
EndGlobal
26 changes: 23 additions & 3 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ Task("Copy-Files")

EnsureDirectoryExists(buildOutput +"/Sitemapify.Umbraco");
EnsureDirectoryExists(buildOutput +"/Sitemapify.Umbraco/lib/net45");
CopyFile("./src/Sitemapify.Umbraco/bin/" +configuration +"/Sitemapify.Umbraco.dll", buildOutput +"/Sitemapify.Umbraco/lib/net45/Sitemapify.dll");
CopyFile("./src/Sitemapify.Umbraco/bin/" +configuration +"/Sitemapify.Umbraco.pdb", buildOutput +"/Sitemapify.Umbraco/lib/net45//Sitemapify.pdb");
CopyFile("./src/Sitemapify.Umbraco/bin/" +configuration +"/Sitemapify.Umbraco.dll", buildOutput +"/Sitemapify.Umbraco/lib/net45/Sitemapify.Umbraco.dll");
CopyFile("./src/Sitemapify.Umbraco/bin/" +configuration +"/Sitemapify.Umbraco.pdb", buildOutput +"/Sitemapify.Umbraco/lib/net45//Sitemapify.Umbraco.pdb");

EnsureDirectoryExists(buildOutput +"/Sitemapify.CastleWindsor");
EnsureDirectoryExists(buildOutput +"/Sitemapify.CastleWindsor/lib/net45");
CopyFile("./src/Sitemapify.CastleWindsor/bin/" +configuration +"/Sitemapify.CastleWindsor.dll", buildOutput +"/Sitemapify.CastleWindsor/lib/net45/Sitemapify.CastleWindsor.dll");
CopyFile("./src/Sitemapify.CastleWindsor/bin/" +configuration +"/Sitemapify.CastleWindsor.pdb", buildOutput +"/Sitemapify.CastleWindsor/lib/net45//Sitemapify.CastleWindsor.pdb");
});

Task("Create-NuGet-Package")
.IsDependentOn("Build")
.IsDependentOn("Copy-Files")
.WithCriteria(() => FileExists("./nuspec/Sitemapify.nuspec"))
.Does(() =>
{
EnsureDirectoryExists(artifacts +"/packages/");
Expand Down Expand Up @@ -153,6 +157,22 @@ Task("Create-NuGet-Package")
new NuSpecDependency { Id = "Sitemapify", Version = "[" +versionInfo.NuGetVersionV2 +"]"}
}
});

NuGetPack("./nuspec/Sitemapify.CastleWindsor.nuspec", new NuGetPackSettings {
BasePath = buildOutput +"/Sitemapify.CastleWindsor",
Properties = new Dictionary<string, string> { { "Configuration", configuration }},
Symbols = false,
NoPackageAnalysis = true,
Version = versionInfo.NuGetVersionV2,
OutputDirectory = artifacts +"/packages/",
Files = new[] {
new NuSpecContent { Source = "**/*", Target = "" },
},
Dependencies = new[] {
new NuSpecDependency { Id = "Castle.Windsor", Version = "[3.1,4]" },
new NuSpecDependency { Id = "Sitemapify", Version = "[" +versionInfo.NuGetVersionV2 +"]"}
}
});
});

Task("Update-AppVeyor-Build-Number")
Expand Down
21 changes: 21 additions & 0 deletions nuspec/Sitemapify.CastleWindsor.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Sitemapify.CastleWindsor</id>
<title>Sitemapify Castle Windsor Adapter</title>
<description>Provides a castle windsor adapter for the sitemapify ASP.NET sitemap handler</description>
<authors>Phil Oyston</authors>
<owners>Phil Oyston</owners>
<licenseUrl>https://raw.githubusercontent.com/stormid/sitemapify/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/stormid/sitemapify</projectUrl>
<iconUrl>https://raw.githubusercontent.com/stormid/sitemapify/master/docs/img/sitemap.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<tags>sitemap seo webforms mvc castle windsor</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Web" targetFramework="net40" />
</frameworkAssemblies>
</metadata>
<files>
<file src="**/*" target="" />
</files>
</package>
3 changes: 2 additions & 1 deletion nuspec/Sitemapify.Umbraco.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
<projectUrl>https://github.com/stormid/sitemapify</projectUrl>
<iconUrl>https://raw.githubusercontent.com/stormid/sitemapify/master/docs/img/sitemap.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<tags>sitemap seo webforms mvc</tags>
<tags>sitemap seo webforms mvc umbraco</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Web" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Configuration" targetFramework="net40" />
</frameworkAssemblies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Castle.Core.Configuration;
using Castle.MicroKernel;
using Sitemapify.Config;

namespace Sitemapify.CastleWindsor
{
public class CastleWindsorSitemapifyContainerAdapter : ISitemapContainerAdapter
{
private readonly IKernel _kernel;
public CastleWindsorSitemapifyContainerAdapter(IKernel kernel)
{
_kernel = kernel;
}

public T Resolve<T>() where T : class
{
if (_kernel.HasComponent(typeof (T))) return _kernel.Resolve<T>();
return null;
}
}
}
6 changes: 6 additions & 0 deletions src/Sitemapify.CastleWindsor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System.Reflection;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sitemapify.CastleWindsor")]
75 changes: 75 additions & 0 deletions src/Sitemapify.CastleWindsor/Sitemapify.CastleWindsor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D8A6AE48-A51D-4CF4-BCD1-47036A7443D4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sitemapify.CastleWindsor</RootNamespace>
<AssemblyName>Sitemapify.CastleWindsor</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\VersionAssemblyInfo.cs">
<Link>Properties\VersionAssemblyInfo.cs</Link>
</Compile>
<Compile Include="CastleWindsorSitemapifyContainerAdapter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SitemapifyWindsorInstaller.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sitemapify\Sitemapify.csproj">
<Project>{16ed145c-cd29-4063-95c0-bd7c46d86d18}</Project>
<Name>Sitemapify</Name>
</ProjectReference>
</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
24 changes: 24 additions & 0 deletions src/Sitemapify.CastleWindsor/SitemapifyWindsorInstaller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Sitemapify.Builders;
using Sitemapify.Builders.Impl;
using Sitemapify.Providers;
using Sitemapify.Providers.Impl;

namespace Sitemapify.CastleWindsor
{
public class SitemapifyWindsorInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<ISitemapContentProvider>().ImplementedBy<EmptySitemapContentProvider>().IsFallback().LifestylePerWebRequest(),
Component.For<ISitemapCacheProvider>().ImplementedBy<DefaultSitemapCacheProvider>().IsFallback().LifestylePerWebRequest(),
Component.For<ISitemapDocumentBuilder>().ImplementedBy<DefaultSitemapDocumentBuilder>().IsFallback().LifestylePerWebRequest()
);

Configure.With(new CastleWindsorSitemapifyContainerAdapter(container.Kernel));
}
}
}
5 changes: 5 additions & 0 deletions src/Sitemapify.CastleWindsor/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.0" targetFramework="net45" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net45" />
</packages>

0 comments on commit c3f416f

Please sign in to comment.