예제 #1
0
 AngularWorkspace(NPMProjectsDriver driver, IAngularWorkspaceSpec spec, IReadOnlyCollection <NPMProject> projects)
 {
     Driver        = driver;
     Specification = spec;
     Projects      = projects;
     FullPath      = Driver.BranchPath.Combine(spec.Path);
 }
예제 #2
0
 public NPMSolutionFile(
     NPMCodeCakeBuilderFolder f,
     NPMProjectsDriver driver,
     NormalizedPath branchPath)
     : base(f.GitFolder, branchPath, f.FolderPath.AppendPart("NPMSolution.xml"), null)
 {
     _f      = f;
     _driver = driver;
 }
예제 #3
0
파일: NPMRCFiles.cs 프로젝트: CK-Build/CKli
 public NPMRCFiles(GitFolder f, NPMProjectsDriver driver, SolutionDriver solutionDriver, SecretKeyStore secretStore, SolutionSpec solutionSpec, NormalizedPath branchPath)
     : base(f, branchPath)
 {
     _solutionDriver = solutionDriver;
     _solutionSpec   = solutionSpec;
     _driver         = driver;
     _secretStore    = secretStore;
     _solutionDriver.OnSolutionConfiguration += OnSolutionConfiguration;
 }
예제 #4
0
 internal NPMProject(NPMProjectsDriver driver, IActivityMonitor m, INPMProjectSpec spec)
 {
     Driver        = driver;
     Specification = spec;
     FullPath      = Driver.BranchPath.Combine(spec.Folder);
     PackageJson   = new PackageJsonFile(Driver.GitFolder.FileSystem, FullPath);
     if (PackageJson.Root == null)
     {
         if (Driver.GitFolder.FileSystem.GetDirectoryContents(FullPath).Exists)
         {
             Error(m, NPMProjectStatus.ErrorMissingPackageJson);
         }
         else
         {
             Error(m, NPMProjectStatus.FatalInitializationError);
         }
     }
     Status = RefreshStatus(m);
     PackageJson.OnSavedOrDeleted += (s, e) => driver.SetSolutionDirty(e.Monitor);
 }
예제 #5
0
        static internal AngularWorkspace LoadAngularSolution(NPMProjectsDriver driver, IActivityMonitor m, IAngularWorkspaceSpec spec)
        {
            NormalizedPath packageJsonPath = spec.Path.AppendPart("package.json");
            NormalizedPath angularJsonPath = spec.Path.AppendPart("angular.json");
            var            fs          = driver.GitFolder.FileSystem;
            NormalizedPath path        = driver.BranchPath;
            JObject        packageJson = fs.GetFileInfo(path.Combine(packageJsonPath)).ReadAsJObject();
            JObject        angularJson = fs.GetFileInfo(path.Combine(angularJsonPath)).ReadAsJObject();

            if (!(packageJson["private"]?.ToObject <bool?>() ?? false))
            {
                throw new InvalidDataException("A workspace project should be private.");
            }
            string        solutionName  = packageJson["name"].ToString();
            List <string> unscopedNames = angularJson["projects"].ToObject <JObject>().Properties().Select(p => p.Name).ToList();

            List <NPMProject> projects = unscopedNames.Select(
                unscopedName =>
            {
                var projPathRelativeToWorkspace = new NormalizedPath(angularJson["projects"][unscopedName]["root"].ToString());
                var projPathRelativeToGitRepo   = spec.Path.Combine(projPathRelativeToWorkspace);
                var projectPathVirtualPath      = driver.BranchPath.Combine(projPathRelativeToGitRepo);
                JObject json = fs.GetFileInfo(projectPathVirtualPath.AppendPart("package.json")).ReadAsJObject();
                return(new NPMProject(
                           driver,
                           m,
                           new NPMProjectSpec(
                               projPathRelativeToGitRepo,
                               json["name"].ToString(),
                               json["private"]?.ToObject <bool>() ?? false
                               )
                           ));
            }).ToList();

            return(new AngularWorkspace(driver, spec, projects));
        }
예제 #6
0
 public NPMCodeCakeBuilderFolder(GitFolder f, NPMProjectsDriver npmDriver, SolutionDriver driver, NormalizedPath branchPath)
     : base(f, branchPath, "CodeCakeBuilder", "NPM/Res")
 {
     _npmDriver = npmDriver;
     _driver    = driver;
 }