Permalink
Browse files

Add ability to set repository path from command line

Add MSBuild examples
Set version number to 0.5.0.0
Update readme with more details
  • Loading branch information...
1 parent 98e40c1 commit 1f1b55c6d7d024ecdd5ec1c1292a310c0178d14c @HowardvanRooijen HowardvanRooijen committed Sep 30, 2010
Showing with 204 additions and 270 deletions.
  1. +28 −0 Artefacts/build-samples/TemplifyCreatePackage.target
  2. +27 −0 Artefacts/build-samples/TemplifyDeployPackage.target
  3. +2 −2 Artefacts/debug-settings.txt
  4. +39 −2 README
  5. +2 −0 Solutions/Endjin.Templify.Client/Core/CustomBootstrapper.cs
  6. +1 −1 Solutions/Endjin.Templify.Client/Endjin.Templify.Client.csproj
  7. +2 −2 Solutions/Endjin.Templify.Client/Properties/AssemblyInfo.cs
  8. +4 −1 Solutions/Endjin.Templify.Client/View/ManageExclusionsView.xaml
  9. +5 −0 Solutions/Endjin.Templify.Client/ViewModel/ManageExclusionsViewModel.cs
  10. +4 −2 Solutions/Endjin.Templify.CommandLine/Client.cs
  11. +1 −1 Solutions/Endjin.Templify.CommandLine/Endjin.Templify.CommandLine.csproj
  12. +3 −3 Solutions/Endjin.Templify.CommandLine/Program.cs
  13. +4 −5 Solutions/Endjin.Templify.CommandLine/Properties/AssemblyInfo.cs
  14. +2 −0 Solutions/Endjin.Templify.Domain/Contracts/Infrastructure/IConfiguration.cs
  15. +3 −3 Solutions/Endjin.Templify.Domain/Infrastructure/CommandOptions.cs
  16. +8 −0 Solutions/Endjin.Templify.Domain/Infrastructure/Configuration.cs
  17. +5 −2 Solutions/Endjin.Templify.Domain/Infrastructure/Repositories/PackageRepository.cs
  18. +2 −2 Solutions/Endjin.Templify.Domain/Properties/AssemblyInfo.cs
  19. +7 −1 Solutions/Endjin.Templify.Domain/Tasks/PackageCreatorTasks.cs
  20. +5 −0 Solutions/Endjin.Templify.Domain/Tasks/PackageDeployerTasks.cs
  21. +47 −241 Solutions/Endjin.Templify.Installer/Endjin.Templify.Installer.vdproj
  22. +2 −2 Solutions/Endjin.Templify.Specifications/Infrastructure/CommandLineProcessorSpecs.cs
  23. +1 −0 Solutions/Endjin.Templify.sln
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Templify">
+
+ <Target Name="TemplifyCreatePackage"
+ Condition=" '$(IsDesktopBuild)' == 'true' AND '$(SkipVersionNumberIncrement)' != 'true' ">
+
+ <Message Text="---------------"/>
+ <Message Text="TEMPLIFY"/>
+ <Message Text="---------------"/>
+
+ <PropertyGroup>
+ <TemplifyMode>"c"</TemplifyMode>
+ <TemplifyPath>$(BuildPath)\To-Be-Packaged</TemplifyPath>
+ <TemplifyPackageName>"Sharp Architecture"</TemplifyPackageName>
+ <TemplifyPackageAuthor>"Howard van Rooijen"</TemplifyPackageAuthor>
+ <TemplifyPackageVersion>"1.6.0.0"</TemplifyPackageVersion>
+ <TemplifyPackageTokens>"SA169=__NAME__"</TemplifyPackageTokens>
+ <TemplifyPackageRepositoryPath>$(DropsPath)</TemplifyPackageRepositoryPath>
+ <TemplifyArgs>"-m" $(TemplifyMode) "-p" $(TemplifyPath) "-n" $(TemplifyPackageName) "-a" $(TemplifyPackageAuthor) "-v" $(TemplifyPackageVersion) "-t" $(TemplifyPackageTokens) "-r" $(TemplifyPackageRepositoryPath)</TemplifyArgs>
+ </PropertyGroup>
+
+ <Exec Command="&quot;$(ToolsPath)\Templify\TemplifyCmd.exe&quot; $(TemplifyArgs)"
+ ContinueOnError="false"/>
+
+ </Target>
+
+</Project>
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Templify">
+
+ <Target Name="TemplifyDeployPackage"
+ Condition=" '$(IsDesktopBuild)' == 'true' AND '$(SkipVersionNumberIncrement)' != 'true' ">
+
+ <Message Text="---------------"/>
+ <Message Text="TEMPLIFY"/>
+ <Message Text="---------------"/>
+
+ <PropertyGroup>
+ <TemplifyMode>"d"</TemplifyMode>
+ <TemplifyPath>$(BuildPath)\To-Be-Packaged</TemplifyPath>
+ <TemplifyDeployPath>$(BuildPath)\To-Be-Deployed</TemplifyDeployPath>
+ <TemplifyPackageName>"sharp-architecture-v1.6.0.0"</TemplifyPackageName>
+ <TemplifyPackageTokens>"__NAME__=JetBrains"</TemplifyPackageTokens>
+ <TemplifyPackageRepositoryPath>$(DropsPath)</TemplifyPackageRepositoryPath>
+ <TemplifyArgs>"-m" $(TemplifyMode) "-i" $(TemplifyPackageName) "-t" $(TemplifyPackageTokens) "-r" $(TemplifyPackageRepositoryPath) "-p" $(TemplifyDeployPath)</TemplifyArgs>
+ </PropertyGroup>
+
+ <Exec Command="&quot;$(ToolsPath)\Templify\TemplifyCmd.exe&quot; $(TemplifyArgs)"
+ ContinueOnError="false"/>
+
+ </Target>
+
+</Project>
@@ -9,10 +9,10 @@ Deploy:
Command Line
Create:
--m c -p C:\Temp\Sample-Create\Sharp-Architecture -n "Sharp Architecture" -a "Howard van Rooijen" -v "1.6.0.0" -t SA169=__NAME__ -o "c:\Temp\Sample-Deploy"
+-m c -p C:\Temp\Sample-Create\Sharp-Architecture -n "Sharp Architecture" -a "Howard van Rooijen" -v "1.6.0.0" -t "SA169=__NAME__" -r "c:\Temp\Sample-Deploy"
Deploy:
--m d -p c:\Temp\Sample-Deploy -i sharp-architecture-v1.6.0.0 -t __NAME__=HvR
+-m d -p "c:\Temp\Sample-Deploy" -i sharp-architecture-v1.6.0.0 -t __NAME__=HvR -r "c:\Temp\Sample-Deploy"
Show Tokens:
-m s -i sharp-architecture-v1.6.0.0
View
41 README
@@ -11,9 +11,46 @@ Templify! v1.0 - Powered by endjin
About
=====
-Templify allows you to template a solution and then re-deploy and customise that solution.
+Templify allows you to template a solution (or folder structure) into a reusable package and then re-deploy that package as a new solution.
+Templify was originally created to solve the problem of how the Sharp Architecture project could distribute its sample solution - as the exising Visual Studio Template mechanism was problematic.
+
+Usage
+=====
+
+Templify can be executed from either the Windows Explorer Shell or via command line. For Windows Explorer select the parent folder containing the solution you want to templify, right click and select the "Templify This Folder" context menu option. A WPF window will appear asking you to entering information about the solution you are templating; Template Name, Template Version Number, Template Author and most importantly - the repeated word / phrase that will be tokenised. As Templify operates on a convention over configuration principal - it will replace all instances of that token, including internal content, directory & file names - with a bespoke token.
+
+When you want to deploy a new instance of your Templify template package - select a new empty folder in Windows Explorer, right click and select "Templify Here" from the context menu. A WPF window will appear with a drop downlist containing all the templates you have installed in your local package repository - select the ones you want to deploy - then enter a new name into the "name" textbox. This will be used to replace the bespoke token created in the previous step.
+
+Templify can also be used from the command line / MSBuild project. Two sample MSBuild targets were install into %PROGRAMFILES%\endjin\Templify\Samples\MSBuild - these show how to create and deploy packages.
+
+From the command line you would create a package using the following command switches:
+
+ TemplifyCmd.exe -m c -p C:\Temp\Sample-Create\Sharp-Architecture -n "Sharp Architecture" -a "Howard van Rooijen" -v "1.6.0.0" -t "SA169=__NAME__" -r "c:\Temp\Sample-Deploy"
+
+and you would deploy the package created above by using the following command switches:
+
+ TemplifyCmd.exe -m d -p "c:\Temp\Sample-Deploy" -i sharp-architecture-v1.6.0.0 -t __NAME__=HvR -r "c:\Temp\Sample-Deploy"
+
+The switches have the following meaning:
+
+ -m = mode
+ c = create
+ d = deploy
+ -p = path
+ -n = package name
+ -a = author
+ -v = version number
+ -t = token - can be delimited list "Token=__Token__" "Token1=__Token1__"
+ -i = package name
+ -r = package repository path
+
+The default package repository path is \Users\%USERNAME%\AppData\Roaming\Endjin\Templify\repo
+
+Packages are simply 7Zip archives - renamed to .pkg. You can open any .pkg file using 7Zip (which is freely downloadable) inside you will find a manifest.xml file - which contains a listing of all the contents in the package and the tokenised solution structure and files.
+
+
Ingredients
===========
Templify makes use of the following tools and frameworks:
@@ -59,4 +96,4 @@ Nick Harewood for prettifying the WPF styles.
Version History
===============
-2010.09.XX - v0.5.0.0 -
+2010.09.30 - v0.5.0.0 - First public release
@@ -3,6 +3,7 @@ namespace Endjin.Templify.Client.Core
#region Using Directives
using System.ComponentModel.Composition;
+ using System.Diagnostics;
using System.Windows;
using Caliburn.Micro;
@@ -62,6 +63,7 @@ protected override void Configure()
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
+ // Debugger.Launch();
this.args = e.Args;
base.OnStartup(sender, e);
@@ -43,7 +43,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <PlatformTarget>x86</PlatformTarget>
+ <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
@@ -49,5 +49,5 @@
// 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: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("0.5.0.0")]
@@ -36,6 +36,9 @@
Grid.Column="1"
Width="Auto" VerticalAlignment="Center" Margin="0,0,0,5" />
</Grid>
- <Button x:Name="Save" HorizontalContentAlignment="Center" HorizontalAlignment="Right" Padding="5" Width="50">Save</Button>
+ <Grid Margin="0,5,0,0" >
+ <Button x:Name="Save" HorizontalContentAlignment="Center" HorizontalAlignment="Right" Padding="5" Width="50">Save</Button>
+ <!--<Button x:Name="Cancel" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Padding="5" Width="50">Cancel</Button>-->
+ </Grid>
</StackPanel>
</Window>
@@ -85,6 +85,11 @@ public void Save()
MessageBox.Show("Settings have been saved.");
}
+ public void Cancel()
+ {
+ MessageBox.Show("Settings have been saved.");
+ }
+
private void Initialise()
{
BackgroundWorkerManager.RunBackgroundWork(this.RetrieveConfiguration);
@@ -5,6 +5,7 @@
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
+ using System.Diagnostics;
using Endjin.Templify.Domain.Contracts.Infrastructure;
using Endjin.Templify.Domain.Contracts.Tasks;
@@ -68,8 +69,9 @@ private void DisplayTokens(CommandOptions options)
private void OnProgressChanged(object sender, Domain.Domain.Packages.PackageProgressEventArgs e)
{
- ConsoleProgress.Reset();
- ConsoleProgress.Update(e.CurrentValue, e.MaxValue, e.ProgressStage.GetDescription());
+ // TODO: Console Progress doesn't work inside msbuild
+ // ConsoleProgress.Reset();
+ // ConsoleProgress.Update(e.CurrentValue, e.MaxValue, e.ProgressStage.GetDescription());
}
}
}
@@ -25,7 +25,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <PlatformTarget>x86</PlatformTarget>
+ <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
@@ -2,7 +2,9 @@
{
#region Using Directives
- using System;
+ using System;
+ using System.Diagnostics;
+ using System.IO;
#endregion
@@ -12,8 +14,6 @@ public static void Main(string[] args)
{
var client = new Client();
client.Execute(args);
-
- Console.ReadKey();
}
}
}
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -8,9 +7,9 @@
[assembly: AssemblyTitle("Endjin.Templify.CommandLine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("Endjin")]
[assembly: AssemblyProduct("Endjin.Templify.CommandLine")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyCopyright("Copyright © Endjin 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +31,5 @@
// 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: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("0.5.0.0")]
@@ -2,6 +2,8 @@ namespace Endjin.Templify.Domain.Contracts.Infrastructure
{
public interface IConfiguration
{
+ string PackageRepositoryPath { get; set; }
+
string GetFileExclusions();
string GetDirectoryExclusions();
@@ -19,7 +19,7 @@ public CommandOptions()
{
this.Mode = Mode.NotSet;
this.Tokens = new Dictionary<string, string>();
- this.OutputPath = FilePaths.PackageRepository;
+ this.PackageRepositoryPath = FilePaths.PackageRepository;
}
[Option("a", "Author")]
@@ -36,8 +36,8 @@ public CommandOptions()
[Option("p", "Path")]
public string Path { get; set; }
- [Option("o", "Output Path")]
- public string OutputPath { get; set; }
+ [Option("r", "Package Repository Path")]
+ public string PackageRepositoryPath { get; set; }
[Option("m", "Mode")]
public string RawMode
@@ -2,6 +2,7 @@
{
#region Using Directives
+ using System;
using System.ComponentModel.Composition;
using System.Configuration;
@@ -12,6 +13,13 @@
[Export(typeof(IConfiguration))]
public class Configuration : IConfiguration
{
+ public Configuration()
+ {
+ this.PackageRepositoryPath = FilePaths.PackageRepository;
+ }
+
+ public string PackageRepositoryPath { get; set; }
+
public string GetFileExclusions()
{
return this.GetConfigSetting("FileExclusions");
@@ -6,6 +6,7 @@
using System.ComponentModel.Composition;
using System.Linq;
+ using Endjin.Templify.Domain.Contracts.Infrastructure;
using Endjin.Templify.Domain.Contracts.Packager.Processors;
using Endjin.Templify.Domain.Contracts.Packages;
using Endjin.Templify.Domain.Domain.Packages;
@@ -16,18 +17,20 @@
public class PackageRepository : IPackageRepository
{
private readonly IArtefactProcessor artefactProcessor;
+ private readonly IConfiguration configuration;
private readonly IPackageFactory packageFactory;
[ImportingConstructor]
- public PackageRepository(IArtefactProcessor artefactProcessor, IPackageFactory packageFactory)
+ public PackageRepository(IArtefactProcessor artefactProcessor, IConfiguration configuration, IPackageFactory packageFactory)
{
this.artefactProcessor = artefactProcessor;
+ this.configuration = configuration;
this.packageFactory = packageFactory;
}
public IQueryable<Package> FindAll()
{
- var files = this.artefactProcessor.RetrieveFiles(FilePaths.PackageRepository, FileTypes.PackageWildcard);
+ var files = this.artefactProcessor.RetrieveFiles(this.configuration.PackageRepositoryPath, FileTypes.PackageWildcard);
return files.Select(this.packageFactory.Get).Where(p => !string.IsNullOrEmpty(p.Manifest.Name)).AsQueryable();
}
@@ -31,5 +31,5 @@
// 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: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("0.5.0.0")]
Oops, something went wrong.

0 comments on commit 1f1b55c

Please sign in to comment.