public async Task <InstalledPackage> Install(ISource source, PackageSpec package) { var pdir = GetPackageDir(package); if (Directory.Exists(pdir)) { throw new Exception("Package already installed."); } FS.EnsureDirectoryExists(pdir); var nupkgDest = GetNupkgPath(package); FS.EnsureParentDirectoryExists(nupkgDest); await source.Download(package, nupkgDest); ZipFile.ExtractToDirectory(nupkgDest, pdir); return(new InstalledPackage(this, package)); }
async Task <int> RunImpl() { // locate compiled assembly FS.EnsureDirectoryExists(cacheDir); log(cacheDir); var sourceDir = GetSourceDir(); EnsureSourceDirectoryExists(sourceDir); // still up-to-date ? if (IsBuildRequired(sourceDir, OutputFile)) { await Build(sourceDir, OutputFile, repository); } // run var a = Assembly.LoadFrom(OutputFile); return(Run(a)); }
static int Main(string[] args) { try { var sce = new SelfCompilingExecutable(FS.GetExecutable()); if (args.Length >= 1 && string.Equals(args[0], "watch")) { sce.Watch(); return(0); } else { return(sce.Run().Result); } } catch (Exception e) { Console.Error.WriteLine(e); return(-1); } }
static string GetSourceDir() { return(FS.GetExecutable() + ".src"); }