Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net48</TargetFramework>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<IsPackable>False</IsPackable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Components.Pagination, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
Expand All @@ -26,10 +28,10 @@
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit.Console" Version="3.15.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="RhinoMocks" Version="3.6.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit.Console" Version="3.16.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="RhinoMocks" Version="3.6.1" />
</ItemGroup>
<ItemGroup>
<None Include="MonoRail.Tests.Views\Stub\Helper.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="RhinoMocks" Version="3.6.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="RhinoMocks" Version="3.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Castle.Monorail.Pdf\Castle.MonoRail.Pdf.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/Spark.Python.Tests/Spark.Python.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark.Python\Spark.Python.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/Spark.Ruby.Tests/Spark.Ruby.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark.Ruby\Spark.Ruby.csproj" />
Expand Down
8 changes: 4 additions & 4 deletions src/Spark.Tests/Spark.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Shouldly" Version="4.1.0" />
<PackageReference Include="RhinoMocks" Version="3.6.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="RhinoMocks" Version="3.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark\Spark.csproj" />
Expand Down
8 changes: 5 additions & 3 deletions src/Spark.Web.Mvc.Pdf.Tests/Spark.Web.Mvc.Pdf.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<TargetFramework>net48</TargetFramework>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<IsPackable>False</IsPackable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.3.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="RhinoMocks" Version="3.6.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="RhinoMocks" Version="3.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark.Web.Mvc.Pdf\Spark.Web.Mvc.Pdf.csproj" />
Expand Down
6 changes: 4 additions & 2 deletions src/Spark.Web.Mvc.Ruby.Tests/Spark.Web.Mvc.Ruby.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net48</TargetFramework>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<IsPackable>False</IsPackable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<Reference Include="IronRuby.Libraries, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand All @@ -13,8 +15,8 @@
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<ProjectReference Include="..\Spark.Web.Mvc.Ruby\Spark.Web.Mvc.Ruby.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/Spark.Web.Mvc.Tests/Spark.Web.Mvc.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
<TargetFramework>net48</TargetFramework>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<IsPackable>False</IsPackable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.3.0" />
<PackageReference Include="RhinoMocks" Version="3.6.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="RhinoMocks" Version="3.6.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark.Web.Mvc\Spark.Web.Mvc.csproj" />
Expand Down
11 changes: 7 additions & 4 deletions src/Spark.Web.Tests/Spark.Web.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RootNamespace>Spark</RootNamespace>
<IsPackable>False</IsPackable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<Compile Remove="SparkControllerFactoryTester.cs" />
Expand All @@ -14,10 +16,11 @@
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Shouldly" Version="4.1.0" />
<PackageReference Include="RhinoMocks" Version="3.6.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="RhinoMocks" Version="3.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark.Web\Spark.Web.csproj" />
Expand Down
3 changes: 2 additions & 1 deletion src/Spark/Spark.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net48;net8.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<SignAssembly>False</SignAssembly>
<AssemblyOriginatorKeyFile>..\SparkKey.snk</AssemblyOriginatorKeyFile>
Expand Down
45 changes: 42 additions & 3 deletions src/Spark/SparkSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,22 @@ namespace Spark
{
public class SparkSettings : ISparkSettings
{
public SparkSettings()
/// <summary>
/// Default constructor.
/// </summary>
public SparkSettings() : this(null)
{
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
}

/// <summary>
/// Constructor that lets you specify the <see cref="rootPath"/>.
/// </summary>
/// <param name="rootPath">The path of the web app folder (the one containing the Views folder)</param>
public SparkSettings(string rootPath)
{
RootPath = rootPath;

_useNamespaces = new List<string>();
_useAssemblies = new List<string>();
_resourceMappings = new List<IResourceMapping>();
Expand All @@ -34,9 +48,9 @@ public SparkSettings()
}

/// <summary>
/// Depending on the target framework this value must be determined (E.g. AppDomain.CurrentDomain.SetupInformation.ApplicationBase in .net framework) or set.
/// The path of the web app folder (the one containing the Views folder).
/// </summary>
public string RootPath => AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
public string RootPath { get; set; }

public bool Debug { get; set; }
public NullBehaviour NullBehaviour { get; set; }
Expand Down Expand Up @@ -64,24 +78,28 @@ public SparkSettings()
public SparkSettings SetDebug(bool debug)
{
Debug = debug;

return this;
}

public SparkSettings SetAutomaticEncoding(bool automaticEncoding)
{
AutomaticEncoding = automaticEncoding;

return this;
}

public SparkSettings SetStatementMarker(string statementMarker)
{
StatementMarker = statementMarker;

return this;
}

public SparkSettings SetNullBehaviour(NullBehaviour nullBehaviour)
{
NullBehaviour = nullBehaviour;

return this;
}

Expand All @@ -93,18 +111,31 @@ public SparkSettings SetNullBehaviour(NullBehaviour nullBehaviour)
public SparkSettings SetPageBaseType(string typeName)
{
PageBaseType = typeName;

return this;
}

/// <summary>
/// Sets the type each spark page should inherit from.
/// </summary>
/// <param name="type">The type.</param>
/// <returns></returns>
public SparkSettings SetPageBaseType(Type type)
{
PageBaseType = type.FullName;

return this;
}

/// <summary>
/// Specifies the <see cref="LanguageType"/> the spark view should be compiled to.
/// </summary>
/// <param name="language"></param>
/// <returns></returns>
public SparkSettings SetDefaultLanguage(LanguageType language)
{
DefaultLanguage = language;

return this;
}

Expand All @@ -116,36 +147,42 @@ public SparkSettings SetDefaultLanguage(LanguageType language)
public SparkSettings AddAssembly(string assembly)
{
_useAssemblies.Add(assembly);

return this;
}

public SparkSettings AddAssembly(Assembly assembly)
{
_useAssemblies.Add(assembly.FullName);

return this;
}

public SparkSettings AddNamespace(string ns)
{
_useNamespaces.Add(ns);

return this;
}

public SparkSettings SetPrefix(string prefix)
{
Prefix = prefix;

return this;
}

public SparkSettings SetParseSectionTagAsSegment(bool parseSectionTagAsSegment)
{
ParseSectionTagAsSegment = parseSectionTagAsSegment;

return this;
}

public SparkSettings SetAttributeBehaviour(AttributeBehaviour attributeBehaviour)
{
AttributeBehaviour = attributeBehaviour;

return this;
}

Expand All @@ -157,6 +194,7 @@ public SparkSettings AddResourceMapping(string match, string replace)
public SparkSettings AddResourceMapping(string match, string replace, bool stopProcess)
{
_resourceMappings.Add(new SimpleResourceMapping { Match = match, Location = replace, Stop = stopProcess });

return this;
}

Expand All @@ -168,6 +206,7 @@ public SparkSettings AddViewFolder(Type customType, IDictionary<string, string>
Type = customType.AssemblyQualifiedName,
Parameters = parameters
});

return this;
}
}
Expand Down