public HandlerResponse Process(string outputPath) { var di = new DirectoryInfo(outputPath); if (!di.Exists) { throw new DirectoryNotFoundException("Invalid output path!"); } var files = di.GetFiles(); var manifestPresent = files.Any(f => f.Extension == ".cltw"); var infoPresent = files.Any(f => f.Name == "app.info"); if (!(manifestPresent && infoPresent)) { return(new HandlerResponse(this, false, "This handler requires both a deployment manifest (cltw file) and an info file (app.info)! Try adding AppInfoHandler to your OutputHandlers and ensure you have set an InformationSource to generate a manifest.")); } Manifest = ManifestManager.ReadFromFile(GetManifest(outputPath).FullName); AppInfo = AppInfoManager.ReadFromFile(GetInfoFile(outputPath).FullName); Engine.Manifest = Manifest; Engine.AppInfo = AppInfo; var contentDirectory = Engine.CreateContentDirectory(new DirectoryInfo(outputPath)); contentDirectory.Copy(outputPath, copySubDirs: true); if (FileNameMap.Any()) { var outFiles = new DirectoryInfo(outputPath).GetFiles(); foreach (var file in FileNameMap) { var target = outFiles.FirstOrDefault(f => f.Name == file.Key); target?.Rename(file.Value); } } Engine.Dispose(); return(new HandlerResponse(this, true)); }
private void GetAppInfo() { AppInfoManager appInfo = new AppInfoManager(); AssemblyFileVersion = appInfo.GetAssemblyFileVersion(); AssemblyInformationVersion = appInfo.GetAssemblyInformationVersion(); AssemblyVersion = appInfo.GetAssemblyVersion(); DotNetInfo = appInfo.GetDotNetInfo(); InstallLocation = appInfo.GetInstallLocation(); PackageVersion = appInfo.GetPackageVersion(); AppInstallerUri = appInfo.GetAppInstallerUri(); PackageChannel = appInfo.GetPackageChannel(); DisplayName = appInfo.GetDisplayName(); MSIXVersionNumber = appInfo.GetMsixPackageVersion().ToString(); //AppInfoInstallerUri = appInfo.GetAppInstallerInfoUri() }
//@"C:\Users\UCRM4\Source\ACN\myTaxFramework\FormDocuments\DocumentConversion\DocumentConversion.csproj"; private static void Main(string[] args) { var packager = new TemplatePackager("ClickTwice.Templates.SolidState", "0.0.1", "Alistair Chapman", "ClickTwice Template using the HTML5UP Solid State design"); //var package = packager.Package(@"C:\Users\alist\Source\ClickTwice\src\ClickTwice.Templates.SolidState", PackagingMode.VisualStudio); var package = packager.Package(@"C:\Users\alist\Source\TEMP\solid-state", PackagingMode.Minimal); var handler = new AppDetailsPageHandler(package); if (args.Any()) { DefaultProjectPath = args.First(); } var log = new ConsoleLogger(); var file = new FileLogger(); var info = new AppInfoManager(); var infoHandler = new AppInfoHandler(); BuildInfo(info); var mgr = new PublishManager(DefaultProjectPath, InformationSource.Both) { Platform = "AnyCPU", Configuration = "Debug", InputHandlers = new List <IInputHandler> { infoHandler }, OutputHandlers = new List <IOutputHandler> { infoHandler, new PublishPageHandler(), new InstallPageHandler("install.htm"), handler }, Loggers = new List <IPublishLogger> { log, file } }; // ReSharper disable once RedundantArgumentDefaultValue var path = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"))); var result = mgr.PublishApp(path.FullName, behaviour: PublishBehaviour.CleanFirst); //var manager = new ManifestManager(DefaultProjectPath, path.FullName, InformationSource.Both); //var manifest = manager.CreateAppManifest(); //var cltw = manager.DeployManifest(manifest); Process.Start(path.FullName); Console.WriteLine(result.Select(r => $"{r.Handler.Name} - {r.Result} - {r.ResultMessage}" + Environment.NewLine)); }
HandlerResponse IInputHandler.Process(string inputPath) { var files = new DirectoryInfo(inputPath).EnumerateFiles("app.info", SearchOption.AllDirectories).ToList(); var projects = new DirectoryInfo(inputPath).EnumerateFiles("*.csproj", SearchOption.TopDirectoryOnly); if (files.Any()) { AppInfo = AppInfoManager.ReadFromFile(files.First().FullName); Manager = new AppInfoManager(AppInfo); } else { Manager = new AppInfoManager(projects.FirstOrDefault()?.FullName); } if (Configuration != null && Manager != null) { Configuration.Invoke(Manager); } return(new HandlerResponse(this, true)); }
public static AppInfoManager AppInfo(this ICakeContext ctx, FilePath projectFile) { if (ctx == null) { throw new ArgumentNullException(nameof(ctx)); } if (projectFile == null) { throw new ArgumentNullException(nameof(projectFile)); } if (ctx.Environment.IsUnix()) { throw new PlatformNotSupportedException("ClickTwice is currently only supported on the Windows platform"); } var infoPath = projectFile.GetDirectory().GetFilePath("app.info"); return(ctx.FileSystem.Exist(infoPath) ? new AppInfoManager(AppInfoManager.ReadFromFile(infoPath.MakeAbsolute(ctx.Environment).FullPath)) : new AppInfoManager(projectFile.MakeAbsolute(ctx.Environment).FullPath)); }
public AppInfoHandler(AppInfoManager manager = null) { Manager = manager; }
private static void BuildInfo(AppInfoManager info) { info.AddAuthor("Alistair Chapman"); }