/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void CreateTarballAndUploadToPuppetForge(object sender, EventArgs e) { try { PuppetProjectNode puppetProjectNode; var filesToPack = this.GetActiveProjectStruture(out puppetProjectNode); // to simplify unittesting - get rid of PuppetProjectNode and use dict instead var forgeData = SELF.TurnIntoDict(puppetProjectNode); var jsonMetadata = SELF.CreateJsonMetadata(forgeData, filesToPack); var gzFileName = SELF.TarGz(forgeData, filesToPack, jsonMetadata); this.UploadToPuppetForgeAsync(forgeData, gzFileName); } catch (Exception ex) { this.MessageBox(ex.Message, Resources.TarballCreationStatus); } }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void CreateTarballLocally(object sender, EventArgs e) { try { PuppetProjectNode puppetProjectNode; var filesToPack = this.GetActiveProjectStruture(out puppetProjectNode); // to simplify unittesting - get rid of PuppetProjectNode and use dict instead var forgeData = SELF.TurnIntoDict(puppetProjectNode); var jsonMetadata = SELF.CreateJsonMetadata(forgeData, filesToPack); var gzFileName = SELF.TarGz(forgeData, filesToPack, jsonMetadata); var packagesDir = new DirectoryInfo(puppetProjectNode.BaseURI.Directory).CreateSubdirectory("packages"); var destFile = System.IO.Path.Combine(packagesDir.ToString(), gzFileName); File.Copy(gzFileName, destFile, true); this.MessageBox(destFile, Resources.TarballSavedSuccessfully); } catch (Exception ex) { this.MessageBox(ex.Message, Resources.TarballCreationStatus); } }