Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Add Scriptcs plugins support #229

Merged
merged 35 commits into from
May 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a9fe120
Update to .NET 4.5
Mar 28, 2015
440a16a
Add ScriptCsCatalog usage
Mar 29, 2015
5e4e5c0
Revert "Add ScriptCsCatalog usage"
Mar 30, 2015
ca97bc7
Quick'n dirty test of not depending directly of ScriptCs
Mar 30, 2015
6466ef3
Clean up
Apr 1, 2015
7b33564
Avoid unnecessary recomposition
Apr 13, 2015
f4e96a8
Add install and uninstall scripts
Apr 14, 2015
0105566
Little cleanup
Apr 14, 2015
1df2500
Add uninstall scripts in chocolatey packages
Apr 15, 2015
e5ae4bd
Fix bug when pretzel is used from path
Apr 16, 2015
372f012
Remove unnecessary chocolatey uninstall script
Apr 16, 2015
6c3dd1c
Revert "Remove unnecessary chocolatey uninstall script"
Apr 17, 2015
ef466f2
Fix Pretzel installation folder
Apr 17, 2015
aa458d4
Fix chocolatey install / uninstall scripts
Apr 20, 2015
b7e21f8
Update to .NET 4.5
Mar 28, 2015
1e33a49
Add ScriptCsCatalog usage
Mar 29, 2015
e7bf753
Revert "Add ScriptCsCatalog usage"
Mar 30, 2015
d46cb3b
Quick'n dirty test of not depending directly of ScriptCs
Mar 30, 2015
74c8e0b
Clean up
Apr 1, 2015
94bb673
Avoid unnecessary recomposition
Apr 13, 2015
dc6d54b
Add install and uninstall scripts
Apr 14, 2015
87b9aec
Little cleanup
Apr 14, 2015
d9eb846
Add uninstall scripts in chocolatey packages
Apr 15, 2015
d9bbd69
Fix bug when pretzel is used from path
Apr 16, 2015
c2c7cc6
Remove unnecessary chocolatey uninstall script
Apr 16, 2015
fff9c4e
Revert "Remove unnecessary chocolatey uninstall script"
Apr 17, 2015
029e229
Fix Pretzel installation folder
Apr 17, 2015
4979ef4
Fix chocolatey install / uninstall scripts
Apr 20, 2015
1fb8371
Remove unnecessary chocolatey uninstall script
Apr 16, 2015
cb7d222
Revert "Remove unnecessary chocolatey uninstall script"
Apr 17, 2015
c0f9c6f
Merge with master
Apr 23, 2015
65773cb
Remove MarkdownDeep Nuget reference
Apr 23, 2015
8e8d275
Fix some tests
Apr 23, 2015
92dec15
Merge branch 'scriptcs-plugin' of https://github.com/Code52/pretzel i…
Apr 23, 2015
976c6b1
Merge remote-tracking branch 'origin/master' into scriptcs-plugin
Apr 23, 2015
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
32 changes: 23 additions & 9 deletions AppVeyor-Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,33 @@ If ($env:appveyor_repo_tag -eq $True)
Set-AppveyorBuildVariable 'releaseDescription' $description
}

# build nupkg

mkdir artifacts
mkdir chocoTemp\tools

move tools\chocolatey\pretzel.nuspec chocoTemp\pretzel.nuspec
move tools\chocolatey\chocolateyInstall.ps1 chocoTemp\tools\chocolateyInstall.ps1
# build Pretzel nupkg
mkdir chocoTemp\Pretzel\tools

(gc chocoTemp\tools\chocolateyInstall.ps1).replace('{{version}}',$version).replace('{{tag}}',$tag)|sc chocoTemp\tools\chocolateyInstall.ps1
move tools\chocolatey\Pretzel\pretzel.nuspec chocoTemp\Pretzel\pretzel.nuspec
move tools\chocolatey\Pretzel\chocolateyInstall.ps1 chocoTemp\Pretzel\tools\chocolateyInstall.ps1
move tools\chocolatey\Pretzel\chocolateyUninstall.ps1 chocoTemp\Pretzel\tools\chocolateyUninstall.ps1

nuget pack chocoTemp\pretzel.nuspec -OutputDirectory artifacts -Version $version -NoPackageAnalysis
(gc chocoTemp\Pretzel\tools\chocolateyInstall.ps1).replace('{{version}}',$version).replace('{{tag}}',$tag)|sc chocoTemp\Pretzel\tools\chocolateyInstall.ps1

# create zip
nuget pack chocoTemp\Pretzel\pretzel.nuspec -OutputDirectory artifacts -Version $version -NoPackageAnalysis

# create Pretzel zip
7z a Pretzel.$version.zip $env:appveyor_build_folder\src\Pretzel\bin\Release\Pretzel.exe*
7z a Pretzel.$version.zip ReleaseNotes.md
7z a Pretzel.$version.zip ReleaseNotes.md

# build Pretzel.ScriptCs nupkg
mkdir chocoTemp\Pretzel.ScriptCs\tools
move tools\chocolatey\Pretzel.ScriptCs\pretzel.scriptcs.nuspec chocoTemp\Pretzel.ScriptCs\pretzel.scriptcs.nuspec
move tools\chocolatey\Pretzel.ScriptCs\chocolateyInstall.ps1 chocoTemp\Pretzel.ScriptCs\tools\chocolateyInstall.ps1
move tools\chocolatey\Pretzel.ScriptCs\chocolateyUninstall.ps1 chocoTemp\Pretzel.ScriptCs\tools\chocolateyUninstall.ps1
(gc chocoTemp\Pretzel.ScriptCs\tools\chocolateyInstall.ps1).replace('{{version}}',$version).replace('{{tag}}',$tag)|sc chocoTemp\Pretzel.ScriptCs\tools\chocolateyInstall.ps1
nuget pack chocoTemp\Pretzel.ScriptCs\pretzel.scriptcs.nuspec -OutputDirectory artifacts -Version $version -NoPackageAnalysis

# create Pretzel.ScriptCs zip
get-childitem src\Pretzel.ScriptCs\bin\Release -filter *.dll | % { $_.Name } | out-file artifacts\Pretzel.ScriptCs.Files.txt

7z a Pretzel.ScriptCs.$version.zip $env:appveyor_build_folder\src\Pretzel.ScriptCs\bin\Release\*.dll
7z a Pretzel.ScriptCs.$version.zip $env:appveyor_build_folder\artifacts\Pretzel.ScriptCs.Files.txt
10 changes: 8 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,22 @@ artifacts:
- path: artifacts\Pretzel.*.nupkg
name: Pretzel.nupkg

- path: artifacts\Pretzel.ScriptCs.*.nupkg
name: Pretzel.ScriptCs.nupkg

- path: coverage.xml

- path: Pretzel.*.zip
name: Pretzel.zip

- path: Pretzel.ScriptCs.*.zip
name: Pretzel.ScriptCs.zip

deploy:
- provider: GitHub
auth_token:
secure: piWk1xd/YxJK+HJOFwJyBORP+Go1p4XO6148zeePdyVEGPxk4wGXk5tP2jYkM4eU
artifact: Pretzel.zip
artifact: Pretzel.zip, Pretzel.ScriptCs.zip
description: $(releaseDescription)
on:
appveyor_repo_tag: true
Expand All @@ -52,6 +58,6 @@ deploy:
api_key:
secure: 2GBJF71EQfU+kIL5NHVM4wYoCRcFf/gM/voNIgud8vDWUE+uA1ye/hRWjJPQWA5w
skip_symbols: true
artifact: Pretzel.nupkg
artifact: /.*\.nupkg/
on:
appveyor_repo_tag: true
66 changes: 66 additions & 0 deletions src/Pretzel.Logic/Commands/BaseParameters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using NDesk.Options;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO.Abstractions;
using System.Linq;

namespace Pretzel.Logic.Commands
{
public sealed class BaseParameters
{
public OptionSet Options { get; private set; }

public string CommandName { get; private set; }

public bool Help { get; private set; }

public bool Debug { get; private set; }

public bool Safe { get; private set; }

[Export("SourcePath")]
public string Path { get; private set; }

[Export]
public IFileSystem FileSystem { get; private set; }

public List<string> CommandArgs { get; private set; }

private BaseParameters(string[] arguments, IFileSystem fileSystem)
{
Options = new OptionSet
{
{"help", "Display help mode", p => Help = true},
{"debug", "Enable debugging", p => Debug = true},
{ "safe", "Disable custom plugins", v => Safe = true },
{ "d|directory=", "[Obsolete, use --source instead] The path to site directory", p => Path = p },
{ "s|source=", "The path to the source site (default current directory)", p => Path = p}
};

FileSystem = fileSystem;

CommandName = arguments.Take(1).FirstOrDefault();

CommandArgs = Options.Parse(arguments.Skip(1));

SetPath(CommandArgs.FirstOrDefault());
}

public static BaseParameters Parse(string[] arguments, IFileSystem fileSystem)
{
return new BaseParameters(arguments, fileSystem);
}

private void SetPath(string firstArgument)
{
// take the first argument after the command
if (firstArgument != null && !firstArgument.StartsWith("-") && !firstArgument.StartsWith("/"))
{
Path = FileSystem.Path.IsPathRooted(firstArgument)
? firstArgument
: FileSystem.Path.Combine(FileSystem.Directory.GetCurrentDirectory(), firstArgument);
}
Path = string.IsNullOrWhiteSpace(Path) ? FileSystem.Directory.GetCurrentDirectory() : FileSystem.Path.GetFullPath(Path);
}
}
}
21 changes: 3 additions & 18 deletions src/Pretzel.Logic/Commands/CommandParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ public CommandParameters([ImportMany] IEnumerable<IHaveCommandLineArgs> commandL
Settings = new OptionSet
{
{ "t|template=", "The templating engine to use", v => Template = v },
{ "d|directory=", "[Obsolete, use --source instead] The path to site directory", p => Path = p },
{ "p|port=", "The port to test the site locally", p => decimal.TryParse(p, out port) },
{ "i|import=", "The import type", v => ImportType = v },
{ "f|file=", "Path to import file", v => ImportPath = v },
{ "s|source=", "The path to the source site (default current directory)", p => Path = p},
{ "destination=", "The path to the destination site (default _site)", d => DestinationPath = d},
{ "drafts", "Add the posts in the drafts folder", v => IncludeDrafts = true },
{ "nobrowser", "Do not launch a browser", v => LaunchBrowser = false },
{ "withproject", "Includes a layout VS Solution, to give intellisense when editing razor layout files", v => WithProject = (v!=null) },
{ "wiki", "Creates a wiki instead of a blog (razor template only)", v => Wiki = (v!=null) },
{ "cleantarget", "Delete the target directory (_site by default)", v => CleanTarget = true },
{ "safe", "Disable custom plugins", v => Safe = true }
{ "cleantarget", "Delete the target directory (_site by default)", v => CleanTarget = true }
};

// Allow extensions to register command line args
Expand All @@ -48,7 +45,8 @@ public CommandParameters([ImportMany] IEnumerable<IHaveCommandLineArgs> commandL
}
}

public string Path { get; private set; }
[Import("SourcePath")]
public string Path { get; internal set; }

public string Template { get; private set; }

Expand All @@ -66,8 +64,6 @@ public CommandParameters([ImportMany] IEnumerable<IHaveCommandLineArgs> commandL

public bool LaunchBrowser { get; private set; }

public bool Safe { get; private set; }

public string DestinationPath { get; private set; }

private decimal port;
Expand All @@ -87,17 +83,6 @@ public void Parse(IEnumerable<string> arguments)

Settings.Parse(argumentList);

var firstArgument = argumentList.FirstOrDefault();

if (firstArgument != null && !firstArgument.StartsWith("-") && !firstArgument.StartsWith("/"))
{
Path = fileSystem.Path.IsPathRooted(firstArgument)
? firstArgument
: fileSystem.Path.Combine(fileSystem.Directory.GetCurrentDirectory(), firstArgument);
}

Path = string.IsNullOrWhiteSpace(Path) ? fileSystem.Directory.GetCurrentDirectory() : fileSystem.Path.GetFullPath(Path);

if (string.IsNullOrEmpty(DestinationPath))
{
DestinationPath = "_site";
Expand Down
26 changes: 16 additions & 10 deletions src/Pretzel.Logic/Pretzel.Logic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Pretzel.Logic</RootNamespace>
<AssemblyName>Pretzel.Logic</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\src\</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,6 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="AjaxMin, Version=5.14.5506.26196, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f, processorArchitecture=MSIL">
Expand All @@ -39,23 +42,25 @@
</Reference>
<Reference Include="CommonMark, Version=0.1.0.0, Culture=neutral, PublicKeyToken=001ef8810438905d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonMark.NET.0.8.5\lib\net40-client\CommonMark.dll</HintPath>
<HintPath>..\packages\CommonMark.NET.0.8.5\lib\net45\CommonMark.dll</HintPath>
</Reference>
<Reference Include="dotless.ClientOnly">
<HintPath>..\packages\DotlessClientOnly.1.4.1.0\lib\dotless.ClientOnly.dll</HintPath>
</Reference>
<Reference Include="DotLiquid">
<HintPath>..\packages\DotLiquid.1.8.0\lib\NET40\DotLiquid.dll</HintPath>
<Reference Include="DotLiquid, Version=1.8.0.0, Culture=neutral, PublicKeyToken=82e46016ecf9f07c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\DotLiquid.1.8.0\lib\NET45\DotLiquid.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\packages\HtmlAgilityPack.1.4.9\lib\Net40\HtmlAgilityPack.dll</HintPath>
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="NDesk.Options">
<HintPath>..\packages\NDesk.Options.0.2.1\lib\NDesk.Options.dll</HintPath>
</Reference>
<Reference Include="RazorEngine, Version=3.6.0.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\RazorEngine.3.6.0\lib\net40\RazorEngine.dll</HintPath>
<HintPath>..\packages\RazorEngine.3.6.0\lib\net45\RazorEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
Expand All @@ -65,9 +70,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\System.IO.Abstractions.2.0.0.104\lib\net40\System.IO.Abstractions.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand All @@ -81,6 +86,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\CommandParameters.cs" />
<Compile Include="Commands\BaseParameters.cs" />
<Compile Include="Exceptions\PageProcessingException.cs" />
<Compile Include="Extensibility\Extensions\AzureHostSupport.cs" />
<Compile Include="Extensibility\Extensions\PrettifyUrlFilter.cs" />
Expand Down
15 changes: 8 additions & 7 deletions src/Pretzel.Logic/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// 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("Pretzel.Logic")]
Expand All @@ -12,8 +13,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.

// The following GUID is for the ID of the typelib if this project is exposed to COM
Expand All @@ -22,13 +23,13 @@
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("Pretzel.Tests")]
4 changes: 2 additions & 2 deletions src/Pretzel.Logic/Templating/JekyllEngineBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public abstract class JekyllEngineBase : ISiteEngine

#pragma warning restore 0649

[ImportMany(AllowRecomposition = true)]
[ImportMany]
public IEnumerable<IFilter> Filters { get; set; }

[ImportMany(AllowRecomposition = true)]
[ImportMany]
public IEnumerable<ITag> Tags { get; set; }

public abstract void Initialize();
Expand Down
13 changes: 6 additions & 7 deletions src/Pretzel.Logic/packages.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AjaxMin" version="5.14.5506.26202" targetFramework="net40" />
<package id="CommonMark.NET" version="0.8.5" targetFramework="net40" />
<package id="CommonMark.NET" version="0.8.5" targetFramework="net45" />
<package id="DotlessClientOnly" version="1.4.1.0" targetFramework="net40" />
<package id="DotLiquid" version="1.8.0" targetFramework="net40" />
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net40" />
<package id="MarkdownDeep.NET" version="1.5" targetFramework="net40" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
<package id="DotLiquid" version="1.8.0" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net45" />
<package id="NDesk.Options" version="0.2.1" />
<package id="RazorEngine" version="3.6.0" targetFramework="net40" />
<package id="RazorEngine" version="3.6.0" targetFramework="net45" />
<package id="System.IO.Abstractions" version="2.0.0.104" targetFramework="net40" />
<package id="YamlDotNet" version="3.5.1" targetFramework="net40" />
</packages>
</packages>
Loading