コード例 #1
0
ファイル: CloneCommand.cs プロジェクト: pdubb29/GitDepend
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns>The return code.</returns>
        public ReturnCode Execute()
        {
            IVisitor visitor = new NullVisitor();

            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode == ReturnCode.Success)
            {
                _console.WriteLine("Successfully cloned all dependencies");
            }

            visitor = new CheckOutDependencyBranchVisitor();
            _algorithm.Reset();
            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode == ReturnCode.Success)
            {
                _console.WriteLine("All dependencies on the correct branch");
            }

            return(visitor.ReturnCode);
        }
コード例 #2
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns>The return code.</returns>
        public ReturnCode Execute()
        {
            IVisitor visitor = new CheckOutBranchVisitor();

            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode != ReturnCode.Success)
            {
                _console.WriteLine("Could not ensure the correct branch on all dependencies.");
                return(visitor.ReturnCode);
            }

            _algorithm.Reset();
            visitor = new BuildAndUpdateDependenciesVisitor();
            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode == ReturnCode.Success)
            {
                _console.WriteLine("Update complete!");
            }

            return(visitor.ReturnCode);
        }
コード例 #3
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns>The return code.</returns>
        public ReturnCode Execute()
        {
            if (string.IsNullOrEmpty(_options.BranchName))
            {
                return(ReturnCode.InvalidArguments);
            }

            IVisitor visitor = new CheckOutBranchVisitor(_options.BranchName, _options.CreateBranch);

            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode != ReturnCode.Success)
            {
                return(visitor.ReturnCode);
            }

            _algorithm.Reset();

            visitor = new VerifyCorrectBranchVisitor(new List <string>());
            _algorithm.TraverseDependencies(visitor, _options.Directory);

            return(visitor.ReturnCode);
        }
コード例 #4
0
ファイル: UpdateCommand.cs プロジェクト: pdubb29/GitDepend
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns>The return code.</returns>
        public ReturnCode Execute()
        {
            var verifyVisitor = new VerifyCorrectBranchVisitor(_options.Dependencies);

            _algorithm.TraverseDependencies(verifyVisitor, _options.Directory);

            if (verifyVisitor.ReturnCode != ReturnCode.Success)
            {
                _console.WriteLine("Not all dependencies are on the correct branch.");
                return(verifyVisitor.ReturnCode);
            }

            _console.WriteLine();
            _algorithm.Reset();
            var buildAndUpdateVisitor = new BuildAndUpdateDependenciesVisitor(_options.Dependencies);

            _algorithm.TraverseDependencies(buildAndUpdateVisitor, _options.Directory);

            if (buildAndUpdateVisitor.ReturnCode == ReturnCode.Success)
            {
                if (buildAndUpdateVisitor.UpdatedPackages.Any())
                {
                    _console.WriteLine("Updated packages: ");
                    foreach (var package in buildAndUpdateVisitor.UpdatedPackages)
                    {
                        _console.WriteLine($"    {package}");
                    }
                    _console.WriteLine("Update complete!");
                }
                else
                {
                    _console.WriteLine("nothing was updated");
                }
            }

            return(buildAndUpdateVisitor.ReturnCode);
        }