Esempio n. 1
0
 Graph(ProduceWorkspace workspace)
 {
     Guard.NotNull(workspace, nameof(workspace));
     Workspace    = workspace;
     Targets      = new HashSet <Target>();
     Dependencies = new HashSet <Dependency>();
 }
Esempio n. 2
0
        GenerateProgramWrappers(ProduceWorkspace workspace)
        {
            Guard.NotNull(workspace, nameof(workspace));

            var scripts = new HashSet <string>(
                workspace.FindRepositories()
                .Select(r => r.DotProducePath)
                .Where(p => File.Exists(p))
                .Select(p => new DotProduce(p))
                .Where(dp => dp != null)
                .SelectMany(dp => dp.Programs)
                .Select(path => Path.GetFileNameWithoutExtension(path)),
                StringComparer.OrdinalIgnoreCase);

            var orphans =
                Directory.GetFiles(workspace.GetBinDirectory())
                .Where(file => !scripts.Contains(Path.GetFileNameWithoutExtension(file)))
                .ToList();

            if (orphans.Count > 0)
            {
                using (LogicalOperation.Start("Deleting orphan program wrapper scripts"))
                {
                    foreach (var file in orphans)
                    {
                        Trace.WriteLine(file);
                        File.Delete(file);
                    }
                }
            }
        }
Esempio n. 3
0
 ProduceRepository(ProduceWorkspace workspace, GitRepositoryName name)
     : base(
         IOPath.Combine(
             Guard.NotNull(workspace, nameof(workspace)).Path,
             Guard.NotNull(name, nameof(name))))
 {
     Workspace      = workspace;
     DotProducePath = IOPath.Combine(Path, ".produce");
     WorkDirectory  = IOPath.Combine(Workspace.GetProduceDirectory(), Name);
 }
Esempio n. 4
0
 PostWorkspace(ProduceWorkspace workspace, string command)
 {
     Guard.NotNull(workspace, nameof(workspace));
     Guard.Required(command, nameof(command));
     if (command != "programs")
     {
         return;
     }
     GenerateProgramWrappers(workspace);
 }
Esempio n. 5
0
        FindCurrentWorkspaceAndRepository()
        {
            var gitRepo = GitRepository.FindContainingRepository(Environment.CurrentDirectory);

            if (gitRepo != null)
            {
                CurrentWorkspace  = new ProduceWorkspace(Path.GetDirectoryName(gitRepo.Path));
                CurrentRepository = CurrentWorkspace.GetRepository(new GitRepositoryName(Path.GetFileName(gitRepo.Path)));
            }
            else
            {
                CurrentWorkspace  = new ProduceWorkspace(Path.GetFullPath(Environment.CurrentDirectory));
                CurrentRepository = null;
            }
        }
Esempio n. 6
0
        RunCommands(ProduceWorkspace workspace, IList <string> commands)
        {
            foreach (var command in commands)
            {
                foreach (var module in Modules)
                {
                    module.PreWorkspace(workspace, command);
                }
            }

            foreach (var repository in workspace.FindRepositories())
            {
                RunCommands(repository, commands);
            }

            foreach (var command in commands)
            {
                foreach (var module in Modules)
                {
                    module.PostWorkspace(workspace, command);
                }
            }
        }
Esempio n. 7
0
 PostWorkspace(ProduceWorkspace workspace, string command)
 {
 }