예제 #1
0
        public JarFinder(IPandoraGitSettings gitSettings, IPandoraContext context)
        {
            _gitSettings = gitSettings;
            _context     = context;
            var cloneOptions = new LibGit2Sharp.CloneOptions
            {
                IsBare              = false,
                Checkout            = true,
                CredentialsProvider = new LibGit2Sharp.Handlers.CredentialsHandler((a, b, c) => new LibGit2Sharp.UsernamePasswordCredentials()
                {
                    Username = gitSettings.Username,
                    Password = gitSettings.Password
                })
            };

            try
            {
                _checkoutDir = LibGit2Sharp.Repository.Clone(gitSettings.SourceUrl, gitSettings.WorkingDir, cloneOptions);
            }
            catch (LibGit2Sharp.LibGit2SharpException ex)
            {
                Exception error = new Exception("Unable to checkout repository. Please check the credentials", ex);
                throw error;
            }
        }
예제 #2
0
        /// <summary>
        /// Clones the repository needed and then loads the needed configurations in the Pandora object
        /// </summary>
        /// <param name="applicationName">The name of the file with jars in it</param>
        /// <param name="gitSettings">The general git settings needed to clone</param>
        /// <param name="options">Options to get environment specific configurations</param>
        public PandoraGitFactory(IPandoraContext context, IPandoraGitSettings gitSettings)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (gitSettings is null)
            {
                throw new ArgumentNullException(nameof(gitSettings));
            }

            _context     = context;
            _gitSettings = gitSettings;

            Refresh();
        }