public CKSetupStoreTestHelperConfigFile(
     GitFolder f,
     SolutionDriver solutionDriver,
     SolutionSpec settings,
     IEnvLocalFeedProvider localFeedProvider,
     NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart("RemoteStore.TestHelper.config"))
 {
     _solutionSpec      = settings;
     _solutionDriver    = solutionDriver;
     _localFeedProvider = localFeedProvider;
     // Always monitor branch change even if _settings.ProduceCKSetupComponents is false
     // so that we delete the test file on leaving local if it happens to exist.
     if (PluginBranch == StandardGitStatus.Local)
     {
         f.OnLocalBranchEntered += OnLocalBranchEntered;
         f.OnLocalBranchLeaving += OnLocalBranchLeaving;
     }
     // If the settings states that CKSetup is not used, there is no need to react to builds.
     if (_solutionSpec.UseCKSetup)
     {
         _solutionDriver.OnStartBuild += OnStartBuild;
         _solutionDriver.OnEndBuild   += OnEndBuild;
     }
 }
Ejemplo n.º 2
0
 public AppveyorFile(GitFolder f, SolutionDriver driver, SolutionSpec settings, SecretKeyStore keyStore, SharedWorldState sharedState, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart("appveyor.yml"))
 {
     _driver       = driver;
     _solutionSpec = settings;
     _keyStore     = keyStore;
     _sharedState  = sharedState;
 }
Ejemplo n.º 3
0
 public CSProjFile(
     GitFolder f,
     NormalizedPath branchPath,
     SolutionDriver solutionDriver)
     : base(f, branchPath)
 {
     _solutionDriver = solutionDriver;
 }
Ejemplo n.º 4
0
 public NPMProjectsDriver(GitFolder f, NormalizedPath branchPath, SolutionDriver driver, SolutionSpec spec)
     : base(f, branchPath)
 {
     _driver = driver;
     _spec   = spec;
     _driver.OnSolutionConfiguration   += OnSolutionConfiguration;
     _driver.OnUpdatePackageDependency += OnUpdatePackageDependency;
 }
Ejemplo n.º 5
0
 public XmlFilePluginBase(GitFolder f, NormalizedPath branchPath, NormalizedPath filePath, Encoding encoding)
     : base(f.FileSystem, filePath, encoding)
 {
     if (!filePath.StartsWith(branchPath))
     {
         throw new ArgumentException($"Path {filePath} must start with folder {f.SubPath}.");
     }
     _pluginImpl = new GitBranchPluginImpl(f, branchPath);
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 public RepositoryXmlFile(GitFolder f, NormalizedPath branchPath, SolutionDriver driver)
     : base(f, branchPath, branchPath.AppendPart("RepositoryInfo.xml"), null)
 {
     if (PluginBranch == StandardGitStatus.Local)
     {
         f.OnLocalBranchEntered += OnLocalBranchEntered;
         f.OnLocalBranchLeaving += OnLocalBranchLeaving;
     }
     _driver = driver;
     _driver.OnStartBuild += OnStartBuild;
     _driver.OnEndBuild   += OnEndBuild;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Gets a <see cref="IFileInfo"/> in the <see cref="CurrentBranchName"/>.
        /// </summary>
        /// <param name="m">The monitor to use.</param>
        /// <param name="fileName">The path and file name (root based).</param>
        /// <returns>The file info (null if it doesn't exist on the file system) and its path.</returns>
        public static (IFileInfo FileInfo, NormalizedPath Path) GetFileInfo(this GitFolder @this, string fileName)
        {
            var path = @this.SubPath
                       .AppendPart("branches").AppendPart(@this.CurrentBranchName)
                       .Combine(fileName);
            var fileInfo = @this.FileSystem.GetFileInfo(path);

            if (!fileInfo.Exists || fileInfo.IsDirectory || fileInfo.PhysicalPath == null)
            {
                return(null, path);
            }
            return(fileInfo, path);
        }
Ejemplo n.º 9
0
 public CKSetupCodeCakeBuilderFolder(
     GitFolder f,
     SolutionDriver driver,
     CodeCakeBuilderKeyVaultFile keyVaultFile,
     SolutionSpec solutionSpec,
     NormalizedPath branchPath)
     : base(f, branchPath, "CodeCakeBuilder", "CKSetup/Res")
 {
     _driver       = driver;
     _solutionSpec = solutionSpec;
     _keyVaultFile = keyVaultFile;
     _driver.OnSolutionConfiguration += OnSolutionConfiguration;
     _keyVaultFile.Updating          += KeyVaultFileUpdating;
 }
Ejemplo n.º 10
0
 public NugetConfigFile(GitFolder f, SolutionDriver driver, IEnvLocalFeedProvider localFeedProvider, SecretKeyStore secretStore, SolutionSpec s, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart("NuGet.config"), null)
 {
     _localFeedProvider = localFeedProvider;
     _solutionSpec      = s;
     _solutionDriver    = driver;
     _secretStore       = secretStore;
     if (IsOnLocalBranch)
     {
         f.OnLocalBranchEntered += OnLocalBranchEntered;
         f.OnLocalBranchLeaving += OnLocalBranchLeaving;
     }
     _solutionDriver.OnStartBuild            += OnStartBuild;
     _solutionDriver.OnZeroBuildProject      += OnZeroBuildProject;
     _solutionDriver.OnSolutionConfiguration += OnSolutionConfiguration;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new <see cref="PluginFolderBase"/> on a folder path inside a branch path.
 /// </summary>
 /// <param name="f">The folder.</param>
 /// <param name="branchPath">The actual branch path (relative to the <see cref="FileSystem"/>).</param>
 /// <param name="folderPath">
 /// The actual sub folder path (ie. 'CodeCakeBuilder') where resources must be updated.</param>
 /// <param name="resourcePrefix">
 /// Optional resource prfix that defaults to <paramref name="resourceHolder"/>.Namespace + ".Res.".
 /// When not null, this path prefix is combined withe the namespace of the resourceHolder.
 /// </param>
 /// <param name="resourceHolder">
 /// Optional type used to locate resources.
 /// By default it is the actual type of this folder object: the defining assembly and namespace are used.
 /// </param>
 public PluginFolderBase(GitFolder f, NormalizedPath branchPath, NormalizedPath subFolderPath, NormalizedPath?resourcePrefix = null, Type resourceHolder = null)
     : base(f, branchPath)
 {
     FolderPath = branchPath.Combine(subFolderPath).ResolveDots(branchPath.Parts.Count);
     if (resourceHolder == null)
     {
         resourceHolder = GetType();
     }
     _resourceAssembly = resourceHolder.Assembly;
     if (!resourcePrefix.HasValue)
     {
         _resourcePrefix = resourceHolder.Namespace + ".Res.";
     }
     else
     {
         NormalizedPath p = resourceHolder.Namespace.Replace('.', '/');
         _resourcePrefix = p.Combine(resourcePrefix.Value).ResolveDots().Path.Replace('/', '.') + '.';
     }
     _csResourcePrefix      = _csProtocol + _resourcePrefix;
     _csResourcePrefixSlash = _csProtocolSlash + _resourcePrefix;
 }
Ejemplo n.º 12
0
 public CommonFolder(GitFolder f, SolutionDriver driver, SolutionSpec settings, NormalizedPath branchPath)
     : base(f, branchPath, "Common", "Basics/Res")
 {
     _driver   = driver;
     _settings = settings;
 }
Ejemplo n.º 13
0
 public CodeCakeBuilderFolder(GitFolder f, SolutionDriver driver, NormalizedPath branchPath)
     : base(f, branchPath, "CodeCakeBuilder", "Basics/Res")
 {
     _driver = driver;
 }
Ejemplo n.º 14
0
 public GlobalJsonFile(GitFolder f, NormalizedPath branchPath, SolutionSpec solutionSpec)
     : base(f, branchPath, branchPath.AppendPart("global.json"))
 {
     _solutionSpec = solutionSpec;
 }
Ejemplo n.º 15
0
 public GitIgnoreFile(GitFolder f, SolutionSpec solutionSpec, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart(".gitignore"))
 {
     _solutionSpec = solutionSpec;
 }
Ejemplo n.º 16
0
 public SolutionFolder(GitFolder f, SolutionDriver driver, SolutionSpec solutionSpec, NormalizedPath branchPath)
     : base(f, branchPath, subFolderPath: String.Empty, "Basics/Res")
 {
     _driver       = driver;
     _solutionSpec = solutionSpec;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Reads a Xml document file in the <see cref="CurrentBranchName"/>.
 /// </summary>
 /// <param name="m">The monitor to use.</param>
 /// <param name="fileName">The path and file name (root based).</param>
 /// <returns>The document and its path. Document is null if it can't be read and a fatal error is logged.</returns>
 public static (XDocument Doc, NormalizedPath Path) GetXmlDocument(this GitFolder @this, IActivityMonitor m, string fileName)
 {
     var(FileInfo, Path) = GetFileInfo(@this, fileName);
     return(FileInfo?.ReadAsXDocument(), Path);
 }
Ejemplo n.º 18
0
 public GitLabFile(GitFolder f, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart(".gitlab-ci.yml"))
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Reads a <see cref="ITextFileInfo"/> the <see cref="CurrentBranchName"/>.
 /// </summary>
 /// <param name="m">The monitor to use.</param>
 /// <param name="fileName">The path and file name (root based).</param>
 /// <returns>The text file info (null if it can't be read) and its path.</returns>
 public static (ITextFileInfo, NormalizedPath Path) GetTextFileInfo(this GitFolder @this, IActivityMonitor m, string fileName)
 {
     var(FileInfo, Path) = GetFileInfo(@this, fileName);
     return(FileInfo?.AsTextFileInfo(ignoreExtension: true), Path);
 }
Ejemplo n.º 20
0
 public NPMCodeCakeBuilderFolder(GitFolder f, NPMProjectsDriver npmDriver, SolutionDriver driver, NormalizedPath branchPath)
     : base(f, branchPath, "CodeCakeBuilder", "NPM/Res")
 {
     _npmDriver = npmDriver;
     _driver    = driver;
 }