public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);

            _filesystem.Exists(null).ReturnsForAnyArgs(true);

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] { "group1/proj1", "group1/proj2", "group2/proj3" });
            _modules.Repos.Returns(new[] { "p1Repo", "p2Repo", "p3Repo" });
            _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) };
            _modules.CreateAndSetLocks().Returns(_locks);

            _patterns = new Patterns
            {
                DependencyPattern = "*.dll",
                DependencyPath = (FilePath)"lib",
                Masters = new FilePath[] { }
            };

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);
            _ruleFac.GetRulePatterns().Returns(_patterns);

            _buildCmd = Substitute.For<IBuildCmd>();

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd);
            _subject.Prepare();
            _subject.GetDependenciesAndBuild();
        }
Example #2
0
 public RepoExporter(IConsul consul, IGit git, IFileSystem fs, ILogger logger)
 {
     this.consul = consul;
     this.git = git;
     this.fs = fs;
     this.logger = logger;
 }
Example #3
0
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);

            var dbpath = The.Root.Navigate((FilePath)"group1/proj2/DatabaseScripts");
            _filesystem.Exists(null).ReturnsForAnyArgs(c=> c.Args()[0] as FilePath == dbpath);
            _filesystem.SortedDescendants(null,null).ReturnsForAnyArgs(new [] {(FilePath)"one",(FilePath)"two"});

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"});
            _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"});
            _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) };
            _modules.CreateAndSetLocks().Returns(_locks);

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);

            _buildCmd = Substitute.For<IBuildCmd>();

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd);
            _subject.Prepare();
            _subject.RebuildDatabases();
        }
Example #4
0
 public Builder(IFileSystem files, IGit git, IDependencyManager depMgr, IRuleFactory rules, IBuildCmd builder)
 {
     _files = files;
     _git = git;
     _depMgr = depMgr;
     _rules = rules;
     _builder = builder;
 }
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);
            _missingRepo = The.Root.Append((FilePath)"/group1/proj2");

            _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath !=_missingRepo));

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"});
            _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"});

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null);
            _subject.Prepare();
        }
Example #6
0
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);

            _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath != (FilePath)"group1/proj2"));

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"});
            _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"});
            _locks = new List<AutoResetEvent> { new AutoResetEvent(false), new AutoResetEvent(false), new AutoResetEvent(false) };
            _modules.CreateAndSetLocks().Returns(_locks);

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null);
            _subject.Prepare();
            _subject.PullRepos();
        }
Example #7
0
 public AppStartup(IGit git)
 {
     _Git = git;
 }
Example #8
0
 public static Process CreateProcess(this IGit git, StringBuilder args) => git.CreateProcess(args.ToString());
Example #9
0
 public GitContext(IGit instance)
 {
     GitInstance = instance;
 }
Example #10
0
 /// <summary>
 /// Get the configuration.
 /// </summary>
 /// <param name="git">Git object.</param>
 /// <returns>Git configuration.</returns>
 public static IGitConfiguration GetConfiguration(this IGit git) => git.GetConfiguration(GitConfigurationLevel.All);
Example #11
0
 /// <summary>
 /// Get a snapshot of the configuration for the system and user.
 /// </summary>
 /// <param name="git">Git object.</param>
 /// <returns>Git configuration snapshot.</returns>
 public static IGitConfiguration GetConfiguration(this IGit git) => git.GetConfiguration(null);
 public ListLatestCommand(IGit git)
 {
     _git = git;
 }
Example #13
0
 /// <summary>
 /// Returns true if the current Git instance is scoped to a local repository.
 /// </summary>
 /// <param name="git">Git object.</param>
 /// <returns>True if inside a local Git repository, false otherwise.</returns>
 public static bool IsInsideRepository(this IGit git)
 {
     return(!string.IsNullOrWhiteSpace(git.GetCurrentRepository()));
 }
Example #14
0
 /// <summary>
 /// Creates a new <see cref="StatusCommand"/>
 /// </summary>
 /// <param name="options">The <see cref="StatusSubOptions"/> that configure this command.</param>
 public StatusCommand(StatusSubOptions options) : base(options)
 {
     _options = options;
     _git     = DependencyInjection.Resolve <IGit>();
 }
Example #15
0
 /// <summary>
 /// Creates a new <see cref="CheckOutDependencyBranchVisitor"/>
 /// </summary>
 public CheckOutDependencyBranchVisitor()
 {
     _git        = DependencyInjection.Resolve <IGit>();
     _fileSystem = DependencyInjection.Resolve <IFileSystem>();
     _console    = DependencyInjection.Resolve <IConsole>();
 }
Example #16
0
 /// <summary>
 /// Creates a new <see cref="CreateBranchVisitor"/>
 /// </summary>
 /// <param name="branchName">The branch name to create.</param>
 public CreateBranchVisitor(string branchName)
 {
     BranchName = branchName;
     _git       = DependencyInjection.Resolve <IGit>();
     _console   = DependencyInjection.Resolve <IConsole>();
 }
Example #17
0
 public GitLog(IGit git)
 {
     this.git = git;
 }
Example #18
0
 /// <summary>
 /// Creates a new <see cref="NamedDependenciesCommand{T}"/>
 /// </summary>
 /// <param name="options">The options for the command.</param>
 public SyncCommand(SyncSubOptions options) : base(options)
 {
     _factory    = DependencyInjection.Resolve <IGitDependFileFactory>();
     _git        = DependencyInjection.Resolve <IGit>();
     _fileSystem = DependencyInjection.Resolve <IFileSystem>();
 }
Example #19
0
 public static string GetPath(this IGit git, ContentPath path)
 {
     return(path.IsRoot
         ? "."
         : String.Join("/", path.Parts));
 }