public static void Main(string[] args) { ParseArguments(args); if (IsHelp) { Help(); } else { Console.WriteLine(""); Console.WriteLine("Setting up csAnt from local files..."); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("Source dir:"); Console.WriteLine(SourcePath); Console.WriteLine(""); Console.WriteLine("Destination dir:"); Console.WriteLine(DestinationPath); Console.WriteLine(""); Installer installer = null; // If it's a direct install then use the direct local installer if (Direct) { installer = new DirectLocalInstaller( SourcePath, DestinationPath, Overwrite ); } else { installer = new LocalInstaller( SourcePath, DestinationPath, PackageName, Overwrite ); } installer.Version = Version; installer.Status = Status; installer.Clear = Clear; installer.Import = Import; installer.ImportPath = ImportPath; installer.Clone = Clone; installer.CloneSource = CloneSource; installer.Install(); new IntroWriter().Write(); } }
/// <summary> /// Emits WiX Registry Values from the installation data. /// </summary> private int ConvertRegistryValues(DirectoryRef directory, ComponentGroup componentgroup, InstallationDataXml dataxml, IDictionary <string, string> macros) { foreach (RegistryValueXml valuexml in dataxml.Registry.Value) { try { var value = new RegistryValue(); GetComponentForHive(valuexml.Hive, directory, componentgroup).AddChild(value); value.Root = GetRoot(valuexml.Hive); value.Key = LocalInstaller.SubstituteMacros(macros, valuexml.Key); if (!string.IsNullOrEmpty(valuexml.Name)) // The default value name must be Null not an empty string { value.Name = LocalInstaller.SubstituteMacros(macros, valuexml.Name); } value.Value = LocalInstaller.SubstituteMacros(macros, valuexml.Value); value.Type = GetValueType(valuexml.Type); value.Action = RegistryValue.ActionType.write; } catch (Exception ex) { throw new InvalidOperationException(string.Format("Failed to process the value {0}. {1}", valuexml, ex.Message), ex); } } return(dataxml.Registry.Value.Length); }
/// <summary> /// Actions under the resolver. /// </summary> protected override void ExecuteTaskResolved() { // Get the stage var stage = (RegistrationStage)TypeDescriptor.GetConverter(typeof(RegistrationStage)).ConvertFromString(Bag.GetString(AttributeName.Stage)); // Collect the installation data and install it LocalInstaller.Install(CreateInstaller().HarvestInstallationData(), stage, GetMacros(), root => new DirectoryInfo(ResolveSourceDirRoot(root, Bag)), root => new DirectoryInfo(ResolveTargetDirRoot(root, Bag)), text => { Log.LogMessage(MessageImportance.Low, text); }); }
public void Test_Install() { var installer = new LocalInstaller( OriginalDirectory, WorkingDirectory, "csAnt", true ); installer.Install(); }
public void Test_Install_Import() { var installer = new LocalInstaller( OriginalDirectory, WorkingDirectory, "csAnt", true ); installer.ImportPath = OriginalDirectory; installer.Import = true; installer.Install(); }
public void Test_Install_Clone() { var installer = new LocalInstaller( OriginalDirectory, WorkingDirectory, "csAnt", true ); installer.CloneSource = OriginalDirectory; installer.Clone = true; installer.Install(); Assert.IsTrue( Directory.Exists(PathConverter.ToAbsolute(".git")), "The .git folder wasn't found." ); }
/// <summary> /// Emits WiX Registry Keys from the installation data. /// </summary> private int ConvertRegistryKeys(DirectoryRef directory, ComponentGroup componentgroup, InstallationDataXml dataxml, IDictionary <string, string> macros) { foreach (RegistryKeyXml keyxml in dataxml.Registry.Key) // Keys { try { var key = new RegistryKey(); GetComponentForHive(keyxml.Hive, directory, componentgroup).AddChild(key); key.Root = GetRoot(keyxml.Hive); key.Key = LocalInstaller.SubstituteMacros(macros, keyxml.Key); key.Action = RegistryKey.ActionType.createAndRemoveOnUninstall; } catch (Exception ex) { throw new InvalidOperationException(string.Format("Failed to process the key {0}. {1}", keyxml, ex.Message), ex); } } return(dataxml.Registry.Key.Length); }
public override bool Run(string[] args) { var packageName = "csAnt"; var destination = ""; if (args.Length >= 2) { packageName = args[0]; destination = args[1]; } else if (args.Length >= 1) { destination = Path.GetFullPath(args[1]); } if (destination == "") { throw new Exception("A destination must be specified as an argument."); } var installer = new LocalInstaller( CurrentDirectory, destination, packageName, true ); installer.Install(); var arguments = new Arguments(args); if (arguments.Contains("r")) { Relocate(destination); } return(!IsError); }