/// <summary> /// Registers the specified <see cref="Assembly"/>. /// </summary> /// <param name="services">The service registration collection.</param> /// <param name="assembly">The assembly to register.</param> /// <returns>The same <see cref="ICakeServices"/> instance so that multiple calls can be chained.</returns> public static ICakeServices UseAssembly(this ICakeServices services, Assembly assembly) { Guard.ArgumentNotNull(services, nameof(services)); services.RegisterInstance(assembly).Singleton(); return(services); }
/// <summary> /// Sets the relative working directory to be used when running the build. /// </summary> /// <param name="services">The service registration collection.</param> /// <param name="path">The working directory path.</param> /// <returns>The same <see cref="ICakeServices"/> instance so that multiple calls can be chained.</returns> public static ICakeServices UseWorkingDirectory(this ICakeServices services, DirectoryPath path) { Guard.ArgumentNotNull(services, nameof(services)); services.RegisterInstance(new WorkingDirectory(path)).AsSelf().Singleton(); return(services); }
/// <summary> /// Add or replace a setting in the configuration. /// </summary> /// <param name="services">The service registration collection.</param> /// <param name="key">The key of the setting to add or replace.</param> /// <param name="value">The value of the setting to add or replace.</param> /// <returns>The same <see cref="ICakeServices"/> instance so that multiple calls can be chained.</returns> public static ICakeServices UseSetting(this ICakeServices services, string key, string value) { var info = new ConfigurationValue(key, value); services.RegisterInstance(info).AsSelf().Singleton(); return(services); }
/// <summary> /// Registers a specific tool for installation. /// </summary> /// <param name="services">The service registration collection.</param> /// <param name="uri">The tool URI.</param> /// <returns>The same <see cref="ICakeServices"/> instance so that multiple calls can be chained.</returns> public static ICakeServices UseTool(this ICakeServices services, Uri uri) { Guard.ArgumentNotNull(services, nameof(services)); var package = new PackageReference(uri.OriginalString); services.RegisterInstance(package).Singleton(); return(services); }
/// <summary> /// Add or replace a setting in the configuration. /// </summary> /// <param name="services">The service registration collection.</param> /// <param name="key">The key of the setting to add or replace.</param> /// <param name="value">The value of the setting to add or replace.</param> /// <returns>The same <see cref="ICakeServices"/> instance so that multiple calls can be chained.</returns> public static ICakeServices UseSetting(this ICakeServices services, string key, string value) { Guard.ArgumentNotNull(services, nameof(services)); var info = new ConfigurationSetting(key, value); services.RegisterInstance(info).AsSelf().Singleton(); return(services); }