Example #1
0
 private static PackageManager CreatePackageManager(DirectoryPath packagePath)
 {
     var repository = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");
     var resolver = new PackagePathResolver(packagePath);
     var fileSystem = new PhysicalFileSystem(packagePath.FullPath);
     return new PackageManager(repository, resolver, fileSystem);
 }
Example #2
0
        public static void GitPush(
            this ICakeContext context,
            DirectoryPath repositoryDirectoryPath
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (repositoryDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryDirectoryPath));
            }

            var workFullDirectoryPath = repositoryDirectoryPath.MakeAbsolute(context.Environment);

            if (!context.FileSystem.Exist(workFullDirectoryPath))
            {
                throw new DirectoryNotFoundException($"Failed to find workDirectoryPath: {workFullDirectoryPath}");
            }

            context.UseRepository(
                repositoryDirectoryPath,
                repository =>
                    repository.Network.Push(
                        repository.Branches
                        )
                );
        }
Example #3
0
        public static void GitRemove(
            this ICakeContext context,
            DirectoryPath repositoryDirectoryPath,
            bool removeFromWorkingDirectory,
            params FilePath[] filePaths
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (repositoryDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryDirectoryPath));
            }

            context.UseRepository(
                repositoryDirectoryPath,
                repository => repository.Remove(
                    filePaths.ToRelativePathStrings(context, repositoryDirectoryPath),
                    removeFromWorkingDirectory,
                    new ExplicitPathsOptions ()
                    )
                );
        }
Example #4
0
        public IEnumerable<IFile> Install(PackageDefinition package, DirectoryPath root)
        {
            var result = new List<FilePath>();
            var paths = new FilePathCollection(PathComparer.Default);

            // InstallPackage the package.
            var packagePath = InstallPackage(package, root);
            var packageDirectory = _fileSystem.GetDirectory(packagePath);

            if (package.Filters != null && package.Filters.Count > 0)
            {
                // Get all files matching the filters.
                foreach (var filter in package.Filters)
                {
                    var pattern = string.Concat(packagePath.FullPath, "/", filter.TrimStart('/', '\\'));
                    paths.Add(_globber.GetFiles(pattern));
                }
            }
            else
            {
                // Do a recursive search in the package directory.
                paths.Add(packageDirectory.
                    GetFiles("*", SearchScope.Recursive)
                    .Select(file => file.Path));
            }

            if (paths.Count > 0)
            {
                result.AddRange(paths);
            }

            return result.Select(path => _fileSystem.GetFile(path));
        }
Example #5
0
        public static GitCommit GitCommit(
            this ICakeContext context,
            DirectoryPath repositoryDirectoryPath,
            string name,
            string email,
            string message
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (repositoryDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryDirectoryPath));
            }

            return context.UseRepository(
                repositoryDirectoryPath,
                repository => new GitCommit(
                    repository.Commit(
                        message,
                        new Signature(name, email, DateTimeOffset.Now),
                        new Signature(name, email, DateTimeOffset.Now),
                        new CommitOptions()
                        )
                    )
                );
        }
Example #6
0
        public static void GitCheckout(
            this ICakeContext context,
            DirectoryPath repositoryDirectoryPath,
            string committishOrBranchSpec,
            params FilePath[] filePaths
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (string.IsNullOrWhiteSpace(committishOrBranchSpec))
            {
                throw new ArgumentNullException(nameof(committishOrBranchSpec));
            }

            if (repositoryDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryDirectoryPath));
            }

            context.UseRepository(
                repositoryDirectoryPath,
                repository => repository.CheckoutPaths(
                    committishOrBranchSpec,
                    filePaths.ToRelativePathStrings(context, repositoryDirectoryPath),
                    new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force }
                    )
                );
        }
Example #7
0
        public static DirectoryPath GitClone(
            this ICakeContext context,
            string sourceUrl,
            DirectoryPath workDirectoryPath
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (string.IsNullOrWhiteSpace(sourceUrl))
            {
                throw new ArgumentNullException(nameof(sourceUrl));
            }

            if (workDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(workDirectoryPath));
            }

            var workFullDirectoryPath = workDirectoryPath.MakeAbsolute(context.Environment);

            if (!context.FileSystem.Exist(workFullDirectoryPath))
            {
                throw new DirectoryNotFoundException($"Failed to find workDirectoryPath: {workFullDirectoryPath}");
            }

            return Repository.Clone(sourceUrl, workFullDirectoryPath.FullPath);
        }
Example #8
0
        internal static DirectoryPath MakeRelativePath(this DirectoryPath directoryPath, ICakeEnvironment environment, DirectoryPath rootDirectoryPath)
        {
            if (directoryPath == null)
            {
                throw new ArgumentNullException(nameof(directoryPath));
            }

            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

            if (rootDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(rootDirectoryPath));
            }

            var dirUri = new Uri(directoryPath.MakeAbsolute(environment).FullPath);
            var rootUri = new Uri($"{rootDirectoryPath.MakeAbsolute(environment).FullPath}/");

            var relativeUri = rootUri.MakeRelativeUri(dirUri);
            var relativePath = Uri.UnescapeDataString(relativeUri.ToString());

            var relativeDirectoryPath = new DirectoryPath(relativePath);

            return relativeDirectoryPath;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="appPath"></param>
 public AppPathBasedIISExpressSettings(DirectoryPath appPath)
 {
     if (appPath == null)
         throw new ArgumentNullException("appPath");
     AppPath = appPath;
     PortNumber = 8080;
     ClrVersion = ClrVersion.Version40;
 }
        public void GetAllPackageReferencesForThisProject()
        {
            var d = new DirectoryPath("../../");

            var packageReferences = context.CakeContext.GetPackageReferences(d);

            Assert.IsNotEmpty(packageReferences);
        }
Example #11
0
 public static void GitCheckout(
     this ICakeContext context,
     DirectoryPath repositoryDirectoryPath,
     params FilePath[] filePaths
     )
 {
     context.GitCheckout(repositoryDirectoryPath, "HEAD", filePaths);
 }
Example #12
0
        private static IEnumerable<IFile> Install(NuGetConfiguration configuration, DirectoryPath appDataPath)
        {
            var fileSystem = new FileSystem();
            var environment = new CakeEnvironment();
            var globber = new Globber(fileSystem, environment);

            var installer = new NuGetInstaller(fileSystem, globber);
            return installer.Install(configuration, appDataPath, true);
        }
Example #13
0
        // ReSharper restore MemberCanBePrivate.Global
        // ReSharper restore UnusedAutoPropertyAccessor.Global

        /// <summary>
        /// Sync two folders content
        /// </summary>
        /// <param name="source">The source directory path.</param>
        // ReSharper disable once UnusedMember.Global
        public void Sync(DirectoryPath source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            Sync(source, Deployment.Target);
        }
        public void PackageComponentTest ()
        {
            var yaml = new DirectoryPath ("./TestProjects/ComponentPackage/");

            context.CakeContext.PackageComponent (yaml, new XamarinComponentSettings {
                ToolPath = "./TestProjects/tools/xamarin-component.exe"
            });

            Assert.IsTrue (context.CakeContext.FileExists ("./TestProjects/ComponentPackage/testcomponent-1.0.0.0.xam"));
        }
 public bool Generate(DirectoryPath path)
 {
     var version = _prober.GetVersion("Cake");
     if (string.IsNullOrWhiteSpace(version))
     {
         _log.Error("Could not resolve latest package version.");
         return false;
     }
     return Generate(path, version);
 }
Example #16
0
        public static void CMake(this ICakeContext context, DirectoryPath sourcePath, CMakeSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var runner = new CMakeRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Globber);
            runner.Run(sourcePath, settings);
        }
 public static void AliaSql(this ICakeContext context, string command,
     string connectionString, string databaseName, DirectoryPath scriptsPath)
 {
     AliaSql(context, new AliaSqlSettings
     {
         Command = command,
         ConnectionString = connectionString,
         DatabaseName = databaseName,
         ScriptsFolder = scriptsPath
     });
 }
Example #18
0
        public BlogIndex Parse(DirectoryPath path)
        {
            var directory = _fileSystem.GetDirectory(path);
            if (!directory.Exists)
            {
                return new BlogIndex(Enumerable.Empty<BlogPost>());
            }

            var posts = new List<BlogPost>();
            var files = directory.GetFiles("*", SearchScope.Current);
            foreach (var file in files)
            {
                var filename = BlogFilename.Parse(file.Path);
                if (filename != null)
                {
                    // Read the file.
                    var content = _parser.Parse(file.Path);
                    if (!content.FrontMatter.ContainsKey("content-type"))
                    {
                        content.FrontMatter.Add("content-type", "markdown");
                    }

                    // Process the content.
                    var body = _processor.PreProcess(content.Body);
                    body = _converter.ConvertToHtml(content, body);
                    body = _processor.PostProcess(body) ?? body;

                    // Get the excerpts.
                    var excerpts = _converter.ConvertToHtml(content, content.Excerpt);

                    // Rewrite the feed body.
                    // This is kind of a hack, but we need to make sure that all links are absolute.
                    var feedBody = RewriteRelativeLinks(body);

                    var author = content.GetFrontMatter("author");

                    // Add the blog post.
                    posts.Add(new BlogPost(filename.Slug,
                        content.GetFrontMatter("title"), body, feedBody, excerpts, filename.PostedAt,
                        GetCategories(content), author == null ? "Cake Team" : author));
                }
            }

            // Hack. Don't judge me... :)
            var maxDate = posts.Max(x => x.PostedAt);
            var lastPost = posts.FirstOrDefault(x => x.PostedAt == maxDate);
            if (lastPost != null)
            {
                lastPost.IsLatest = true;
            }

            return new BlogIndex(posts);
        }
Example #19
0
        public void Setup ()
        {
            context = new FakeCakeContext ();

            var dp = new DirectoryPath ("./testdata");
            var d = context.CakeContext.FileSystem.GetDirectory (dp);

            if (d.Exists)
                d.Delete (true);

            d.Create ();
        }
 public static void AliaSql(this ICakeContext context, string command,
     string connectionString, string databaseName, DirectoryPath scriptsPath, string username, string password)
 {
     AliaSql(context, new AliaSqlSettings
     {
         Command = command,
         ConnectionString = connectionString,
         DatabaseName = databaseName,
         ScriptsFolder = scriptsPath,
         UserName =  username,
         Password = password
     });
 }
        /// <summary>
        /// Sets the working directory for the process to be started.
        /// </summary>
        /// <param name="settings">The process settings.</param>
        /// <param name="path">The working directory for the process to be started.</param>
        /// <returns>The same <see cref="AdvProcessSettings"/> instance so that multiple calls can be chained.</returns>
        public static AdvProcessSettings UseWorkingDirectory(this AdvProcessSettings settings, DirectoryPath path)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            settings.WorkingDirectory = path;
            return settings;
        }
Example #22
0
        public static DirectoryPath GitClone(
            this ICakeContext context,
            string sourceUrl,
            DirectoryPath workDirectoryPath,
            string username,
            string password
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (string.IsNullOrWhiteSpace(sourceUrl))
            {
                throw new ArgumentNullException(nameof(sourceUrl));
            }

            if (string.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentNullException(nameof(username));
            }

            if (string.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentNullException(nameof(password));
            }

            if (workDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(workDirectoryPath));
            }

            var workFullDirectoryPath = workDirectoryPath.MakeAbsolute(context.Environment);

            if (!context.FileSystem.Exist(workFullDirectoryPath))
            {
                throw new DirectoryNotFoundException($"Failed to find workDirectoryPath: {workFullDirectoryPath}");
            }

            var options = new CloneOptions
            {
                CredentialsProvider =
                    (url, user, cred) => new UsernamePasswordCredentials {Username = username, Password = password}
            };

            return Repository.Clone(sourceUrl, workFullDirectoryPath.FullPath, options);
        }
        public FakeCakeContext ()
        {
            testsDir = new DirectoryPath (
                System.IO.Path.GetFullPath (AppDomain.CurrentDomain.BaseDirectory));
            
            var fileSystem = new FileSystem ();
            var environment = new CakeEnvironment ();
            var globber = new Globber (fileSystem, environment);
            log = new FakeLog ();
            var args = new FakeCakeArguments ();
            var processRunner = new ProcessRunner (environment, log);
            var registry = new WindowsRegistry ();

            context = new CakeContext (fileSystem, environment, globber, log, args, processRunner, registry);
            context.Environment.WorkingDirectory = testsDir;
        }
Example #24
0
 private TopicTree Read(DirectoryPath root, Stream stream)
 {
     var result = new List<TopicSection>();
     var reader = new XmlTextReader(stream);
     while (reader.Read())
     {
         if (reader.IsStartElement() && reader.Name == "section")
         {
             var section = ReadSection(reader, root);
             if (section != null)
             {
                 result.Add(section);
             }
         }
     }
     return new TopicTree(result);
 }
Example #25
0
        public DirectoryPath InstallPackage(PackageDefinition package, DirectoryPath root)
        {
            var packagePath = root.Combine("libs");
            if (!_fileSystem.Exist(packagePath))
            {
                _fileSystem.GetDirectory(packagePath).Create();
            }

            if (!_fileSystem.Exist(packagePath.Combine(package.PackageName)))
            {
                var packageManager = CreatePackageManager(packagePath);
                packageManager.InstallPackage(package.PackageName);
            }

            // Return the installation directory.
            return packagePath.Combine(package.PackageName);
        }
Example #26
0
        /// <summary>
        /// Sync two folders content
        /// </summary>
        /// <param name="source">The source directory path.</param>
        /// <param name="target">The target directory path.</param>
        // ReSharper disable once UnusedMember.Global
        // ReSharper disable once MemberCanBePrivate.Global
        public void Sync(DirectoryPath source, DirectoryPath target)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            Sync(source, target, new KuduSyncSettings
            {
                PreviousManifest = Deployment.PreviousManifest,
                NextManifest = Deployment.NextManifest
            });
        }
Example #27
0
 public FakeCakeContext ()
 {
     testsDir = new DirectoryPath (
         System.IO.Path.GetFullPath (AppDomain.CurrentDomain.BaseDirectory));
     
     var fileSystem = new FileSystem ();
     var environment = new CakeEnvironment (new CakePlatform (), new CakeRuntime ());
     var globber = new Globber (fileSystem, environment);
     log = new FakeLog ();
     var args = new FakeCakeArguments ();
     var processRunner = new ProcessRunner (environment, log);
     var registry = new WindowsRegistry ();
     var toolRepo = new ToolRepository (environment);
     var config = new Core.Configuration.CakeConfigurationProvider (fileSystem, environment).CreateConfiguration (testsDir, new Dictionary<string, string> ());
     var toolResolutionStrategy = new ToolResolutionStrategy (fileSystem, environment, globber, config);
     var toolLocator = new ToolLocator (environment, toolRepo, toolResolutionStrategy);
     context = new CakeContext (fileSystem, environment, globber, log, args, processRunner, registry, toolLocator);
     context.Environment.WorkingDirectory = testsDir;
 }
Example #28
0
        public BlogIndex Parse(DirectoryPath path)
        {
            var directory = _fileSystem.GetDirectory(path);
            if (!directory.Exists)
            {
                return new BlogIndex(Enumerable.Empty<BlogPost>());
            }

            var posts = new List<BlogPost>();
            var files = directory.GetFiles("*", SearchScope.Current);
            foreach (var file in files)
            {
                var filename = BlogFilename.Parse(file.Path);
                if (filename != null)
                {
                    // Parse the file.
                    var content = _parser.Parse(file.Path);
                    if (!content.FrontMatter.ContainsKey("content-type"))
                    {
                        content.FrontMatter.Add("content-type", "markdown");
                    }

                    // Process the content.
                    var body = _converter.ConvertToHtml(content, content.Body);
                    body = _processor.Process(body) ?? body;

                    // Get the excerpts.
                    var excerpts = _converter.ConvertToHtml(content, content.Excerpt);

                    // Rewrite the feed body.
                    // This is kind of a hack, but we need to make sure that all links are absolute.
                    var feedBody = RewriteRelativeLinks(body);

                    // Add the blog post.
                    posts.Add(new BlogPost(filename.Slug,
                        content.GetFrontMatter("title"), body, feedBody, excerpts, filename.PostedAt,
                        GetCategories(content)));
                }
            }

            return new BlogIndex(posts);
        }
Example #29
0
        public static void GitPush(
            this ICakeContext context,
            DirectoryPath repositoryDirectoryPath,
            string username,
            string password
            )
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (repositoryDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryDirectoryPath));
            }

            var repositoryFullDirectoryPath = repositoryDirectoryPath.MakeAbsolute(context.Environment);

            if (!context.FileSystem.Exist(repositoryFullDirectoryPath))
            {
                throw new DirectoryNotFoundException($"Failed to find repositoryDirectoryPath: {repositoryFullDirectoryPath}");
            }

            context.UseRepository(
                repositoryDirectoryPath,
                repository =>
                    repository.Network.Push(
                        repository.Branches,
                        new PushOptions
                        {
                            CredentialsProvider =
                                (url, usernameFromUrl, types) =>
                                    new UsernamePasswordCredentials
                                    {
                                        Username = username,
                                        Password = password
                                    }
                        }
                        )
                );
        }
Example #30
0
        public FakeCakeContext ()
        {
            testsDir = new DirectoryPath (
                System.IO.Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location));

            var fileSystem = new FileSystem ();
            var environment = new CakeEnvironment ();
            var globber = new Globber (fileSystem, environment);
            log = new FakeLog ();
            var args = new FakeCakeArguments ();
            var processRunner = new ProcessRunner (environment, log);
            var registry = new WindowsRegistry ();
            var toolRepo = new ToolRepository (environment);
            var config = new Core.Configuration.CakeConfigurationProvider (fileSystem, environment).CreateConfiguration (new Dictionary<string, string> ());
            var toolResStrat = new ToolResolutionStrategy (fileSystem, environment, globber, config);
            var toolLocator = new ToolLocator (environment, toolRepo, toolResStrat);

            context = new CakeContext (fileSystem, environment, globber, log, args, processRunner, registry, toolLocator);
            context.Environment.WorkingDirectory = testsDir;
        }
Example #31
0
        public void Restore(FilePath project,
                            PackageLocation packageLocation,
                            string verbosity = null)
        {
            string        packageId;
            VersionRange  versionRange;
            string        targetFramework;
            DirectoryPath assetJsonOutput;

            try
            {
                // The mock installer wrote a mock project file containing id;version;framework;stageDirectory
                var contents = _fileSystem.File.ReadAllText(project.Value);
                var tokens   = contents.Split(';');
                if (tokens.Length != 4)
                {
                    throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed);
                }

                packageId       = tokens[0];
                versionRange    = VersionRange.Parse(tokens[1]);
                targetFramework = tokens[2];
                assetJsonOutput = new DirectoryPath(tokens[3]);
            }
            catch (IOException)
            {
                throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed);
            }

            if (string.IsNullOrEmpty(packageId))
            {
                throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed);
            }

            var feedPackage = GetPackage(
                packageId,
                versionRange,
                packageLocation.NugetConfig,
                packageLocation.RootConfigDirectory);

            var packageVersion = feedPackage.Version;

            targetFramework = string.IsNullOrEmpty(targetFramework) ? "targetFramework" : targetFramework;

            var fakeExecutableSubDirectory = Path.Combine(
                packageId.ToLowerInvariant(),
                packageVersion.ToLowerInvariant(),
                "tools",
                targetFramework,
                Constants.AnyRid);
            var fakeExecutablePath = Path.Combine(fakeExecutableSubDirectory, FakeEntrypointName);

            _fileSystem.Directory.CreateDirectory(Path.Combine(assetJsonOutput.Value, fakeExecutableSubDirectory));
            _fileSystem.File.CreateEmptyFile(Path.Combine(assetJsonOutput.Value, fakeExecutablePath));
            _fileSystem.File.WriteAllText(
                assetJsonOutput.WithFile("project.assets.json").Value,
                fakeExecutablePath);
            _fileSystem.File.WriteAllText(
                assetJsonOutput.WithFile(FakeCommandSettingsFileName).Value,
                JsonSerializer.Serialize(new { Name = feedPackage.ToolCommandName }));
        }
Example #32
0
 public static Task <List <GlobalJsonBackwards> > GetExistingFilesBackwardsAsync(DirectoryPath directoryPath = default)
 => GetFilesBackwardsAsync(directoryPath ?? DirectoryPath.OS.Current, true);
Example #33
0
 /// <summary>
 /// Uncompress the specified archive.
 /// </summary>
 /// <param name="filePath">Archive to uncompress.</param>
 /// <param name="outputPath">Output path to uncompress into.</param>
 public abstract void Uncompress(FilePath filePath, DirectoryPath outputPath);
 public Task<bool> Save<T>(T             config,
                           DirectoryPath dirPath = null)
 {
   return Save(config, config.GetType(), dirPath);
 }
 protected override IReadOnlyCollection <IFile> GetAddinAssemblies(DirectoryPath path)
 {
     throw new NotSupportedException("Only tools can be resolved with this resolver.");
 }
Example #36
0
        private void OnSelectedFolderPathChanged()
        {
            App.Logger.TraceExt("NotesViewHierachical",
                                "OnSelectedFolderPathChanged",
                                Tuple.Create("SelectedFolderPath", SelectedFolderPath?.Formatted));

            if (SelectedFolderPath == null)
            {
                return;
            }
            if (DisplayItems == null)
            {
                return;
            }

            var f = DisplayItems.Find(SelectedFolderPath, true);

            if (f != null)
            {
                if (!f.IsSelected)
                {
                    App.Logger.TraceExt("NotesViewHierachical",
                                        "OnSelectedFolderPathChanged (1)",
                                        Tuple.Create("f.IsSelected", "true"));

                    f.IsSelected = true;
                }
            }
            else
            {
                if (AllNotes == null && !SelectedFolderPath.IsRoot() && !SelectedFolderPath.EqualsIgnoreCase(SelectedFolder?.GetInternalPath()))
                {
                    App.Logger.TraceExt("NotesViewHierachical", "OnSelectedFolderPathChanged (2)",
                                        Tuple.Create("SelectedFolder", SelectedFolder?.Header));

                    _initFolderPath    = SelectedFolderPath;
                    SelectedFolderPath = SelectedFolder?.GetInternalPath() ?? DirectoryPath.Root();
                }
                else
                {
                    if (DisplayItems.AllNotesViewWrapper != null)
                    {
                        if (!DisplayItems.AllNotesViewWrapper.IsSelected)
                        {
                            App.Logger.TraceExt("NotesViewHierachical",
                                                "OnSelectedFolderPathChanged (3)",
                                                Tuple.Create("DisplayItems.AllNotesWrapper.IsSelected", "true"));

                            DisplayItems.AllNotesViewWrapper.IsSelected = true;
                        }
                    }
                    else
                    {
                        var fod = DisplayItems.SubFolder.FirstOrDefault(p => !p.IsSpecialNode);
                        if (fod != null && !fod.IsSelected)
                        {
                            App.Logger.TraceExt("NotesViewHierachical",
                                                "OnSelectedFolderPathChanged (4)",
                                                Tuple.Create("DisplayItems.SubFolder.FirstOrDefault().IsSelected", "true"));

                            fod.IsSelected = true;
                        }
                    }
                }
            }
        }
Example #37
0
        private void ResyncDisplayItems(IList <INote> notes)
        {
            App.Logger.Trace("NotesViewHierachical", "ResyncDisplayItems", string.Join("\n", notes.Select(n => $"{n.UniqueName}  {n.Title}")));

            HierachicalWrapper_Folder root = new HierachicalWrapper_Folder("ROOT", this, DirectoryPath.Root(), true, false);

            if (Settings?.FolderViewShowRootNode == true)
            {
                var root2 = root.GetOrCreateRootFolder();
                foreach (var note in notes)
                {
                    var parent = root2;
                    foreach (var pathcomp in note.Path.Enumerate())
                    {
                        parent = parent.GetOrCreateFolder(pathcomp, out _);
                    }
                    parent.Add(note);
                }
            }
            else
            {
                foreach (var note in notes)
                {
                    var parent = root;
                    foreach (var pathcomp in note.Path.Enumerate())
                    {
                        parent = parent.GetOrCreateFolder(pathcomp, out _);
                    }
                    parent.Add(note);
                }
            }

            DisplayItems.CopyPermanentsTo(root);
            root.Sort();
            root.FinalizeCollection(Settings?.DeepFolderView ?? false);

            DisplayItems.Sync(root, new HierachicalWrapper_Folder[0]);
        }
Example #38
0
        public static void CopyFiles(ICakeContext context, IEnumerable <FilePath> filePaths, DirectoryPath targetDirectoryPath)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (filePaths == null)
            {
                throw new ArgumentNullException(nameof(filePaths));
            }
            if (targetDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(targetDirectoryPath));
            }

            var absoluteTargetDirectoryPath = targetDirectoryPath.MakeAbsolute(context.Environment);

            // Make sure the target directory exist.
            if (!context.FileSystem.Exist(absoluteTargetDirectoryPath))
            {
                const string format  = "The directory '{0}' do not exist.";
                var          message = string.Format(CultureInfo.InvariantCulture, format, absoluteTargetDirectoryPath.FullPath);
                throw new DirectoryNotFoundException(message);
            }

            // Iterate all files and copy them.
            foreach (var filePath in filePaths)
            {
                CopyFileCore(context, filePath, absoluteTargetDirectoryPath.GetFilePath(filePath));
            }
        }
 public PackagePathResolver(DirectoryPath root)
 {
     _root = root;
 }
Example #40
0
 public static void CopyFileToDirectory(ICakeContext context, FilePath filePath, DirectoryPath targetDirectoryPath)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (filePath == null)
     {
         throw new ArgumentNullException(nameof(filePath));
     }
     if (targetDirectoryPath == null)
     {
         throw new ArgumentNullException(nameof(targetDirectoryPath));
     }
     CopyFile(context, filePath, targetDirectoryPath.GetFilePath(filePath));
 }
        public override int Execute()
        {
            var global   = _options.ValueOrDefault <bool>("global");
            var toolPath = _options.SingleArgumentOrDefault("tool-path");

            DirectoryPath?toolDirectoryPath = null;

            if (!string.IsNullOrWhiteSpace(toolPath))
            {
                if (!Directory.Exists(toolPath))
                {
                    throw new GracefulException(
                              string.Format(
                                  LocalizableStrings.InvalidToolPathOption,
                                  toolPath));
                }

                toolDirectoryPath = new DirectoryPath(toolPath);
            }

            (IToolPackageStore toolPackageStore, IToolPackageStoreQuery toolPackageStoreQuery, IToolPackageUninstaller toolPackageUninstaller)
                = _createToolPackageStoresAndUninstaller(toolDirectoryPath);
            IShellShimRepository shellShimRepository = _createShellShimRepository(toolDirectoryPath);

            var          packageId = new PackageId(_options.Arguments.Single());
            IToolPackage package   = null;

            try
            {
                package = toolPackageStoreQuery.EnumeratePackageVersions(packageId).SingleOrDefault();
                if (package == null)
                {
                    throw new GracefulException(
                              messages: new[]
                    {
                        string.Format(
                            LocalizableStrings.ToolNotInstalled,
                            packageId),
                    },
                              isUserError: false);
                }
            }
            catch (InvalidOperationException)
            {
                throw new GracefulException(
                          messages: new[]
                {
                    string.Format(
                        LocalizableStrings.ToolHasMultipleVersionsInstalled,
                        packageId),
                },
                          isUserError: false);
            }

            try
            {
                using (var scope = new TransactionScope(
                           TransactionScopeOption.Required,
                           TimeSpan.Zero))
                {
                    foreach (var command in package.Commands)
                    {
                        shellShimRepository.RemoveShim(command.Name);
                    }

                    toolPackageUninstaller.Uninstall(package.PackageDirectory);

                    scope.Complete();
                }

                _reporter.WriteLine(
                    string.Format(
                        LocalizableStrings.UninstallSucceeded,
                        package.Id,
                        package.Version.ToNormalizedString()).Green());
                return(0);
            }
            catch (Exception ex) when(ToolUninstallCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex))
            {
                throw new GracefulException(
                          messages: ToolUninstallCommandLowLevelErrorConverter.GetUserFacingMessages(ex, packageId),
                          verboseMessages: new[] { ex.ToString() },
                          isUserError: false);
            }
        }
Example #42
0
 public FakeDirectory CreateDirectory(DirectoryPath path)
 {
     return(CreateDirectory(new FakeDirectory(this, path)));
 }
Example #43
0
        public static void GitPushRef(
            this ICakeContext context,
            DirectoryPath repositoryDirectoryPath,
            string username,
            string password,
            string remote, string pushRefSpec)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (repositoryDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryDirectoryPath));
            }

            if (remote == null)
            {
                throw new ArgumentNullException(nameof(remote));
            }

            if (string.IsNullOrWhiteSpace(remote))
            {
                throw new ArgumentException("Remote cannot be empty", nameof(remote));
            }

            if (pushRefSpec == null)
            {
                throw new ArgumentNullException(nameof(pushRefSpec));
            }

            if (string.IsNullOrWhiteSpace(pushRefSpec))
            {
                throw new ArgumentException("Pushrefspec cannot be empty", nameof(pushRefSpec));
            }

            if (username == null)
            {
                throw new ArgumentNullException(nameof(username));
            }

            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }

            var options = new PushOptions
            {
                CredentialsProvider = (url, usernameFromUrl, types) =>
                                      new UsernamePasswordCredentials
                {
                    Username = username,
                    Password = password
                }
            };

            context.UseRepository(
                repositoryDirectoryPath,
                repository => repository.Network.Push(repository.Network.Remotes[remote],
                                                      repository.Tags[pushRefSpec].CanonicalName,
                                                      options)
                );
        }
Example #44
0
 public IEnumerable <DirectoryPath> ListFolder()
 {
     if (Settings?.FolderViewShowRootNode == false)
     {
         return new [] { DirectoryPath.Root() }
     }
 protected virtual FilePath GetConfigFilePath(DirectoryPath dirPath,
                                              Type          confType)
 {
   return dirPath.CombineFile(confType.Name + ".json");
 }
Example #46
0
        IControl CreateContent(Template template, IDialog <bool> dialog)
        {
            var projectLocation =
                UserSettings.Folder("MostRecentlyUsedFolder")
                .Convert(v => v.Or(Optional.Some(_fuse.ProjectsDir)), d => d)
                .AutoInvalidate(TimeSpan.FromMilliseconds(100));
            var validatedLocation = projectLocation.Validate(v => v.NativePath, ValidateExistingDirectory);

            var projectName = Property.Create(
                Optional.Some(_shell.MakeUnique(projectLocation.Latest().First().Value / "App").Name));
            var validatedName =
                projectName.Validate(v => v.ToString(), DirectoryName.Validate);

            var possibleProjectName = projectLocation.CombineLatest(
                projectName,
                (loc, pro) => { return(loc.SelectMany(l => pro.Select(n => l / n))); })
                                      .Select(
                d => d.HasValue && Directory.Exists(d.Value.NativePath) ?
                Optional.Some("Project '" + d.Value.Name + "' already exists in " + d.Value.ContainingDirectory.NativePath) :
                Optional.None());

            return
                (Layout.Dock()
                 .Bottom(Layout.Dock()
                         .Right(
                             Buttons.DefaultButtonPrimary(
                                 text: "Create",
                                 cmd: Observable.CombineLatest(
                                     projectName, projectLocation,
                                     (name, location) =>
            {
                var projectDirectory =
                    location.SelectMany(l =>
                                        name.Select(n => l / n))
                    .Where(d => !_shell.Exists(d));

                return Command.Create(
                    isEnabled: projectDirectory.HasValue,
                    action: async() =>
                {
                    var spawnTemplate = new SpawnTemplate(_shell);
                    var resultPath = spawnTemplate.CreateProject(name.Value.ToString(), template, location.Value);
                    var projectPath = resultPath / new FileName(name.Value + ".unoproj");

                    await Application.OpenDocument(projectPath, showWindow: true);
                    dialog.Close(true);
                });
            }).Switch())
                             .WithWidth(104))
                         .Right(Buttons.DefaultButton(text: "Cancel", cmd: Command.Enabled(() => dialog.Close(false)))
                                .WithWidth(104)
                                .WithPadding(right: new Points(16)))
                         .Fill())

                 .Fill(
                     Layout.StackFromTop(
                         Label.Create("Name:", color: Theme.DefaultText)
                         .WithPadding(LabelThickness),
                         ValidatedTextBox.Create(validatedName)
                         .WithPadding(ControlPadding),
                         Control.Empty
                         .WithHeight(8),
                         Label.Create("Location:", color: Theme.DefaultText)
                         .WithPadding(LabelThickness),
                         Layout.Dock()
                         .Right(
                             Buttons.DefaultButton(text: "Browse", cmd: Command.Enabled(async() =>
            {
                var directory = await dialog.BrowseForDirectory(await projectLocation.FirstAsync().Or(DirectoryPath.GetCurrentDirectory()));
                if (directory.HasValue)
                {
                    projectLocation.Write(directory.Value, save: true);
                }
            }))
                             .WithWidth(80)
                             .WithHeight(22)
                             .CenterVertically()
                             .WithPadding(LabelThickness)
                             )
                         .Fill(ValidatedTextBox.Create(validatedLocation)
                               .WithPadding(ControlPadding)),
                         ErrorLabel.Create(possibleProjectName)
                         .WithPadding(ControlPadding)))
                 .WithPadding(ControlPadding)
                 .WithPadding(ControlPadding)
                 .WithBackground(Theme.PanelBackground));
        }
Example #47
0
        public IEnumerable <IDebugState> GetDebugStates(string serverWebUri, DirectoryPath directory, FilePath path)
        {
            var list = new List <DebugState>
            {
                new DebugState
                {
                    StateType    = StateType.Before,
                    ServerID     = ServerID,
                    ParentID     = Guid.Empty,
                    ID           = Workflow1ID,
                    DisplayName  = "Workflow1",
                    HasError     = false,
                    Name         = "DsfActivity",
                    ActivityType = ActivityType.Workflow,
                    StartTime    = _startDate,
                    EndTime      = _startDate.AddMinutes(1)
                },
                new DebugState
                {
                    StateType    = StateType.All,
                    ServerID     = ServerID,
                    ParentID     = Workflow1ID,
                    ID           = Assign1ID,
                    DisplayName  = "Assign1",
                    HasError     = false,
                    Name         = "Assign",
                    ActivityType = ActivityType.Step,
                    StartTime    = _startDate.AddMinutes(1),
                    EndTime      = _startDate.AddMinutes(2)
                },
                new DebugState
                {
                    StateType    = StateType.Before,
                    ServerID     = ServerID,
                    ParentID     = Workflow1ID,
                    ID           = Workflow2ID,
                    DisplayName  = "Workflow2",
                    HasError     = false,
                    Name         = "DsfActivity",
                    ActivityType = ActivityType.Step,
                    StartTime    = _startDate.AddMinutes(2),
                    EndTime      = _startDate.AddMinutes(3)
                },
                new DebugState
                {
                    StateType    = StateType.All,
                    ServerID     = ServerID,
                    ParentID     = Workflow2ID,
                    ID           = Assign2ID,
                    DisplayName  = "Assign2",
                    HasError     = false,
                    Name         = "Assign",
                    ActivityType = ActivityType.Step,
                    StartTime    = _startDate.AddMinutes(3),
                    EndTime      = _startDate.AddMinutes(4)
                },
                new DebugState
                {
                    StateType    = StateType.After,
                    ServerID     = ServerID,
                    ParentID     = Workflow1ID,
                    ID           = Workflow2ID,
                    DisplayName  = "Workflow2",
                    HasError     = false,
                    Name         = "DsfActivity",
                    ActivityType = ActivityType.Step,
                    StartTime    = _startDate.AddMinutes(4),
                    EndTime      = _startDate.AddMinutes(5)
                },
                new DebugState
                {
                    StateType    = StateType.After,
                    ServerID     = ServerID,
                    ParentID     = Guid.Empty,
                    ID           = Workflow1ID,
                    DisplayName  = "Workflow1",
                    HasError     = false,
                    Name         = "DsfActivity",
                    ActivityType = ActivityType.Workflow,
                    StartTime    = _startDate.AddMinutes(5),
                    EndTime      = _startDate.AddMinutes(6)
                },
                new DebugState
                {
                    StateType    = StateType.All,
                    ServerID     = ServerID,
                    ParentID     = Guid.Empty,
                    ID           = Assign3ID,
                    DisplayName  = "Assign3",
                    HasError     = false,
                    Name         = "Assign",
                    ActivityType = ActivityType.Step,
                    StartTime    = _startDate.AddMinutes(6),
                    EndTime      = _startDate.AddMinutes(7)
                }
            };

            return(list);
        }
        public static bool SvnVacuum(this ICakeContext context, DirectoryPath directory, SvnVacuumSettings settings)
        {
            var vacuum = new SvnVacuum(context.Environment, SvnClientFactoryMethod);

            return(vacuum.Vacuum(directory, settings));
        }
Example #49
0
        public static void Zip(this ICakeContext context, DirectoryPath rootPath, FilePath outputPath)
        {
            var filePaths = context.GetFiles(string.Concat(rootPath, "/**/*"));

            Zip(context, rootPath, outputPath, filePaths);
        }
 public static bool SvnVacuum(this ICakeContext context, DirectoryPath directory)
 {
     return(SvnVacuum(context, directory, new SvnVacuumSettings()));
 }
Example #51
0
 private static async Task <List <GlobalJsonBackwards> > GetFilesBackwardsAsync(DirectoryPath directoryPath, bool existingOnly = false)
 => (await(directoryPath ?? DirectoryPath.OS.Current).GetFilesBackwardsAsync(FileName, existingOnly).ConfigureAwait(false))
 .Select(item => new GlobalJsonBackwards(item)).ToList();
Example #52
0
        private FilePath GetFromRegistry()
        {
            // Gets a list of the files we should check.
            var files = new List <FilePath>();

            using (var root = _registry.LocalMachine.OpenKey("Software\\Microsoft\\Windows Kits\\Installed Roots"))
            {
                string kitsRoot = root?.GetValue("KitsRoot10") as string;
                if (!string.IsNullOrWhiteSpace(kitsRoot))
                {
                    var      kitsPath = new DirectoryPath(kitsRoot);
                    string[] versions = root.GetSubKeyNames();

                    foreach (string version in versions.OrderByDescending(x => x))
                    {
                        var versionPath = kitsPath.Combine($"bin\\{version}");

                        files.Add(_environment.Platform.Is64Bit
                            ? versionPath.CombineWithFilePath("x64\\signtool.exe")
                            : versionPath.CombineWithFilePath("x86\\signtool.exe"));
                    }
                }
            }

            using (var root = _registry.LocalMachine.OpenKey("Software\\Microsoft\\Windows Kits\\Installed Roots"))
            {
                if (root != null)
                {
                    var windowsKits = new[] { "KitsRoot10", "KitsRoot81", "KitsRoot" };
                    foreach (var kit in windowsKits)
                    {
                        var kitsRoot = root.GetValue(kit) as string;
                        if (!string.IsNullOrWhiteSpace(kitsRoot))
                        {
                            var kitsPath = new DirectoryPath(kitsRoot);

                            files.Add(_environment.Platform.Is64Bit
                                ? kitsPath.CombineWithFilePath("bin\\x64\\signtool.exe")
                                : kitsPath.CombineWithFilePath("bin\\x86\\signtool.exe"));
                        }
                    }
                }
            }

            using (var root = _registry.LocalMachine.OpenKey("Software\\Microsoft\\Microsoft SDKs\\Windows"))
            {
                if (root != null)
                {
                    var keyName = root.GetSubKeyNames();
                    foreach (var key in keyName)
                    {
                        var sdkKey             = root.OpenKey(key);
                        var installationFolder = sdkKey?.GetValue("InstallationFolder") as string;
                        if (!string.IsNullOrWhiteSpace(installationFolder))
                        {
                            var installationPath = new DirectoryPath(installationFolder);
                            files.Add(installationPath.CombineWithFilePath("bin\\signtool.exe"));
                        }
                    }
                }
            }

            // Return the first path that exists.
            return(files.FirstOrDefault(file => _fileSystem.Exist(file)));
        }
Example #53
0
 /// <summary>
 /// Create a archive of the specified files.
 /// </summary>
 /// <param name="rootPath">The root path.</param>
 /// <param name="outputPath">The output path.</param>
 /// <param name="filePaths">The file paths.</param>
 /// <param name="level">The compression level (1-9).</param>
 public abstract void Compress(DirectoryPath rootPath, FilePath outputPath, IEnumerable <FilePath> filePaths, int level);
Example #54
0
 /// <summary>
 /// Gets commits from the repository the specified path is a part of.
 /// </summary>
 /// <param name="repositoryPath">The repository path.</param>
 public GitCommits(DirectoryPath repositoryPath)
     : base(repositoryPath)
 {
 }
Example #55
0
        public ToolRestoreCommandTests()
        {
            _packageVersionA = NuGetVersion.Parse("1.0.4");
            _packageVersionWithCommandNameCollisionWithA = NuGetVersion.Parse("1.0.9");
            _packageVersionB = NuGetVersion.Parse("1.0.4");

            _reporter   = new BufferedReporter();
            _fileSystem = new FileSystemMockBuilder().UseCurrentSystemTemporaryDirectory().Build();
            _nugetGlobalPackagesFolder = new DirectoryPath(NuGetGlobalPackagesFolder.GetLocation());
            _temporaryDirectory        = _fileSystem.Directory.CreateTemporaryDirectory().DirectoryPath;
            _pathToPlacePackages       = Path.Combine(_temporaryDirectory, "pathToPlacePackage");
            ToolPackageStoreMock toolPackageStoreMock =
                new ToolPackageStoreMock(new DirectoryPath(_pathToPlacePackages), _fileSystem);

            _toolPackageStore         = toolPackageStoreMock;
            _toolPackageInstallerMock = new ToolPackageInstallerMock(
                _fileSystem,
                _toolPackageStore,
                new ProjectRestorerMock(
                    _fileSystem,
                    _reporter,
                    new[]
            {
                new MockFeed
                {
                    Type     = MockFeedType.ImplicitAdditionalFeed,
                    Packages = new List <MockFeedPackage>
                    {
                        new MockFeedPackage
                        {
                            PackageId       = _packageIdA.ToString(),
                            Version         = _packageVersionA.ToNormalizedString(),
                            ToolCommandName = _toolCommandNameA.ToString()
                        },
                        new MockFeedPackage
                        {
                            PackageId       = _packageIdB.ToString(),
                            Version         = _packageVersionB.ToNormalizedString(),
                            ToolCommandName = _toolCommandNameB.ToString()
                        },
                        new MockFeedPackage
                        {
                            PackageId       = _packageIdWithCommandNameCollisionWithA.ToString(),
                            Version         = _packageVersionWithCommandNameCollisionWithA.ToNormalizedString(),
                            ToolCommandName = "A"
                        }
                    }
                }
            }),
                installCallback: () => _installCalledCount++);

            ParseResult result = Parser.Instance.Parse("dotnet tool restore");

            _appliedCommand = result["dotnet"]["tool"]["restore"];
            Cli.CommandLine.Parser parser = Parser.Instance;
            _parseResult = parser.ParseFrom("dotnet tool", new[] { "restore" });

            _localToolsResolverCache
                = new LocalToolsResolverCache(
                      _fileSystem,
                      new DirectoryPath(Path.Combine(_temporaryDirectory, "cache")),
                      1);
        }
Example #56
0
 internal FakeDirectory(FakeFileSystemTree tree, DirectoryPath path)
 {
     _tree   = tree;
     Path    = path;
     Content = new FakeDirectoryContent(this, tree.Comparer);
 }
 public FilePath?GetPath(DirectoryPath repositoryPath)
 {
     return(_fs.Directory.EnumerateFiles(repositoryPath.Path, "*.sln")
            .Select <string, FilePath?>(x => new FilePath(x))
            .FirstOrDefault());
 }
    /// <inheritdoc />
    public ConfigurationService(DirectoryPath dirPath)
    {
      _dirPath = dirPath;

      EnsureFolderExists();
    }
Example #59
0
 /// <summary>
 /// Gets a <see cref="IDirectory" /> instance representing the specified path.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <returns>A <see cref="IDirectory" /> instance representing the specified path.</returns>
 public IDirectory GetDirectory(DirectoryPath path)
 {
     return(new Directory(path));
 }
Example #60
0
        public override int Execute()
        {
            ValidateArguments();

            DirectoryPath?toolPath = null;

            if (_toolPath != null)
            {
                toolPath = new DirectoryPath(_toolPath);
            }

            VersionRange versionRange = null;

            if (!string.IsNullOrEmpty(_packageVersion) && !VersionRange.TryParse(_packageVersion, out versionRange))
            {
                throw new GracefulException(
                          string.Format(
                              LocalizableStrings.InvalidNuGetVersionRange,
                              _packageVersion));
            }

            (IToolPackageStore toolPackageStore,
             IToolPackageStoreQuery toolPackageStoreQuery,
             IToolPackageInstaller toolPackageInstaller,
             IToolPackageUninstaller toolPackageUninstaller) = _createToolPackageStoreInstallerUninstaller(toolPath, _forwardRestoreArguments);

            IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath);

            IToolPackage oldPackageNullable = GetOldPackage(toolPackageStoreQuery);

            using (var scope = new TransactionScope(
                       TransactionScopeOption.Required,
                       TimeSpan.Zero))
            {
                if (oldPackageNullable != null)
                {
                    RunWithHandlingUninstallError(() =>
                    {
                        foreach (RestoredCommand command in oldPackageNullable.Commands)
                        {
                            shellShimRepository.RemoveShim(command.Name);
                        }

                        toolPackageUninstaller.Uninstall(oldPackageNullable.PackageDirectory);
                    });
                }

                RunWithHandlingInstallError(() =>
                {
                    IToolPackage newInstalledPackage = toolPackageInstaller.InstallPackage(
                        new PackageLocation(nugetConfig: GetConfigFile(), additionalFeeds: _additionalFeeds),
                        packageId: _packageId,
                        targetFramework: _framework,
                        versionRange: versionRange,
                        verbosity: _verbosity);

                    EnsureVersionIsHigher(oldPackageNullable, newInstalledPackage);

                    foreach (RestoredCommand command in newInstalledPackage.Commands)
                    {
                        shellShimRepository.CreateShim(command.Executable, command.Name);
                    }

                    PrintSuccessMessage(oldPackageNullable, newInstalledPackage);
                });

                scope.Complete();
            }

            return(0);
        }