1 /** 2 * WiX Toolset 3 * 4 * License: 5 * This Source Code Form is subject to the terms of 6 * the Mozilla Public License, v. 2.0. If a copy of 7 * the MPL was not distributed with this file, You 8 * can obtain one at http://mozilla.org/MPL/2.0/. 9 * 10 * Authors: 11 * Vladimir Panteleev <vladimir@thecybershadow.net> 12 */ 13 14 module ae.sys.install.wix; 15 16 import std.conv; 17 import std.file; 18 import std.format; 19 import std.regex; 20 21 import ae.sys.archive; 22 import ae.sys.file; 23 import ae.utils.meta.misc; 24 25 public import ae.sys.install.common; 26 27 class Wix : Installer 28 { 29 int downloadId = 762938; 30 long fileTime = 130301249355530000; 31 32 @property override string[] requiredExecutables() { return ["candle", "dark", "heat", "light", "lit", "lux", "melt", "nit", "pyro", "retina", "shine", "smoke", "torch"]; } 33 34 override void installImpl(string target) 35 { 36 windowsOnly(); 37 // CodePlex does not have direct download URLs. Scrape it! 38 "http://wix.codeplex.com/downloads/get/%d" 39 .format(downloadId) 40 .I!saveAs("wix-%d.html".format(downloadId)) 41 .readText() 42 .match(regex(`<li>Version \d+\.\d+\.\d+\.(\d+)</li>`)).front[1] 43 .to!int 44 .I!buildZipUrl() 45 .I!saveAs("wix-%d.zip".format(downloadId)) 46 .I!unpackTo(target); 47 } 48 49 string buildZipUrl(int build) 50 { 51 return "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=wix&DownloadId=%d&FileTime=%d&Build=%d" 52 .format(downloadId, fileTime, build); 53 } 54 } 55 56 alias wixInstaller = singleton!Wix;