public InstallBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport) { _project = project; _packageBuilder = packageBuilder; _buildReport = buildReport; IsApplicationPackage = project.Commands.Any(); }
static void Main(string[] args) { PackageCreater creater = new PackageCreater(); Console.WriteLine("Hello World!"); //IPackageBuilder package = null; //package = new ChildPackageBuilder(); //creater.Manufacture(package); //Console.WriteLine("Child Package created."); //package.Package.ShowPackage(); //package = new AdultPackageBuilder(); //creater.Manufacture(package); //Console.WriteLine("Adult Package created."); //package.Package.ShowPackage(); //////////////////// IPackageBuilder adultPack = creater.AdultPackageBuilder(); IPackageBuilder childPack = creater.ChildPackageBuilder(); Console.WriteLine("New Adult pack created:"); adultPack.Package.ShowPackage(); Console.WriteLine("New Child pack created:"); childPack.Package.ShowPackage(); Console.ReadLine(); }
public PackCommand(ILog log, IOctopusFileSystem fileSystem) { this.log = log; this.fileSystem = fileSystem; var common = optionGroups.For("Advanced options"); common.Add("include=", "[Optional, Multiple] Add a file pattern to include, relative to the base path e.g. /bin/*.dll - if none are specified, defaults to **", v => includes.Add(v)); common.Add("overwrite", "[Optional] Allow an existing package file of the same ID/version to be overwritten", v => overwrite = true); var nuget = optionGroups.For("NuGet packages"); nuget.Add("author=", "[Optional, Multiple] Add an author to the package metadata; defaults to the current user", v => authors.Add(v)); nuget.Add("title=", "[Optional] The title of the package", v => title = v); nuget.Add("description=", "[Optional] A description of the package; defaults to a generic description", v => description = v); nuget.Add("releaseNotes=", "[Optional] Release notes for this version of the package", v => releaseNotes = v); nuget.Add("releaseNotesFile=", "[Optional] A file containing release notes for this version of the package", v => releaseNotesFile = v); var basic = optionGroups.For("Basic options"); basic.Add("id=", "The ID of the package; e.g. MyCompany.MyApp", v => id = v); basic.Add("format=", "Package format. Options are: NuPkg, Zip. Defaults to NuPkg, though we recommend Zip going forward.", fmt => packageBuilder = SelectFormat(fmt)); basic.Add("version=", "[Optional] The version of the package; must be a valid SemVer; defaults to a timestamp-based version", v => version = string.IsNullOrWhiteSpace(v) ? null : new SemanticVersion(v)); basic.Add("outFolder=", "[Optional] The folder into which the generated NUPKG file will be written; defaults to '.'", v => outFolder = v); basic.Add("basePath=", "[Optional] The root folder containing files and folders to pack; defaults to '.'", v => basePath = v); packageBuilder = SelectFormat("nupkg"); }
public PackCommand(IOctopusFileSystem fileSystem, ICommandOutputProvider commandOutputProvider) : base(commandOutputProvider) { this.fileSystem = fileSystem; var common = Options.For("Advanced options"); common.Add <string>("include=", "[Optional, Multiple] Add a file pattern to include, relative to the base path e.g. /bin/*.dll - if none are specified, defaults to **.", v => includes.Add(v), allowsMultiple: true); common.Add <bool>("overwrite", "[Optional] Allow an existing package file of the same ID/version to be overwritten.", v => overwrite = true); var zip = Options.For("Zip packages"); zip.Add <PackageCompressionLevel>("compressionLevel=", $"[Optional] Sets the compression level of the package. Valid values are {Enum.GetNames(typeof(PackageCompressionLevel)).ReadableJoin()}. Default is {DefaultPackageCompressionLevel}.", c => packageCompressionLevel = c); var nuget = Options.For("NuGet packages"); nuget.Add <string>("author=", "[Optional, Multiple] Add an author to the package metadata; defaults to the current user.", v => authors.Add(v), allowsMultiple: true); nuget.Add <string>("title=", "[Optional] The title of the package.", v => title = v); nuget.Add <string>("description=", "[Optional] A description of the package; defaults to a generic description.", v => description = v); nuget.Add <string>("releaseNotes=", "[Optional] Release notes for this version of the package.", v => releaseNotes = v); nuget.Add <string>("releaseNotesFile=", "[Optional] A file containing release notes for this version of the package.", v => releaseNotesFile = v); var basic = Options.For("Basic options"); basic.Add <string>("id=", "The ID of the package; e.g. MyCompany.MyApp.", v => id = v); basic.Add <PackageFormat>("format=", $"Package format. Valid values are {supportedPackageFormats}. Default is {DefaultPackageFormat}, though we recommend {RecommendedPackageFormat} going forward.", fmt => packageBuilder = SelectFormat(fmt)); basic.Add <string>("version=", "[Optional] The version of the package; must be a valid SemVer; defaults to a timestamp-based version.", v => version = string.IsNullOrWhiteSpace(v) ? null : new SemanticVersion(v)); basic.Add <string>("outFolder=", "[Optional] The folder into which the generated NuPkg file will be written; defaults to '.'.", v => { v.CheckForIllegalPathCharacters(nameof(outFolder)); outFolder = v; }); basic.Add <string>("basePath=", "[Optional] The root folder containing files and folders to pack; defaults to '.'.", v => { v.CheckForIllegalPathCharacters(nameof(basePath)); basePath = v; }); basic.Add <bool>("verbose", "[Optional] verbose output.", v => verbose = true); basic.AddLogLevelOptions(); packageBuilder = SelectFormat(DefaultPackageFormat); }
public InstallBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport) { _project = project; _packageBuilder = packageBuilder; _buildReport = buildReport; IsApplicationPackage = project.Commands.Any(); }
public CsvImporter(IMapper mapper, CsvImporterConfig config, IPackageBuilder builder) { mapper.Map(config, this); mapper.Map(config, Properties); Properties.NeedSavePackage = true; packageBuilder = builder; }
public PackCommand(ILogger log, IOctopusFileSystem fileSystem) { this.log = log; this.fileSystem = fileSystem; var common = optionGroups.For("Advanced options"); common.Add("include=", "[Optional, Multiple] Add a file pattern to include, relative to the base path e.g. /bin/*.dll - if none are specified, defaults to **", v => includes.Add(v)); common.Add("overwrite", "[Optional] Allow an existing package file of the same ID/version to be overwritten", v => overwrite = true); var nuget = optionGroups.For("NuGet packages"); nuget.Add("author=", "[Optional, Multiple] Add an author to the package metadata; defaults to the current user", v => authors.Add(v)); nuget.Add("title=", "[Optional] The title of the package", v => title = v); nuget.Add("description=", "[Optional] A description of the package; defaults to a generic description", v => description = v); nuget.Add("releaseNotes=", "[Optional] Release notes for this version of the package", v => releaseNotes = v); nuget.Add("releaseNotesFile=", "[Optional] A file containing release notes for this version of the package", v => releaseNotesFile = v); var basic = optionGroups.For("Basic options"); basic.Add("id=", "The ID of the package; e.g. MyCompany.MyApp", v => id = v); basic.Add("format=", "Package format. Options are: NuPkg, Zip. Defaults to NuPkg, though we recommend Zip going forward", fmt => packageBuilder = SelectFormat(fmt)); basic.Add("version=", "[Optional] The version of the package; must be a valid SemVer; defaults to a timestamp-based version", v => version = string.IsNullOrWhiteSpace(v) ? null : new SemanticVersion(v)); basic.Add("outFolder=", "[Optional] The folder into which the generated NUPKG file will be written; defaults to '.'", v => { v.CheckForIllegalPathCharacters(nameof(outFolder)); outFolder = v; }); basic.Add("basePath=", "[Optional] The root folder containing files and folders to pack; defaults to '.'", v => { v.CheckForIllegalPathCharacters(nameof(basePath)); basePath = v; }); basic.Add("verbose", "[Optional] verbose output", v => verbose = true); packageBuilder = SelectFormat("nupkg"); }
public Logic(ILifetimeScope autofac, IRepository repository, IMonik monik, IMapper mapper, IArchiver archiver, ITelegramBotClient bot, IPackageBuilder builder) { this.autofac = autofac; this.mapper = mapper; this.monik = monik; this.archiver = archiver; this.bot = bot; bot.StartReceiving(); this.repository = repository; packageBuilder = builder; contextsInWork = new Dictionary <long, IReportTaskRunContext>(); checkScheduleAndExecuteScheduler = new Scheduler { Period = 60, TaskMethod = CheckScheduleAndExecute }; tableView = this.autofac.ResolveNamed <IViewExecutor>("CommonTableViewEx"); operTemplates = new List <DtoOperTemplate>(); recepientGroups = new List <DtoRecepientGroup>(); telegramChannels = new List <DtoTelegramChannel>(); schedules = new List <DtoSchedule>(); tasks = new List <IReportTask>(); operations = new List <DtoOperation>(); this.bot.OnUpdate += OnBotUpd; } //ctor
private static void CopyFilesToPackage(IPackageBuilder builder, IRebelApplicationContext appContext, string storeUri, IEnumerable <HiveId> fileIds, string targetRootPath, Action <Rebel.Framework.Persistence.Model.IO.File, IPackageBuilder> callback = null) { using (var uow = appContext.Hive.OpenReader <IFileStore>(new Uri(storeUri))) { var root = uow.Repositories.Get <Rebel.Framework.Persistence.Model.IO.File>(new HiveId("/")); var files = uow.Repositories.Get <Rebel.Framework.Persistence.Model.IO.File>(true, fileIds.ToArray()) .Where(x => !x.IsContainer); foreach (var file in files) { builder.Files.Add(new ByteArrayPackageFile { Contents = file.ContentBytes, TargetPath = targetRootPath + file.RootRelativePath.TrimStart(root.RootRelativePath).TrimStart("/") }); if (callback != null) { callback.Invoke(file, builder); } } } }
public SimplePackage(IPackageBuilder packageBuilder) { if (packageBuilder == null) { throw new ArgumentNullException("packageBuilder"); } Id = packageBuilder.Id; Version = packageBuilder.Version; Title = packageBuilder.Title; Authors = new SafeEnumerable <string>(packageBuilder.Authors); Owners = new SafeEnumerable <string>(packageBuilder.Owners); IconUrl = packageBuilder.IconUrl; LicenseUrl = packageBuilder.LicenseUrl; ProjectUrl = packageBuilder.ProjectUrl; RequireLicenseAcceptance = packageBuilder.RequireLicenseAcceptance; DevelopmentDependency = packageBuilder.DevelopmentDependency; Description = packageBuilder.Description; Summary = packageBuilder.Summary; ReleaseNotes = packageBuilder.ReleaseNotes; Language = packageBuilder.Language; Tags = packageBuilder.Tags; FrameworkAssemblies = new SafeEnumerable <FrameworkAssemblyReference>(packageBuilder.FrameworkAssemblies); DependencySets = new SafeEnumerable <PackageDependencySet>(packageBuilder.DependencySets); PackageAssemblyReferences = new SafeEnumerable <PackageReferenceSet>(packageBuilder.PackageAssemblyReferences); Copyright = packageBuilder.Copyright; _packageBuilder = packageBuilder; }
public PackageCreator(string rootPath, string outputPath) { _rootPath = rootPath; _outputPath = outputPath; _vpp = new RootedVirtualPathProvider(rootPath); _packageBuilder = new PackageBuilder(new ApplicationEnvironment(_vpp, NullLogger.Instance)); }
public BaseDbImporter(IMapper mapper, DbImporterConfig config, IPackageBuilder builder, ThreadSafeRandom rnd) { mapper.Map(config, this); mapper.Map(config, Properties); Properties.NeedSavePackage = true; packageBuilder = builder; this.rnd = rnd; }
public ExcelImporter(IMapper mapper, ExcelImporterConfig config, IPackageBuilder builder) { mapper.Map(config, this); mapper.Map(config, Properties); Properties.NeedSavePackage = true; ExcelParameters = new ExcelReadingParameters(); mapper.Map(config, ExcelParameters); packageBuilder = builder; }
public PackageCreator(string rootPath, string outputPath) { _rootPath = rootPath; _outputPath = outputPath; _vpp = new RootedVirtualPathProvider(rootPath); var wsf = new WebSiteFolder(_vpp); _packageBuilder = new PackageBuilder(wsf, _vpp); }
public PackageManager( IExtensionManager extensionManager, IPackageBuilder packageBuilder, IPackageInstaller packageExpander) { _extensionManager = extensionManager; _packageBuilder = packageBuilder; _packageExpander = packageExpander; T = NullLocalizer.Instance; }
public PackageCreator(string rootPath, string outputPath) { _rootPath = rootPath; _outputPath = outputPath; _vpp = new RootedVirtualPathProvider(rootPath); var wsf = new WebSiteFolder(_vpp); _packageBuilder = new PackageBuilder(wsf); }
public DbPackageDataConsumer( IMapper mapper, DbImporterConfig config, IPackageBuilder builder, ThreadSafeRandom rnd, DbPackageExportScriptCreator scriptCreator, SqlCommandInitializer sqlCommandInitializer) : base(mapper, config, builder, rnd, scriptCreator, sqlCommandInitializer) { }
protected PackageConsumerBase( IMapper mapper, DbImporterConfig config, IPackageBuilder builder, ThreadSafeRandom rnd, BasePackageExportScriptCreator exportScriptCreator, SqlCommandInitializer sqlCommandInitializer) : base(mapper, config, builder, rnd) { this.complexScriptCreator = exportScriptCreator; this.commandInitializer = sqlCommandInitializer; }
public PackageManager( IExtensionManager extensionManager, IPackageBuilder packageBuilder, IPackageInstaller packageExpander) { _extensionManager = extensionManager; _packageBuilder = packageBuilder; _packageExpander = packageExpander; T = NullLocalizer.Instance; }
IPackageBuilder AssignProperties(IPackageBuilder builder, IEnumerable <IGrouping <string, string> > properties) { foreach (var property in properties) { var pi = builder.GetType().GetProperty(property.Key, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); if (pi != null) { pi.SetValue(builder, property.ToList(), null); } } return(builder); }
public PackageManager( IPluginFinder pluginFinder, IThemeRegistry themeRegistry, IPackageBuilder packageBuilder, IPackageInstaller packageInstaller, Log.ILogger logger) { _pluginFinder = pluginFinder; _themeRegistry = themeRegistry; _packageBuilder = packageBuilder; _packageInstaller = packageInstaller; _logger = logger; }
private static List <ManifestReference> CreateReferences(IPackageMetadata metadata) { IPackageBuilder packageBuilder = metadata as IPackageBuilder; if (packageBuilder == null || packageBuilder.PackageAssemblyReferences.IsEmpty()) { return(null); } return((from reference in packageBuilder.PackageAssemblyReferences select new ManifestReference { File = reference.SafeTrim() }).ToList()); }
public PackageManager( IPluginFinder pluginFinder, IThemeRegistry themeRegistry, IPackageBuilder packageBuilder, IPackageInstaller packageInstaller, Log.ILogger logger) { _pluginFinder = pluginFinder; _themeRegistry = themeRegistry; _packageBuilder = packageBuilder; _packageInstaller = packageInstaller; _logger = logger; }
private static void CopySerializedObjectsToPackage <T>(IPackageBuilder builder, IRebelApplicationContext appContext, IEnumerable <T> objects, Func <T, string> targetPathCallback) { foreach (var obj in objects) { var serializeResult = appContext.FrameworkContext.Serialization.ToStream(obj); if (serializeResult.Success) { builder.Files.Add(new StreamPackageFile { Contents = serializeResult.ResultStream, TargetPath = targetPathCallback.Invoke(obj) }); } } }
private Stream BuildHelloWorld(IPackageBuilder packageBuilder) { // add some content because NuGet requires it var folder = _container.Resolve<InMemoryWebSiteFolder>(); using ( var sourceStream = GetType().Assembly.GetManifestResourceStream(GetType(), "Hello.World.csproj.txt") ) { folder.AddFile("~/Modules/Hello.World/Hello.World.csproj", new StreamReader(sourceStream).ReadToEnd()); } return packageBuilder.BuildPackage(new ExtensionDescriptor { ExtensionType = DefaultExtensionTypes.Module, Id = PackageIdentifier, Version = "1.0", Description = "a", Author = "b" }); }
public PackageManager( IExtensionManager extensionManager, IPackageBuilder packageBuilder, IPackageInstaller packageInstaller, IShellStateManager shellStateManager, IFeatureManager featureManager, IPackageUninstallHandler packageUninstallHandler) { _extensionManager = extensionManager; _packageBuilder = packageBuilder; _packageInstaller = packageInstaller; _shellStateManager = shellStateManager; _featureManager = featureManager; _packageUninstallHandler = packageUninstallHandler; T = NullLocalizer.Instance; }
private static List <ManifestReferenceSet> CreateReferenceSets(IPackageMetadata metadata) { IPackageBuilder packageBuilder = metadata as IPackageBuilder; if (packageBuilder == null || packageBuilder.PackageAssemblyReferences.IsEmpty()) { return(null); } return((from referenceSet in packageBuilder.PackageAssemblyReferences select new ManifestReferenceSet { TargetFramework = referenceSet.TargetFramework != null ? VersionUtility.GetFrameworkString(referenceSet.TargetFramework) : null, References = CreateReferences(referenceSet) }).ToList()); }
private Stream BuildHelloWorld(IPackageBuilder packageBuilder) { // add some content because NuGet requires it var folder = _container.Resolve <InMemoryWebSiteFolder>(); using (var sourceStream = GetType().Assembly.GetManifestResourceStream(GetType(), "Hello.World.csproj.txt")) { folder.AddFile("~/Modules/Hello.World/Hello.World.csproj", new StreamReader(sourceStream).ReadToEnd()); } return(packageBuilder.BuildPackage(new ExtensionDescriptor { ExtensionType = DefaultExtensionTypes.Module, Id = PackageIdentifier, Version = "1.0", Description = "a", Author = "b" })); }
public PackageManager( IExtensionManager extensionManager, IPackageBuilder packageBuilder, IPackageInstaller packageInstaller, IShellStateManager shellStateManager, IFeatureManager featureManager, IPackageUninstallHandler packageUninstallHandler) { _extensionManager = extensionManager; _packageBuilder = packageBuilder; _packageInstaller = packageInstaller; _shellStateManager = shellStateManager; _featureManager = featureManager; _packageUninstallHandler = packageUninstallHandler; T = NullLocalizer.Instance; }
public PackageCreatorTasks( IArchiveBuilder archiveBuilder, ICleanUpProcessor cleanUpProcessor, IClonePackageBuilder clonePackageBuilder, IConfiguration configuration, IPackageBuilder packageBuilder, IPackageTokeniser packageTokeniser, IProgressNotifier progressNotifier) { this.archiveBuilder = archiveBuilder; this.cleanUpProcessor = cleanUpProcessor; this.clonePackageBuilder = clonePackageBuilder; this.configuration = configuration; this.packageBuilder = packageBuilder; this.packageTokeniser = packageTokeniser; this.progressNotifier = progressNotifier; this.progressNotifier.Progress += this.OnProgressUpdate; }
public PackageCreatorTasks( IArchiveBuilder archiveBuilder, ICleanUpProcessor cleanUpProcessor, IClonePackageBuilder clonePackageBuilder, IConfiguration configuration, IPackageBuilder packageBuilder, IPackageTokeniser packageTokeniser, IProgressNotifier progressNotifier) { this.archiveBuilder = archiveBuilder; this.cleanUpProcessor = cleanUpProcessor; this.clonePackageBuilder = clonePackageBuilder; this.configuration = configuration; this.packageBuilder = packageBuilder; this.packageTokeniser = packageTokeniser; this.progressNotifier = progressNotifier; this.progressNotifier.Progress += this.OnProgressUpdate; }
static IPackageBuilder AssignProperties(IPackageBuilder builder, IEnumerable <IGrouping <string, string> > properties) { var unknown = new List <KeyValuePair <string, string> >(); var builderType = builder.GetType(); foreach (var property in properties) { var pi = builderType.GetProperty(property.Key, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); if (pi != null) { bool boolProperty; if (typeof(IEnumerable <string>).IsAssignableFrom(pi.PropertyType)) { var existingValues = pi.GetValue(builder, null) as IEnumerable <string>; if (existingValues == null || existingValues.Count() == 0) { pi.SetValue(builder, property.ToList(), null); } } else if (pi.PropertyType == typeof(string) && property.Count() > 0) { pi.SetValue(builder, property.Last(), null); } else if (pi.PropertyType == typeof(bool) && property.Count() > 0 && bool.TryParse(property.Last(), out boolProperty)) { pi.SetValue(builder, boolProperty, null); } } else { unknown.AddRange(property.Select(x => new KeyValuePair <string, string>(property.Key, x))); } } var propertiesPi = builderType.GetProperty("Properties", BindingFlags.Instance | BindingFlags.Public); if (propertiesPi != null && typeof(IEnumerable <IGrouping <string, string> >).IsAssignableFrom(propertiesPi.PropertyType)) { var unknownLookup = unknown.ToLookup(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase); propertiesPi.SetValue(builder, unknownLookup, null); } return(builder); }
public SourceBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (buildReport == null) { throw new ArgumentNullException(nameof(buildReport)); } if (packageBuilder == null) { throw new ArgumentNullException(nameof(packageBuilder)); } _project = project; _packageBuilder = packageBuilder; _reports = buildReport; }
public SourceBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (buildReport == null) { throw new ArgumentNullException(nameof(buildReport)); } if (packageBuilder == null) { throw new ArgumentNullException(nameof(packageBuilder)); } _project = project; _packageBuilder = packageBuilder; _reports = buildReport; }
public CreatePackageViewModel( IArchiveBuilder archiveBuilder, ICleanUpProcessor cleanUpProcessor, IClonePackageBuilder clonePackageBuilder, IPackageBuilder packageBuilder, IPackageTokeniser packageTokeniser, IProgressNotifier progressNotifier, IWindowManager windowManager, IManageExclusionsView manageExclusionsView) { this.archiveBuilder = archiveBuilder; this.cleanUpProcessor = cleanUpProcessor; this.clonePackageBuilder = clonePackageBuilder; this.packageBuilder = packageBuilder; this.packageTokeniser = packageTokeniser; this.progressNotifier = progressNotifier; this.windowManager = windowManager; this.manageExclusionsView = manageExclusionsView; this.progressNotifier.Progress += this.OnProgressUpdate; }
private static void CopyFolderToPackage(IPackageBuilder builder, IRebelApplicationContext appContext, string rootPath, string path, Func <string, string, string> targetPathCallback) { var files = Directory.GetFiles(path); foreach (var file in files) { builder.Files.Add(new PhysicalPackageFile { SourcePath = file, TargetPath = targetPathCallback.Invoke(rootPath, file) }); } var dirs = Directory.GetDirectories(path); foreach (var dir in dirs) { CopyFolderToPackage(builder, appContext, rootPath, dir, targetPathCallback); } }
public SimplePackage(IPackageBuilder packageBuilder) { if (packageBuilder == null) { throw new ArgumentNullException("packageBuilder"); } Id = packageBuilder.Id; Version = packageBuilder.Version; Title = packageBuilder.Title; Authors = packageBuilder.Authors; Owners = packageBuilder.Owners; IconUrl = packageBuilder.IconUrl; LicenseUrl = packageBuilder.LicenseUrl; ProjectUrl = packageBuilder.ProjectUrl; RequireLicenseAcceptance = packageBuilder.RequireLicenseAcceptance; Description = packageBuilder.Description; Summary = packageBuilder.Summary; Language = packageBuilder.Language; Tags = packageBuilder.Tags; FrameworkAssemblies = packageBuilder.FrameworkAssemblies; Dependencies = packageBuilder.Dependencies; _packageBuilder = packageBuilder; }
public SimplePackage(IPackageBuilder packageBuilder) { if (packageBuilder == null) { throw new ArgumentNullException("packageBuilder"); } Id = packageBuilder.Id; Version = packageBuilder.Version; Title = packageBuilder.Title; Authors = packageBuilder.Authors; Owners = packageBuilder.Owners; IconUrl = packageBuilder.IconUrl; LicenseUrl = packageBuilder.LicenseUrl; ProjectUrl = packageBuilder.ProjectUrl; RequireLicenseAcceptance = packageBuilder.RequireLicenseAcceptance; Description = packageBuilder.Description; Summary = packageBuilder.Summary; Language = packageBuilder.Language; Tags = packageBuilder.Tags; FrameworkAssemblies = packageBuilder.FrameworkAssemblies; Dependencies = packageBuilder.Dependencies; _packageBuilder = packageBuilder; }
static IPackageBuilder AssignProperties(IPackageBuilder builder, IEnumerable<IGrouping<string, string>> properties) { var unknown = new List<KeyValuePair<string, string>>(); var builderType = builder.GetType(); foreach (var property in properties) { var pi = builderType.GetProperty(property.Key, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); if (pi != null) { bool boolProperty; if (typeof(IEnumerable<string>).IsAssignableFrom(pi.PropertyType)) { var existingValues = pi.GetValue(builder, null) as IEnumerable<string>; if (existingValues == null || existingValues.Count() == 0) pi.SetValue(builder, property.ToList(), null); } else if (pi.PropertyType == typeof(string) && property.Count() > 0) { pi.SetValue(builder, property.Last(), null); } else if (pi.PropertyType == typeof(bool) && property.Count() > 0 && bool.TryParse(property.Last(), out boolProperty)) { pi.SetValue(builder, boolProperty, null); } } else { unknown.AddRange(property.Select(x => new KeyValuePair<string, string>(property.Key, x))); } } var propertiesPi = builderType.GetProperty("Properties", BindingFlags.Instance | BindingFlags.Public); if (propertiesPi != null && typeof(IEnumerable<IGrouping<string, string>>).IsAssignableFrom(propertiesPi.PropertyType)) { var unknownLookup = unknown.ToLookup(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase); propertiesPi.SetValue(builder, unknownLookup, null); } return builder; }
IPackageBuilder AssignProperties(IPackageBuilder builder, IEnumerable<IGrouping<string,string>> properties) { foreach (var property in properties) { var pi = builder.GetType().GetProperty(property.Key, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); if (pi != null) pi.SetValue(builder, property.ToList(), null); } return builder; }
ICommandOutput CreateBuilder() { var commandLine = Environment.Descriptor.BuildCommand; if (string.IsNullOrEmpty(commandLine)) commandLine = "msbuild"; var properties = from segment in commandLine.Split(';').Skip(1) let keyValues = segment.Split('=') where keyValues.Length >= 2 let key = keyValues[0] let value = segment.Substring(key.Length + 1) group new { key, value } by key; _builder = commandLine.Trim().StartsWith("msbuild", StringComparison.OrdinalIgnoreCase) ? (IPackageBuilder)new MSBuildBuildEngine(FileSystem, Environment) : new MetaPackageBuilder(Environment); foreach(var property in properties) { var pi = _builder.GetType().GetProperty(property.Key, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); if (pi != null) pi.SetValue(_builder, property.Select(x=>x.value).ToList(), null); } return null; }
public void Construct(IPackageBuilder builder) { builder.AddSavories(); builder.AddSweets(); }
public DbImporter(IMapper mapper, DbImporterConfig config, IPackageBuilder builder, ThreadSafeRandom rnd) : base(mapper, config, builder, rnd) { }
IEnumerable<ICommandOutput> ProcessBuildResults(IPackageBuilder packageBuilder, Action<FileBuildResult> onFound) { foreach (var t in packageBuilder.Build()) { if (t is TextBuildResult && !Quiet) yield return new GenericMessage(t.Message); else if (t is FileBuildResult) { var buildResult = (FileBuildResult)t; onFound(buildResult); yield return new GenericMessage(string.Format("Output found - {0}: '{1}'", buildResult.ExportName, buildResult.Path)); } else if (t is ErrorBuildResult) { yield return new Error(t.Message); yield break; } } }
ICommandOutput CreateBuilder() { var commandLine = Environment.Descriptor.BuildCommand; _builder = commandLine == "$meta" ? (IPackageBuilder)new MetaPackageBuilder(Environment) : new ConventionMSBuildEngine(Environment); return null; }
public override bool Execute() { if (string.IsNullOrWhiteSpace(SpecFile)) { Log.LogError(Resources.NuGetResources.SpecFileMustNotBeEmpty); return(false); } if (!_fileSystem.FileExists(SpecFile)) { Log.LogError(Resources.NuGetResources.SpecFileDoesNotExist); return(false); } if (!string.IsNullOrWhiteSpace(PackageDir) && !_fileSystem.DirectoryExists(PackageDir)) { Log.LogError(Resources.NuGetResources.PackageDirDoesNotExist); return(false); } string workingDir = _fileSystem.GetCurrentDirectory(); string packageDir = PackageDir; if (packageDir == null || string.IsNullOrWhiteSpace(packageDir)) { packageDir = workingDir; } string specFilePath = Path.Combine(workingDir, SpecFile); try { IPackageBuilder packageBuilder = _packageBuilderFactory.CreateFrom(specFilePath); packageBuilder.Files.RemoveAll(file => _fileExtensionsToIgnore.Contains(Path.GetExtension(file.Path))); string packageFile = String.Format( "{0}.{1}{2}", packageBuilder.Id, packageBuilder.Version, Constants.PackageExtension); string packageFilePath = Path.Combine(packageDir, packageFile); Log.LogMessage(String.Format( Resources.NuGetResources.CreatingPackage, _fileSystem.GetFullPath(specFilePath), _fileSystem.GetFullPath(packageFilePath))); using (Stream stream = _fileSystem.CreateFile(packageFilePath)) { packageBuilder.Save(stream); } OutputPackage = packageFilePath; Log.LogMessage(String.Format( Resources.NuGetResources.CreatedPackage, _fileSystem.GetFullPath(specFilePath), _fileSystem.GetFullPath(packageFilePath))); } catch (Exception ex) { Log.LogError(Resources.NuGetResources.UnexpectedError, ex.ToString()); return(false); } return(true); }