public virtual void Check(CheckContext context) { var projectFile = context.Of <ProjectFile>().Value; var localItems = context.Of <LocalPathItems>().Value; var projectExtension = context.Of <ProjectExtension>().Value; var file = localItems .Where(f => Path.GetExtension(f) == "." + projectExtension) .ToList(); if (file.Count == 0) { throw new CheckException($"Cannot find project file '*.{projectExtension}'."); } if (file.Count > 1) { throw new CheckException($"There should be only one project file '*.{projectExtension}', but {file.Count} files were found."); } if (file[0] == projectFile) { return; } throw new CheckException($"Project file should be named '{projectFile}' and placed in project root folder."); }
public override string Get(CheckContext context) { var name = context.Of <LocalName>().Value; var ext = context.Of <ProjectExtension>().Value; return($"{name}.{ext}"); }
public override List <string> Get(CheckContext context) { var remoteSolution = context.Of <RemoteSolution>(); var sourceControl = context.Of <SourceControlProvider>().Value; Console.Write("Getting source control items from the solution folder... "); var items = sourceControl.GetChildItems(remoteSolution.SolutionPath); Console.WriteLine($"{items.Count} found."); return(items); }
public void Check(CheckContext context) { var solutionName = context.Of<RemoteSolution>().SolutionName; var solutionItems = context.Of<SolutionPathItems>().Value; var solution = solutionItems .Where(item => Path.GetFileName(item) == solutionName) .FirstOrDefault(); if (solution != null) return; throw new CheckException($"Project should have a primary solution file '{solutionName}' placed in parent folder."); }
public virtual void Check(CheckContext context) { var localItems = context.Of <LocalPathItems>().Value; var file = localItems .Where(f => Path.GetFileName(f) == "AssemblyInfo.cs") .ToList(); if (file.Count == 0) { throw new CheckException("Cannot find assembly information file."); } if (file.Count > 1) { throw new CheckException($"There should be only one assembly information file, but {file.Count} files were found."); } if (file[0] == @"Properties\AssemblyInfo.cs") { return; } throw new CheckException("Project file should be named 'AssemblyInfo.cs' and placed in 'Properties' folder."); }
public void Check(CheckContext context) { var solutionName = context.Of <RemoteSolution>().SolutionName; var solutionItems = context.Of <SolutionPathItems>().Value; var solution = solutionItems .Where(item => Path.GetFileName(item) == solutionName) .FirstOrDefault(); if (solution != null) { return; } throw new CheckException($"Project should have a primary solution file '{solutionName}' placed in parent folder."); }
/// <summary> /// Loads required data. /// </summary> public void Load(CheckContext context) { var remotePath = context.Of<RemotePath>().Value; SolutionPath = Path.GetDirectoryName(remotePath).Replace('\\', '/'); if (context.Args.DebugMode) Console.WriteLine($"{nameof(SolutionPath)} = {SolutionPath}"); }
public void Check(CheckContext context) { var solutionItems = context.Of<SolutionPathItems>().Value; if (!solutionItems.Contains(".nuget/")) return; throw new CheckException(@"Solution folder should not contain '.nuget' folder inside. Please consider using 'nuget.config' file from repository root."); }
public override string Get(CheckContext context) { const string prefix = "CnetContent."; var name = context.Of<ProjectName>().Value; if (name.StartsWith(prefix)) name = name.Substring(prefix.Length); return name; }
/// <summary> /// Loads required data. /// </summary> public void Load(CheckContext context) { var remotePath = context.Of <RemotePath>().Value; SolutionPath = Path.GetDirectoryName(remotePath).Replace('\\', '/'); if (context.Args.DebugMode) { Console.WriteLine($"{nameof(SolutionPath)} = {SolutionPath}"); } }
public void Check(CheckContext context) { var projectName = context.Of <ProjectName>().Value; var localName = context.Of <LocalName>().Value; var remotePath = context.Of <RemotePath>().Value; var projectFolder = Path.GetFileName(remotePath); if (projectFolder == localName) { return; } if (localName == projectName) { throw new CheckException($"Project folder '{projectFolder}' does not conform with project name '{projectName}'."); } throw new CheckException($"Project folder '{projectFolder}' does not conform with project name '{projectName}' (expected to be '{localName}')."); }
public void Check(CheckContext context) { var solutionItems = context.Of <SolutionPathItems>().Value; if (!solutionItems.Contains(".nuget/")) { return; } throw new CheckException(@"Solution folder should not contain '.nuget' folder inside. Please consider using 'nuget.config' file from repository root."); }
public virtual void Check(CheckContext context) { var projectFile = context.Of<ProjectFile>().Value; var localItems = context.Of<LocalPathItems>().Value; var projectExtension = context.Of<ProjectExtension>().Value; var file = localItems .Where(f => Path.GetExtension(f) == "." + projectExtension) .ToList(); if (file.Count == 0) throw new CheckException($"Cannot find project file '*.{projectExtension}'."); if (file.Count > 1) throw new CheckException($"There should be only one project file '*.{projectExtension}', but {file.Count} files were found."); if (file[0] == projectFile) return; throw new CheckException($"Project file should be named '{projectFile}' and placed in project root folder."); }
public override string Get(CheckContext context) { const string prefix = "CnetContent."; var name = context.Of <ProjectName>().Value; if (name.StartsWith(prefix)) { name = name.Substring(prefix.Length); } return(name); }
public override List <string> Get(CheckContext context) { var localPath = context.Of <LocalPath>().Value; Console.Write("Getting local file list... "); var files = Directory.GetFiles(localPath, "*", SearchOption.AllDirectories) .Union( Directory.GetDirectories(localPath, "*", SearchOption.AllDirectories) .Select(item => item + '\\')) .Select(item => item.Replace(localPath + '\\', String.Empty)) .ToList(); Console.WriteLine($"{files.Count} files found."); return(files); }
public virtual void Check(CheckContext context) { var localItems = context.Of<LocalPathItems>().Value; var file = localItems .Where(f => Path.GetFileName(f) == "AssemblyInfo.cs") .ToList(); if (file.Count == 0) throw new CheckException("Cannot find assembly information file."); if (file.Count > 1) throw new CheckException($"There should be only one assembly information file, but {file.Count} files were found."); if (file[0] == @"Properties\AssemblyInfo.cs") return; throw new CheckException("Project file should be named 'AssemblyInfo.cs' and placed in 'Properties' folder."); }
public override string Get(CheckContext context) { return(context.Of <ProjectName>().Value); }
public override ISourceControl Get(CheckContext context) { var tfsUrl = context.Of <TfsUrl>().Value; return(new TfsSourceControl(tfsUrl)); }