Example #1
0
        static string BuildPackagesDirectory([NotNull] ISnapFilesystem filesystem, [NotNull] string workingDirectory, [NotNull] SnapAppsGeneric snapAppsGeneric,
                                             [NotNull] SnapApp snapApp)
        {
            if (filesystem == null)
            {
                throw new ArgumentNullException(nameof(filesystem));
            }
            if (workingDirectory == null)
            {
                throw new ArgumentNullException(nameof(workingDirectory));
            }
            if (snapAppsGeneric == null)
            {
                throw new ArgumentNullException(nameof(snapAppsGeneric));
            }
            if (snapApp == null)
            {
                throw new ArgumentNullException(nameof(snapApp));
            }

            var properties = new Dictionary <string, string>
            {
                { "id", snapApp.Id },
                { "rid", snapApp.Target.Rid }
            };

            return(snapAppsGeneric.Packages == null?
                   filesystem.PathCombine(workingDirectory, ".snapx", "packages", "$id$/$rid$").ExpandProperties(properties) :
                       filesystem.PathGetFullPath(snapAppsGeneric.Packages).ExpandProperties(properties));
        }
Example #2
0
        static string BuildArtifactsDirectory([NotNull] ISnapFilesystem filesystem, [NotNull] string workingDirectory, [NotNull] SnapAppsGeneric snapAppsGeneric,
                                              [NotNull] SnapApp snapApp)
        {
            if (filesystem == null)
            {
                throw new ArgumentNullException(nameof(filesystem));
            }
            if (workingDirectory == null)
            {
                throw new ArgumentNullException(nameof(workingDirectory));
            }
            if (snapAppsGeneric == null)
            {
                throw new ArgumentNullException(nameof(snapAppsGeneric));
            }
            if (snapApp == null)
            {
                throw new ArgumentNullException(nameof(snapApp));
            }

            var properties = new Dictionary <string, string>
            {
                { "id", snapApp.Id },
                { "rid", snapApp.Target.Rid },
                { "version", snapApp.Version.ToNormalizedString() }
            };

            return(snapAppsGeneric.Artifacts == null?
                   filesystem.PathCombine(workingDirectory, ".snapx", "artifacts", "$id$/$rid$/$version$").ExpandProperties(properties) :
                       filesystem.PathCombine(workingDirectory, snapAppsGeneric.Artifacts.ExpandProperties(properties)));
        }