/// <summary>Initializes a new instance of the <see cref="JackrabbitLibrary" /> class.</summary>
 /// <param name="fileType">The type of file</param>
 /// <param name="libraryName">The name of the library.</param>
 /// <param name="version">The version.</param>
 /// <param name="specificity">The version specificity.</param>
 public JackrabbitLibrary(FileType fileType, string libraryName, Version version, SpecificVersion specificity)
 {
     this.FileType = fileType;
     this.LibraryName = libraryName;
     this.Version = version;
     this.Specificity = specificity;
 }
Esempio n. 2
0
 public PackageMetaData(SpecificVersion fullyQualifiedName)
     : base(fullyQualifiedName)
 {
     Files       = new Dictionary <string, string>();
     Licenses    = new List <string>();
     ReleaseType = string.Empty;
     ContentType = string.Empty;
 }
Esempio n. 3
0
        public void Test()
        {
            var v  = "@ares-1.8.1";
            var sv = new SpecificVersion(v);

            Console.WriteLine(sv);
            Console.WriteLine(sv.VersionData);
        }
Esempio n. 4
0
 public void DeletePackageIfExists(SpecificVersion package, bool inclWorkFiles = false,
                                   bool inclDependencies = false)
 {
     if (Repo.HasPackage(package))
     {
         DeletePackage(package, inclWorkFiles, inclDependencies);
     }
 }
Esempio n. 5
0
 public Package Init(Repository repo, SpecificVersion version, IAbsoluteDirectoryPath directory)
 {
     if (version == null)
     {
         throw new ArgumentNullException(nameof(version));
     }
     return(Init(repo, directory, new PackageMetaData(version)));
 }
Esempio n. 6
0
 public async Task Deversion(SpecificVersion nextInline, string registerKey) {
     using (var r =
         await
             Tools.Transfer.PostJson(new {nextInline.Name, nextInline.VersionData},
                 Tools.Transfer.JoinUri(CommonUrls.PublishApiUrl,
                     "api/v2/publishing/mods_deversion?registerKey=" + Uri.EscapeDataString(registerKey)))
                 .ConfigureAwait(false))
         r.EnsureSuccessStatusCode();
 }
Esempio n. 7
0
        /// <summary>
        ///     adds a request for a script into the page items collection
        /// </summary>
        /// <param name="jsname">the library name</param>
        public static void RequestRegistration(String jsname, Version version, SpecificVersion specific)
        {
            JavaScriptLibrary library;
            bool isProcessed = false;

            switch (specific)
            {
            case SpecificVersion.Latest:
                library = GetHighestVersionLibrary(jsname);
                AddItemRequest(library.JavaScriptLibraryID);
                isProcessed = true;
                break;

            case SpecificVersion.LatestMajor:
                library =
                    JavaScriptLibraryController.Instance.GetLibraries(l => l.LibraryName == jsname)
                    .OrderByDescending(l => l.Version).FirstOrDefault(l => l.Version.Major >= version.Major);
                if (library != null)
                {
                    AddItemRequest(library.JavaScriptLibraryID);
                }
                else
                {
                    //unable to find a higher major version
                    library = GetHighestVersionLibrary(jsname);
                    AddItemRequest(library.JavaScriptLibraryID);
                    LogCollision("Requested:" + jsname + ":" + version + ":" + specific + ".Resolved:" +
                                 library.Version);
                }
                isProcessed = true;
                break;

            case SpecificVersion.LatestMinor:
                library =
                    JavaScriptLibraryController.Instance.GetLibraries(l => l.LibraryName == jsname)
                    .OrderByDescending(l => l.Version).FirstOrDefault(l => l.Version.Minor >= version.Minor);
                if (library != null)
                {
                    AddItemRequest(library.JavaScriptLibraryID);
                }
                else
                {
                    //unable to find a higher minor version
                    library = GetHighestVersionLibrary(jsname);
                    AddItemRequest(library.JavaScriptLibraryID);
                    LogCollision("Requested:" + jsname + ":" + version + ":" + specific + ".Resolved:" +
                                 library.Version);
                }
                isProcessed = true;
                break;
            }
            if (isProcessed == false)
            {
                //this should only occur if packages are incorrect or a RequestRegistration call has a typo
                LogCollision(String.Format("Missing specific version library - {0},{1},{2}", jsname, version, specific));
            }
        }
Esempio n. 8
0
 public Bundle(SpecificVersion version) : base(version)
 {
     Required        = new Dictionary <string, string>();
     RequiredClients = new Dictionary <string, string>();
     RequiredServers = new Dictionary <string, string>();
     Optional        = new Dictionary <string, string>();
     OptionalClients = new Dictionary <string, string>();
     OptionalServers = new Dictionary <string, string>();
 }
Esempio n. 9
0
        public void Version_Specific_IsNotGreaterThanOrEqual(int major, int minor, int patch)
        {
            SpecificVersion a = new SpecificVersion {
                Major = major, Minor = minor, Patch = patch
            };
            SpecificVersion b = new SpecificVersion {
                Major = 1, Minor = 5, Patch = 5
            };

            Assert.False(a >= b);
        }
Esempio n. 10
0
        public void Verion_Fuzzy_SpecificIsLessThanFuzzy()
        {
            SpecificVersion a = new SpecificVersion {
                Major = 1, Minor = 5, Patch = 5
            };
            FuzzyVersion b = new FuzzyVersion {
                Major = 1, Minor = 5, Patch = null
            };

            Assert.True(a <= b);
        }
Esempio n. 11
0
        public void Verion_Fuzzy_FuzzyIsNotLessThanSpecific()
        {
            FuzzyVersion a = new FuzzyVersion {
                Major = 1, Minor = 5, Patch = null
            };
            SpecificVersion b = new SpecificVersion {
                Major = 1, Minor = 5, Patch = 5
            };

            Assert.False(a <= b);
        }
Esempio n. 12
0
        public void Verion_Fuzzy_SpecificIsNotGreaterThanFuzzy()
        {
            SpecificVersion a = new SpecificVersion {
                Major = 1, Minor = 5, Patch = 5
            };
            FuzzyVersion b = new FuzzyVersion {
                Major = 1, Minor = 5, Patch = null
            };

            Assert.False(a >= b);
        }
Esempio n. 13
0
        public void Verion_Fuzzy_FuzzyIsGreaterThanSpecific()
        {
            FuzzyVersion a = new FuzzyVersion {
                Major = 1, Minor = 5, Patch = null
            };
            SpecificVersion b = new SpecificVersion {
                Major = 1, Minor = 5, Patch = 5
            };

            Assert.True(a >= b);
        }
Esempio n. 14
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ DateToRetain.GetHashCode();
         hashCode = (hashCode * 397) ^ DeletePriorVersions.GetHashCode();
         hashCode = (hashCode * 397) ^ SpecificVersion.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 15
0
        public void Version_Specific_IsLessThanOrEqual(int major, int minor, int patch)
        {
            SpecificVersion a = new SpecificVersion {
                Major = major, Minor = minor, Patch = patch
            };
            SpecificVersion b = new SpecificVersion {
                Major = 1, Minor = 5, Patch = 5
            };

            Assert.True(a <= b);
        }
Esempio n. 16
0
        Task GetPackage(SpecificVersion package)
        {
            var packageName = package.GetFullName();
            var remotes     = FindRemotesWithPackage(package.Name).ToArray();

            Repository.Log("\nFetching package: {0} ({1})", package.Name, packageName);
            if (!remotes.Any())
            {
                throw new NoSourceFoundException("No source found with " + package.Name);
            }

            return(Repo.DownloadPackage(packageName, remotes, StatusRepo.CancelToken));
        }
Esempio n. 17
0
        Task GetBundle(SpecificVersion bundle)
        {
            var bundleName = bundle.GetFullName();
            var remotes    = FindRemotesWithBundle(bundle.Name).ToArray();

            Repository.Log("Fetching bundle: {0} ({1})", bundle.Name, bundleName);
            if (!remotes.Any())
            {
                throw new NoSourceFoundException("No source found with " + bundle.Name);
            }

            return(Repo.DownloadBundle(bundleName, remotes, PackageManager.StatusRepo.CancelToken));
        }
Esempio n. 18
0
        public SpecificVersion GetPackage(SpecificVersion package) {
            lock (Packages) {
                if (!Packages.ContainsKey(package.Name))
                    return null;
                var packages = Packages[package.Name];

                if (package.Version == null && package.Branch == null)
                    return GetLatest(package, packages);

                if (packages.Contains(package.VersionData))
                    return package;
                var m = _dependencyVersionMatcher.MatchesConstraints(packages, package.Version.ToString(),
                    package.Branch);
                return m == null ? null : new SpecificVersion(package.Name, m);
            }
        }
Esempio n. 19
0
        public async Task <Bundle> UpdateCurrent(SpecificVersion collection)
        {
            var hasBundle = Handler.Repository.HasBundle(collection);

            if (!hasBundle)
            {
                if (Handler.Remote)
                {
                    await Handler.BundleManager.GetAndAddBundle(collection).ConfigureAwait(false);
                }
                else
                {
                    collection = null;
                }
            }
            return(Current = collection != null?Handler.BundleManager.GetMetaData(collection) : null);
        }
Esempio n. 20
0
 public bool HasBundle(SpecificVersion bundle)
 {
     lock (Bundles) {
         if (!Bundles.ContainsKey(bundle.Name))
         {
             return(false);
         }
         if ((bundle.Version == null) && (bundle.Branch == null))
         {
             return(true);
         }
         var bundles = Bundles[bundle.Name];
         if (bundles.Contains(bundle.VersionData))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 21
0
        public bool AddPackage(SpecificVersion package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            lock (Packages) {
                if (!HasPackage(package))
                {
                    if (!Packages.ContainsKey(package.Name))
                    {
                        Packages.Add(package.Name, new List <string>());
                    }
                    Packages[package.Name].Add(package.VersionData);
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 22
0
        public bool AddBundle(SpecificVersion bundle)
        {
            if (bundle == null)
            {
                throw new ArgumentNullException(nameof(bundle));
            }

            lock (Bundles) {
                if (!HasBundle(bundle))
                {
                    if (!Bundles.ContainsKey(bundle.Name))
                    {
                        Bundles.Add(bundle.Name, new List <string>());
                    }
                    Bundles[bundle.Name].Add(bundle.VersionData);
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 23
0
        public bool RemoveBundle(SpecificVersion bundle)
        {
            if (bundle == null)
            {
                throw new ArgumentNullException(nameof(bundle));
            }

            lock (Bundles) {
                if (HasBundle(bundle))
                {
                    var bundles = Bundles[bundle.Name];
                    bundles.Remove(bundle.VersionData);
                    if (!bundles.Any())
                    {
                        Bundles.Remove(bundle.Name);
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 24
0
        public SpecificVersion GetPackage(SpecificVersion package)
        {
            lock (Packages) {
                if (!Packages.ContainsKey(package.Name))
                {
                    return(null);
                }
                var packages = Packages[package.Name];

                //if (package.Version == null && package.Branch == null)
                //  return GetLatest(package, packages);

                if (packages.Contains(package.VersionData))
                {
                    return(package);
                }
                var m = _dependencyVersionMatcher.MatchesConstraints(packages, package.Version.ToString(),
                                                                     package.Branch);
                return(m == null ? null : new SpecificVersion(package.Name, m));
            }
        }
Esempio n. 25
0
        public bool RemovePackage(SpecificVersion package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            lock (Packages) {
                if (HasPackage(package))
                {
                    var packages = Packages[package.Name];
                    packages.Remove(package.VersionData);
                    if (!packages.Any())
                    {
                        Packages.Remove(package.Name);
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 26
0
        protected MetaDataBase(SpecificVersion info)
        {
            Name    = info.Name;
            Branch  = info.Branch;
            Version = info.Version;

            Dependencies = new Dictionary <string, string>();

            Authors  = TodoAuthors.ToDictionary(x => x.Key, y => y.Key);
            Homepage = string.Empty;
            FullName = TodoFullName;

            Additional = new Dictionary <string, string>();

            Description = TodoDesc;
            Summary     = TodoSummary;

            Tags = new List <string>();

            Date = Tools.Generic.GetCurrentDateTime;
        }
Esempio n. 27
0
        async Task ResolveDependencies(List <string> list, List <string> list2, List <Package> packages,
                                       SpecificVersion depInfo, List <SpecificVersion> done, bool useFullName = false, bool noCheckout = false)
        {
            if (!noCheckout && list.Contains(depInfo.Name.ToLower()))
            {
                Repository.Log("Conflicting package, not resolving {0}", depInfo);
                return;
            }
            var name = depInfo.GetFullName();

            if (list2.Contains(name))
            {
                Repository.Log("Duplicate package, skipping {0}", name);
                return;
            }
            list2.Add(name);

            if (!done.Contains(depInfo))
            {
                await GetAndAddPackage(depInfo).ConfigureAwait(false);

                done.Add(depInfo);
            }

            var package = Package.Factory.Open(Repo,
                                               WorkDir.GetChildDirectoryWithName(useFullName ? name : depInfo.Name), name);

            list.Add(depInfo.Name);
            packages.Add(package);

            // TODO: Higher level policy can be overwritten by dependencies (e.g specified dependency contraints). We dont want this.
            foreach (var dep in package.MetaData.GetDependencies())
            {
                await
                ResolveDependencies(list, list2, packages, ResolvePackageName(dep.GetFullName()), done, useFullName,
                                    noCheckout).ConfigureAwait(false);
            }

            OrderPackageLast(list, packages, package);
        }
Esempio n. 28
0
 IAbsoluteFilePath GetPackageMetadataPath(SpecificVersion arg) {
     return Repo.PackagesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat);
 }
Esempio n. 29
0
 public void DeletePackageIfExists(SpecificVersion package, bool inclWorkFiles = false,
     bool inclDependencies = false) {
     if (Repo.HasPackage(package))
         DeletePackage(package, inclWorkFiles, inclDependencies);
 }
Esempio n. 30
0
 public async Task GetAndAddPackage(SpecificVersion package) {
     //Somewhere here we will need to specify what we will be doing with the package.
     await GetPackage(package).ConfigureAwait(false);
     Repo.AddPackage(package.GetFullName());
 }
Esempio n. 31
0
 public Bundle GetMetaData(SpecificVersion arg) {
     return
         Bundle.Factory.Open(Repo.BundlesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat));
 }
Esempio n. 32
0
        public bool AddBundle(SpecificVersion bundle) {
            Contract.Requires<ArgumentNullException>(bundle != null);

            lock (Bundles) {
                if (!HasBundle(bundle)) {
                    if (!Bundles.ContainsKey(bundle.Name))
                        Bundles.Add(bundle.Name, new List<string>());
                    Bundles[bundle.Name].Add(bundle.VersionData);
                    return true;
                }
            }
            return false;
        }
Esempio n. 33
0
 public bool HasBundle(SpecificVersion bundle) {
     lock (Bundles) {
         if (!Bundles.ContainsKey(bundle.Name))
             return false;
         if (bundle.Version == null && bundle.Branch == null)
             return true;
         var bundles = Bundles[bundle.Name];
         if (bundles.Contains(bundle.VersionData))
             return true;
     }
     return false;
 }
Esempio n. 34
0
        public bool AddPackage(SpecificVersion package) {
            Contract.Requires<ArgumentNullException>(package != null);

            lock (Packages) {
                if (!HasPackage(package)) {
                    if (!Packages.ContainsKey(package.Name))
                        Packages.Add(package.Name, new List<string>());
                    Packages[package.Name].Add(package.VersionData);
                    return true;
                }
            }
            return false;
        }
 public ContentInstalledState(SpecificVersion version, IAbsoluteDirectoryPath directory) {
     Version = version;
     Directory = directory;
 }
Esempio n. 36
0
 /// <summary>
 ///     adds a request for a script into the page items collection
 /// </summary>
 /// <param name="jsname">the library name</param>
 public static void RequestRegistration(String jsname, Version version, SpecificVersion specific)
 {
     JavaScriptLibrary library;
     bool isProcessed = false;
     switch (specific)
     {
         case SpecificVersion.Latest:
             library = GetHighestVersionLibrary(jsname);
             AddItemRequest(library.JavaScriptLibraryID);
             isProcessed = true;
             break;
         case SpecificVersion.LatestMajor:
             library =
                 JavaScriptLibraryController.Instance.GetLibraries(l => l.LibraryName == jsname)
                     .OrderByDescending(l => l.Version).FirstOrDefault(l => l.Version.Major >= version.Major);
             if (library != null)
             {
                 AddItemRequest(library.JavaScriptLibraryID);
             }
             else
             {
                 //unable to find a higher major version
                 library = GetHighestVersionLibrary(jsname);
                 AddItemRequest(library.JavaScriptLibraryID);
                 LogCollision("Requested:" + jsname + ":" + version + ":" + specific + ".Resolved:" +
                              library.Version);
             }
             isProcessed = true;
             break;
         case SpecificVersion.LatestMinor:
             library =
                 JavaScriptLibraryController.Instance.GetLibraries(l => l.LibraryName == jsname)
                     .OrderByDescending(l => l.Version).FirstOrDefault(l => l.Version.Minor >= version.Minor);
             if (library != null)
             {
                 AddItemRequest(library.JavaScriptLibraryID);
             }
             else
             {
                 //unable to find a higher minor version
                 library = GetHighestVersionLibrary(jsname);
                 AddItemRequest(library.JavaScriptLibraryID);
                 LogCollision("Requested:" + jsname + ":" + version + ":" + specific + ".Resolved:" +
                              library.Version);
             }
             isProcessed = true;
             break;
     }
     if (isProcessed == false)
     {
         //this should only occur if packages are incorrect or a RequestRegistration call has a typo
         LogCollision(String.Format("Missing specific version library - {0},{1},{2}", jsname, version, specific));
     }
 }
Esempio n. 37
0
 /// <summary>Requests that a script from a JavaScript Library be registered on the client browser.</summary>
 /// <param name="name">The name of the JavaScript Library.</param>
 /// <param name="version">The library's version.</param>
 /// <param name="specificVersion">
 /// How much of the <paramref name="version"/> to pay attention to.
 /// When <see cref="SpecificVersion.Latest"/> is passed, ignore the <paramref name="version"/>.
 /// When <see cref="SpecificVersion.LatestMajor"/> is passed, match the major version.
 /// When <see cref="SpecificVersion.LatestMinor"/> is passed, match the major and minor versions.
 /// When <see cref="SpecificVersion.Exact"/> is passed, match all parts of the version.
 /// </param>
 public void JavaScriptLibraryInclude(string name, Version version, SpecificVersion specificVersion)
 {
     JavaScript.RequestRegistration(name, version, specificVersion);
 }
        async Task ResolveDependencies(List<string> list, List<string> list2, List<Package> packages,
            SpecificVersion depInfo, List<SpecificVersion> done, bool useFullName = false, bool noCheckout = false) {
            if (!noCheckout && list.Contains(depInfo.Name.ToLower())) {
                Repository.Log("Conflicting package, not resolving {0}", depInfo);
                return;
            }
            var name = depInfo.GetFullName();
            if (list2.Contains(name)) {
                Repository.Log("Duplicate package, skipping {0}", name);
                return;
            }
            list2.Add(name);

            if (!done.Contains(depInfo)) {
                await GetAndAddPackage(depInfo).ConfigureAwait(false);
                done.Add(depInfo);
            }

            var package = Package.Factory.Open(Repo,
                WorkDir.GetChildDirectoryWithName(useFullName ? name : depInfo.Name), name);
            list.Add(depInfo.Name);
            packages.Add(package);

            // TODO: Higher level policy can be overwritten by dependencies (e.g specified dependency contraints). We dont want this.
            foreach (var dep in package.MetaData.GetDependencies())
                await
                    ResolveDependencies(list, list2, packages, ResolvePackageName(dep.GetFullName()), done, useFullName,
                        noCheckout).ConfigureAwait(false);

            OrderPackageLast(list, packages, package);
        }
 public bool HasPackage(SpecificVersion package) => GetPackage(package) != null;
Esempio n. 40
0
        Task GetBundle(SpecificVersion bundle) {
            var bundleName = bundle.GetFullName();
            var remotes = FindRemotesWithBundle(bundle.Name).ToArray();
            Repository.Log("Fetching bundle: {0} ({1})", bundle.Name, bundleName);
            if (!remotes.Any())
                throw new NoSourceFoundException("No source found with " + bundle.Name);

            return Repo.DownloadBundle(bundleName, remotes, PackageManager.StatusRepo.CancelToken);
        }
 /// <summary>Initializes a new instance of the <see cref="LibraryViewModel" /> class.</summary>
 /// <param name="fileType">Type of the file.</param>
 /// <param name="id">The ID of the file.</param>
 /// <param name="pathPrefixName">Name of the path prefix.</param>
 /// <param name="filePath">The file path.</param>
 /// <param name="fullFilePath">The file path combined with the prefix.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="priority">The priority.</param>
 public LibraryViewModel(FileType fileType, int id, string pathPrefixName, string filePath, string fullFilePath, string provider, int priority, string libraryName, string version, SpecificVersion specificity)
 {
     this.FileType = fileType;
     this.Id = id;
     this.PathPrefixName = pathPrefixName;
     this.FilePath = filePath;
     this.FullFilePath = fullFilePath;
     this.Provider = provider;
     this.Priority = priority;
     this.LibraryName = libraryName;
     this.Version = version;
     this.Specificity = specificity;
 }
Esempio n. 42
0
 public bool HasPackage(SpecificVersion package) {
     return GetPackage(package) != null;
 }
Esempio n. 43
0
        public bool RemovePackage(SpecificVersion package) {
            Contract.Requires<ArgumentNullException>(package != null);

            lock (Packages) {
                if (HasPackage(package)) {
                    var packages = Packages[package.Name];
                    packages.Remove(package.VersionData);
                    if (!packages.Any())
                        Packages.Remove(package.Name);
                    return true;
                }
            }
            return false;
        }
Esempio n. 44
0
        /// <summary>Requests a script to be added to the page</summary>
        /// <param name="jsname">the library name</param>
        /// <param name="version">the library's version</param>
        /// <param name="specific">
        /// how much of the <paramref name="version"/> to pay attention to.
        /// When <see cref="SpecificVersion.Latest"/> is passed, ignore the <paramref name="version"/>.
        /// When <see cref="SpecificVersion.LatestMajor"/> is passed, match the major version.
        /// When <see cref="SpecificVersion.LatestMinor"/> is passed, match the major and minor versions.
        /// When <see cref="SpecificVersion.Exact"/> is passed, match all parts of the version.
        /// </param>
        public static void RequestRegistration(string jsname, Version version, SpecificVersion specific)
        {
            switch (specific)
            {
                case SpecificVersion.Latest:
                    RequestHighestVersionLibraryRegistration(jsname);
                    return;
                case SpecificVersion.LatestMajor:
                case SpecificVersion.LatestMinor:
                    if (RequestLooseVersionLibraryRegistration(jsname, version, specific)) 
                    {
                        return;
                    }

                    break;
                case SpecificVersion.Exact:
                    RequestSpecificVersionLibraryRegistration(jsname, version);
                    return;
            }

            //this should only occur if packages are incorrect or a RequestRegistration call has a typo
            LogCollision(String.Format("Missing specific version library - {0},{1},{2}", jsname, version, specific));
        }
Esempio n. 45
0
        public SpecificVersion GetBundle(SpecificVersion bundle) {
            lock (Bundles) {
                if (!Bundles.ContainsKey(bundle.Name))
                    return null;
                var bundles = Bundles[bundle.Name];

                if (!bundles.Any())
                    return null;

                if (bundle.Version == null && bundle.Branch == null)
                    return new SpecificVersion(bundle.Name, Dependency.FindLatestPreferNonBranched(bundles));

                if (bundles.Contains(bundle.VersionData))
                    return new SpecificVersion(bundle.GetFullName());

                var m = _dependencyVersionMatcher.MatchesConstraints(bundles, bundle.Version.ToString(), bundle.Branch);
                return m == null ? null : new SpecificVersion(bundle.Name, m);
            }
        }
Esempio n. 46
0
 public Task<Package[]> ProcessPackage(SpecificVersion package, bool? useFullNameOverride = null,
     bool noCheckout = false, bool skipWhenFileMatches = true) {
     return ProcessPackage(package.ToDependency(), useFullNameOverride, noCheckout, skipWhenFileMatches);
 }
Esempio n. 47
0
        public bool RemoveBundle(SpecificVersion bundle) {
            Contract.Requires<ArgumentNullException>(bundle != null);

            lock (Bundles) {
                if (HasBundle(bundle)) {
                    var bundles = Bundles[bundle.Name];
                    bundles.Remove(bundle.VersionData);
                    if (!bundles.Any())
                        Bundles.Remove(bundle.Name);
                    return true;
                }
            }
            return false;
        }
Esempio n. 48
0
 public async Task GetAndAddBundle(SpecificVersion bundle) {
     await GetBundle(bundle).ConfigureAwait(false);
     Repo.AddBundle(bundle.GetFullName());
 }
 /// <summary>Initializes a new instance of the <see cref="JackrabbitLibrary" /> class.</summary>
 /// <param name="fileType">Type of the file.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="libraryName">The name of the library.</param>
 /// <param name="version">The version.</param>
 /// <param name="specificity">The version specificity.</param>
 public JackrabbitLibrary(FileType fileType, int id, string libraryName, Version version, SpecificVersion specificity)
     : this(fileType, libraryName, version, specificity)
 {
     this.Id = id;
 }
Esempio n. 50
0
 public bool HasPackage(SpecificVersion package) => GetPackage(package) != null;
Esempio n. 51
0
        private static bool RequestLooseVersionLibraryRegistration(string jsname, Version version, SpecificVersion specific) 
        {
            Func<JavaScriptLibrary, bool> isValidLibrary = specific == SpecificVersion.LatestMajor
                ? (Func<JavaScriptLibrary, bool>)(l => l.Version.Major == version.Major && l.Version.Minor >= version.Minor)
                : l => l.Version.Major == version.Major && l.Version.Minor == version.Minor && l.Version.Build >= version.Build;
            var library = JavaScriptLibraryController.Instance.GetLibraries(l => l.LibraryName.Equals(jsname, StringComparison.OrdinalIgnoreCase))
                                                              .OrderByDescending(l => l.Version)
                                                              .FirstOrDefault(isValidLibrary);
            if (library != null)
            {
                AddItemRequest(library.JavaScriptLibraryID);
                return true;
            }

            //unable to find a higher major version
            library = GetHighestVersionLibrary(jsname);
            if (library != null)
            {
                AddItemRequest(library.JavaScriptLibraryID);
                LogCollision("Requested:" + jsname + ":" + version + ":" + specific + ".Resolved:" + library.Version);
                return true;
            }

            return false;
        }
Esempio n. 52
0
        protected override string ProcessToken(JavaScriptDto model, UserInfo accessingUser, Scope accessLevel)
        {
            if (String.IsNullOrEmpty(model.JsName))
            {
                if (String.IsNullOrEmpty(model.Path))
                {
                    throw new ArgumentException("If the jsname property is not specified then the JavaScript token must specify a path or property.");
                }
                if (model.Priority == 0)
                {
                    model.Priority = (int)FileOrder.Js.DefaultPriority;
                }
                if (String.IsNullOrEmpty(model.Provider))
                {
                    ClientResourceManager.RegisterScript(_page, model.Path, model.Priority);
                }
                else
                {
                    ClientResourceManager.RegisterScript(_page, model.Path, model.Priority, model.Provider);
                }
            }
            else if (!String.IsNullOrEmpty(model.Path))
            {
                if (model.Priority == 0)
                {
                    model.Priority = (int)FileOrder.Js.DefaultPriority;
                }
                if (String.IsNullOrEmpty(model.Provider))
                {
                    ClientResourceManager.RegisterScript(_page, model.Path, model.Priority, "", model.JsName, model.Version);
                }
                else
                {
                    ClientResourceManager.RegisterScript(_page, model.Path, model.Priority, model.Provider, model.JsName, model.Version);
                }
            }
            else
            {
                Version         version  = null;
                SpecificVersion specific = SpecificVersion.Latest;
                if (!String.IsNullOrEmpty(model.Version))
                {
                    version = new Version(model.Version);

                    if (!String.IsNullOrEmpty(model.Specific))
                    {
                        switch (model.Specific)
                        {
                        case "Exact":
                            specific = SpecificVersion.Exact;
                            break;

                        case "LatestMajor":
                            specific = SpecificVersion.LatestMajor;
                            break;

                        case "LatestMinor":
                            specific = SpecificVersion.LatestMinor;
                            break;

                        default:
                            specific = SpecificVersion.Latest;
                            break;
                        }
                    }
                }
                JavaScript.RequestRegistration(model.JsName, version, specific);
            }

            return(String.Empty);
        }
Esempio n. 53
0
        Task GetPackage(SpecificVersion package) {
            var packageName = package.GetFullName();
            var remotes = FindRemotesWithPackage(package.Name).ToArray();
            Repository.Log("\nFetching package: {0} ({1})", package.Name, packageName);
            if (!remotes.Any())
                throw new NoSourceFoundException("No source found with " + package.Name);

            return Repo.DownloadPackage(packageName, remotes, StatusRepo.CancelToken);
        }
Esempio n. 54
0
 public void Test() {
     var v = "@ares-1.8.1";
     var sv = new SpecificVersion(v);
     Console.WriteLine(sv);
     Console.WriteLine(sv.VersionData);
 }
Esempio n. 55
0
 public void DeletePackage(SpecificVersion package, bool inclWorkFiles = false,
     bool inclDependencies = false) {
     Repo.DeletePackage(package, inclWorkFiles, inclDependencies);
     Repo.RemoveObsoleteObjects();
     Repo.Save();
 }
Esempio n. 56
0
        public async Task GetAndAddBundle(SpecificVersion bundle)
        {
            await GetBundle(bundle).ConfigureAwait(false);

            Repo.AddBundle(bundle.GetFullName());
        }
Esempio n. 57
0
 public PackageMetaData GetMetaData(SpecificVersion arg) {
     return Package.Load(GetPackageMetadataPath(arg));
 }
Esempio n. 58
0
 public Bundle GetMetaData(SpecificVersion arg)
 => Bundle.Factory.Open(Repo.BundlesPath.GetChildFileWithName(arg.GetFullName() + Repository.PackageFormat));
Esempio n. 59
0
        private static bool RequestLooseVersionLibraryRegistration(string jsname, Version version, SpecificVersion specific)
        {
            Func <JavaScriptLibrary, bool> isValidLibrary = specific == SpecificVersion.LatestMajor
                ? (Func <JavaScriptLibrary, bool>)(l => l.Version.Major == version.Major && l.Version.Minor >= version.Minor)
                : l => l.Version.Major == version.Major && l.Version.Minor == version.Minor && l.Version.Build >= version.Build;
            var library = JavaScriptLibraryController.Instance.GetLibraries(l => l.LibraryName.Equals(jsname, StringComparison.OrdinalIgnoreCase))
                          .OrderByDescending(l => l.Version)
                          .FirstOrDefault(isValidLibrary);

            if (library != null)
            {
                AddItemRequest(library.JavaScriptLibraryID);
                return(true);
            }

            // unable to find a higher major version
            library = GetHighestVersionLibrary(jsname);
            if (library != null)
            {
                AddItemRequest(library.JavaScriptLibraryID);
                LogCollision("Requested:" + jsname + ":" + version + ":" + specific + ".Resolved:" + library.Version);
                return(true);
            }

            return(false);
        }
Esempio n. 60
0
 public Package Init(Repository repo, SpecificVersion version, IAbsoluteDirectoryPath directory) {
     Contract.Requires<ArgumentNullException>(version != null);
     return Init(repo, directory, new PackageMetaData(version));
 }