Пример #1
0
        IPackageInfo Publish(string packageFileName, Stream packageStream)
        {
            var fileWithoutExtension = packageFileName.Trim().ToLowerInvariant().EndsWith(".wrap")
                                               ? Path.GetFileNameWithoutExtension(packageFileName)
                                               : packageFileName;

            if (Packages.Any(x => x.FullName.EqualsNoCase(fileWithoutExtension)))
            {
                throw new InvalidOperationException("Package already exists in repository.");
            }

            var inMemoryFile = new InMemoryFile("c:\\" + Guid.NewGuid());

            using (var stream = FileExtensions.OpenWrite(inMemoryFile))
                packageStream.CopyTo(stream);

            var tempFolder = new CachedZipPackage(null, inMemoryFile, null);

            var package = new InMemoryPackage
            {
                Name         = PackageNameUtility.GetName(fileWithoutExtension),
                Version      = PackageNameUtility.GetVersion(fileWithoutExtension),
                Source       = this,
                Dependencies = tempFolder.Dependencies.ToList(),
                Anchored     = tempFolder.Anchored
            };

            Packages.Add(package);
            return(package);
        }
Пример #2
0
        IPackageInfo Publish(IPackageRepository source, string packageFileName, Stream packageStream)
        {
            var fileWithoutExtension = packageFileName.Trim().ToLowerInvariant().EndsWith(".wrap")
                                           ? System.IO.Path.GetFileNameWithoutExtension(packageFileName)
                                           : packageFileName;

            if (Packages.Any(x => x.FullName.EqualsNoCase(fileWithoutExtension)))
            {
                throw new InvalidOperationException("Package already exists in repository.");
            }

            var inMemoryFile = new InMemoryFile("c:\\" + Guid.NewGuid());

            using (var stream = inMemoryFile.OpenWrite())
                IO.StreamExtensions.CopyTo(packageStream, stream);

            var tempFolder = new ZipPackage(inMemoryFile);

            var package = new InMemoryPackage(tempFolder)
            {
                Source = this
            };

            Packages.Add(package);
            return(package);
        }
Пример #3
0
        public void given_package(string name, string version, params string[] dependencies)
        {
            InMemoryPackage package;

            Packages.Add(package = new InMemoryPackage {
                Name = name, Version = version.ToVersion(), Dependencies = dependencies.Select(DependsParser.ParseDependsValue).ToList()
            });
        }
 void Add(InMemoryRepository repository, string name, string[] dependencies)
 {
     var package = new InMemoryPackage
     {
             Name = PackageNameUtility.GetName(name),
             SemanticVersion = PackageNameUtility.GetVersion(name),
             Source = repository,
             Dependencies = dependencies.Select(DependsParser.ParseDependsLine).ToList()
     };
     repository.Packages.Add(package);
 }
        void Add(InMemoryRepository repository, string name, string[] dependencies)
        {
            var package = new InMemoryPackage
            {
                Name            = PackageNameUtility.GetName(name),
                SemanticVersion = PackageNameUtility.GetVersion(name),
                Source          = repository,
                Dependencies    = dependencies.Select(DependsParser.ParseDependsLine).ToList()
            };

            repository.Packages.Add(package);
        }
        void Add(InMemoryRepository repository, string name, string[] dependencies)
        {
            var packageNamespace = name.Contains("/") ? name.Substring(0, name.IndexOf("/")) : "global";

            name = name.Contains("/") ? name.Substring(name.IndexOf("/") + 1) : name;
            var package = new InMemoryPackage
            {
                Name         = PackageNameUtility.GetName(name),
                Version      = PackageNameUtility.GetVersion(name),
                Namespace    = packageNamespace,
                Source       = repository,
                Dependencies = dependencies.SelectMany(x => DependsParser.ParseDependsInstruction(x).Dependencies)
                               .ToList()
            };

            repository.Packages.Add(package);
        }
Пример #7
0
        void Publish(IPackageRepository source, string packageFileName, Stream packageStream)
        {
            var name    = PackageNameUtility.GetName(packageFileName);
            var version = PackageNameUtility.GetVersion(packageFileName);

            if (Packages.Any(x => x.Name.EqualsNoCase(name) && x.SemanticVersion == version))
            {
                throw new InvalidOperationException("Package already exists in repository.");
            }

            var inMemoryFile = new InMemoryFile("c:\\" + Guid.NewGuid());

            using (var stream = inMemoryFile.OpenWrite())
                IO.StreamExtensions.CopyTo(packageStream, stream);

            var tempFolder = new ZipFilePackage(inMemoryFile);

            var package = new InMemoryPackage(tempFolder)
            {
                Source = this
            };

            Packages.Add(package);
        }
 void Add(InMemoryRepository repository, string name, string[] dependencies)
 {
     var package = new InMemoryPackage
     {
         Name = PackageNameUtility.GetName(name),
         Version = PackageNameUtility.GetVersion(name),
         Source = repository,
         Dependencies = dependencies.SelectMany(x => DependsParser.ParseDependsInstruction(x).Dependencies)
                                    .ToList()
     };
     repository.Packages.Add(package);
 }
Пример #9
0
        IPackageInfo Publish(string packageFileName, Stream packageStream)
        {
            var fileWithoutExtension = packageFileName.Trim().ToLowerInvariant().EndsWith(".wrap")
                                               ? Path.GetFileNameWithoutExtension(packageFileName)
                                               : packageFileName;
            if (_packages.Any(x => x.FullName.EqualsNoCase(fileWithoutExtension)))
                throw new InvalidOperationException("Package already exists in repository.");

            var inMemoryFile = new InMemoryFile("c:\\" + Guid.NewGuid());
            using (var stream = FileExtensions.OpenWrite(inMemoryFile))
                packageStream.CopyTo(stream);

            var tempFolder = new CachedZipPackage(null, inMemoryFile, null, null);

            var package = new InMemoryPackage
            {
                    Name = PackageNameUtility.GetName(fileWithoutExtension),
                    Version = PackageNameUtility.GetVersion(fileWithoutExtension),
                    Source = this,
                    Dependencies = tempFolder.Dependencies.ToList(),
                    Anchored = tempFolder.Anchored
            };
            _packages.Add(package);
            return package;
        }
Пример #10
0
 void Add(InMemoryRepository repository, string name, string[] dependencies)
 {
     var packageNamespace = name.Contains("/") ? name.Substring(0,name.IndexOf("/")) : "global";
     name = name.Contains("/") ? name.Substring(name.IndexOf("/") + 1) : name;
     var package = new InMemoryPackage
     {
             Name = PackageNameUtility.GetName(name),
             Version = PackageNameUtility.GetVersion(name),
             Namespace = packageNamespace,
             Source = repository,
             Dependencies = dependencies.SelectMany(x => DependsParser.ParseDependsInstruction(x).Dependencies)
                     .ToList()
     };
     repository.Packages.Add(package);
 }
Пример #11
0
 public IPackageInfo Publish(string packageFileName, Stream packageStream)
 {
     var package = new InMemoryPackage
     {
         Name = WrapNameUtility.GetName(packageFileName),
         Version = WrapNameUtility.GetVersion(packageFileName)
     };
     Packages.Add(package);
     return package;
 }
Пример #12
0
 void Add(InMemoryRepository repository, string name, string[] dependencies)
 {
     var package = new InMemoryPackage
     {
         Name = WrapNameUtility.GetName(name),
         Version = WrapNameUtility.GetVersion(name),
         Source = repository,
         Dependencies = dependencies.Select(x =>
             WrapDependencyParser.ParseDependency(x)).ToList()
     };
     repository.Packages.Add(package);
 }