private static List <string> AddProvisioners(VagrantUpSettings settings, IEnumerable <string> provisioners)
        {
            var l = settings.Provisioners.Select(p => p.Trim().Trim(':')).ToList();

            l.AddRange(provisioners);
            settings.RunProvisioners = l.Any();
            return(l);
        }
 /// <summary>
 ///     Bring the machine up with the given provider. By default this is "virtualbox".
 /// </summary>
 /// <param name="settings">The setings</param>
 /// <param name="provider">Name of the provider to use (e.g. <c>"hyperv"</c>)</param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings UseProvider(this VagrantUpSettings settings, string provider)
 {
     settings.Provider = provider;
     return(settings);
 }
 /// <summary>
 ///     Destroy the newly created machine if a fatal, unexpected error occurs.
 ///     This will only happen on the first vagrant up.
 /// </summary>
 /// <param name="settings">The settings</param>
 /// <param name="destroy">><c>true</c> to destroy the machine. Defaults to <c>true</c></param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings DestroyOnError(this VagrantUpSettings settings, bool destroy = true)
 {
     settings.DestroyOnError = destroy;
     return(settings);
 }
 /// <summary>
 ///     Instructs Vagrant to attempt to install the chosen provider if it is not installed.
 /// </summary>
 /// <param name="settings">The settings</param>
 /// <param name="install"><c>true</c> to enable automatic installation. By default this is enabled.</param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings InstallProvider(this VagrantUpSettings settings, bool install = true)
 {
     settings.InstallProvider = install;
     return(settings);
 }
 /// <summary>
 ///     Bring multiple machines up in parallel if the provider supports it.
 /// </summary>
 /// <remarks>Please consult the provider documentation to see if this feature is supported.</remarks>
 /// <param name="settings">The settings</param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings EnableParallel(this VagrantUpSettings settings)
 {
     settings.Parallel = true;
     return(settings);
 }
 /// <summary>
 ///     This will only run the given provisioners when bringing up the machine
 /// </summary>
 /// <param name="settings">The settings</param>
 /// <param name="provisioners">Collection of provisioner names to run</param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings WithProvisioners(this VagrantUpSettings settings,
                                                  params string[] provisioners)
 {
     settings.Provisioners = AddProvisioners(settings, provisioners);
     return(settings);
 }
 /// <summary>
 ///     This will only run the given provisioners when bringing up the machine
 /// </summary>
 /// <param name="settings">The settings</param>
 /// <param name="provisioners">List of provisioner names to run</param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings WithProvisioners(this VagrantUpSettings settings,
                                                  IEnumerable <string> provisioners)
 {
     settings.Provisioners = AddProvisioners(settings, provisioners);
     return(settings);
 }
 /// <summary>
 ///     Force the provisioners to run when bringing up the machine
 /// </summary>
 /// <param name="settings">The settings</param>
 /// <param name="run"><c>true</c> to run provisioners</param>
 /// <returns>The updated settings object</returns>
 public static VagrantUpSettings RunProvisioners(this VagrantUpSettings settings,
                                                 bool run = true)
 {
     settings.RunProvisioners = run;
     return(settings);
 }