public CakeScriptGenerator( IBufferedFileSystem fileSystem, ICakeEnvironment environment, IGlobber globber, ICakeConfiguration configuration, IScriptProcessor processor, IScriptAliasFinder aliasFinder, ICakeAliasGenerator aliasGenerator, ICakeLog log, IScriptConventions scriptConventions, IReferenceAssemblyResolver referenceAssemblyResolver, IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders = null) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _globber = globber ?? throw new ArgumentNullException(nameof(globber)); _log = log ?? throw new ArgumentNullException(nameof(log)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _aliasFinder = aliasFinder ?? throw new ArgumentNullException(nameof(aliasFinder)); _aliasGenerator = aliasGenerator ?? throw new ArgumentNullException(nameof(aliasGenerator)); _analyzer = new ScriptAnalyzer(_fileSystem, _environment, _log, loadDirectiveProviders); _scriptConventions = scriptConventions ?? throw new ArgumentNullException(nameof(scriptConventions)); _referenceAssemblyResolver = referenceAssemblyResolver ?? throw new ArgumentNullException(nameof(referenceAssemblyResolver)); _addinRoot = GetAddinPath(_environment.WorkingDirectory); _hostObject = GetHostObject(); }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { if (processor == null) { throw new ArgumentNullException("processor"); } var tokens = Split(line); if (tokens.Length <= 0) { return(false); } if (!tokens[0].Equals("#l", StringComparison.Ordinal)) { return(false); } var directoryPath = GetAbsoluteDirectory(currentScriptPath); var scriptPath = new FilePath(tokens[1].UnQuote()).MakeAbsolute(directoryPath); processor.Process(scriptPath, context); return(true); }
public BuildFeatureFixture( FakeFileSystem fileSystem = null, FakeEnvironment environment = null, TestContainerConfigurator bootstrapper = null, FakeLog log = null, FakeConsole console = null, IModuleSearcher moduleSearcher = null) { Environment = environment ?? FakeEnvironment.CreateUnixEnvironment(); FileSystem = fileSystem ?? new FakeFileSystem(Environment); Bootstrapper = bootstrapper ?? new TestContainerConfigurator(); ScriptEngine = new FakeScriptEngine(); Debugger = new FakeDebugger(); Log = log ?? new FakeLog(); Console = console ?? new FakeConsole(); ModuleSearcher = moduleSearcher ?? Substitute.For <IModuleSearcher>(); Processor = Substitute.For <IScriptProcessor>(); // Create working directory. FileSystem.CreateDirectory(Environment.WorkingDirectory); // Set the default script SetScript("/Working/build.cake", GetDefaultScriptContent()); Bootstrapper.RegisterOverrides(registrar => { registrar.RegisterInstance(FileSystem).As <IFileSystem>(); registrar.RegisterInstance(Environment).As <ICakeEnvironment>(); registrar.RegisterInstance(ScriptEngine).As <IScriptEngine>(); registrar.RegisterInstance(Debugger).As <ICakeDebugger>(); registrar.RegisterInstance(Log).As <ICakeLog>(); registrar.RegisterInstance(Processor).As <IScriptProcessor>(); }); }
public CakeScriptGenerator( IBufferedFileSystem fileSystem, ICakeEnvironment environment, IGlobber globber, ICakeConfiguration configuration, IScriptProcessor processor, IScriptAliasFinder aliasFinder, ICakeAliasGenerator aliasGenerator, ICakeLog log, IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders = null) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _globber = globber ?? throw new ArgumentNullException(nameof(globber)); _log = log ?? throw new ArgumentNullException(nameof(log)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _aliasFinder = aliasFinder ?? throw new ArgumentNullException(nameof(aliasFinder)); _aliasGenerator = aliasGenerator ?? throw new ArgumentNullException(nameof(aliasGenerator)); _analyzer = new ScriptAnalyzer(_fileSystem, _environment, _log, loadDirectiveProviders); _addinRoot = GetAddinPath(_environment.WorkingDirectory); _cakeRoot = GetCakePath(GetToolPath(_environment.WorkingDirectory)); _hostObject = GetHostObject(_cakeRoot); _defaultReferences = new Lazy <ISet <FilePath> >(() => GetDefaultReferences(_cakeRoot)); }
public WebServer(int port, string root) { /* this script processor instance will be used to process files of type * csscript */ _scriptProcessor = new CscriptProcessor(); /*TODO: add another instance of a IScriptProcessor to handle files of * type csweb */ _webTemplateProcessor = new CWebTemplateProcessor(); /* set the root for the server */ _webRoot = root; /* create a TcpListener to listen for netweork requests on the provided * port number at the lookedup host address and start listening */ TcpListener listener = new TcpListener( Dns.GetHostAddresses("localhost")[0], port); listener.Start(); Console.WriteLine("Web server listening on port {0}", port); /* main body of the web server, this will listen for requests, * open a socket with the client when a request is received * and spawn a process thread for accepting the request and * return to listen for the next request */ while (true) { Socket soc = listener.AcceptSocket(); new Task(delegate() { AcceptRequest(soc); }).Start(); } }
/// <summary> /// Recursively execute a list of scripts; will set section.Success /// </summary> /// <param name="scripts">The section.Scripts</param> /// <param name="section">The section itself, used to set section.Success</param> void RecurseScripts(List <Script> scripts, Section section, IConnectionSettings cs) { foreach (Script s in scripts) { OnStepProgress("RecurseScripts", string.Format("Starting Script:{0}", s.Path)); IScriptProcessor p = ScriptProcessorUtil.GetProcessorInstance(_wfp.DatabaseType); p.PathHelper = _ph; p.WorkflowParameters = _wfp; p.StepProgress += p_StepProgress; p.Start(s, cs, _wfp.AuditProcedures, _variables); OnStepProgress("RecurseScripts", string.Format("Finished Script:{0}, Success:{1}", s.Path, s.Success)); if (s.Success) { RecurseScripts(s.SuccessScripts, section, cs); } else { if (s.FailBranchOnError) { if (s.FailSectionOnError) { section.Success = false; } break; } else { RecurseScripts(s.FailScripts, section, cs); } } } }
public CakeScriptGenerator( IBufferedFileSystem fileSystem, ICakeEnvironment environment, IGlobber globber, ICakeConfiguration configuration, IScriptProcessor processor, IScriptAliasFinder aliasFinder, ICakeLog log, IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders = null) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _globber = globber ?? throw new ArgumentNullException(nameof(globber)); _log = log ?? throw new ArgumentNullException(nameof(log)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _aliasFinder = aliasFinder ?? throw new ArgumentNullException(nameof(fileSystem)); _analyzer = new ScriptAnalyzer(_fileSystem, _environment, _log, loadDirectiveProviders); var typeEmitter = new TypeEmitter(); var parameterEmitter = new ParameterEmitter(typeEmitter); _methodGenerator = new CakeMethodAliasGenerator(typeEmitter, parameterEmitter); _propertyGenerator = new CakePropertyAliasGenerator(typeEmitter); }
public WebServer(int port, string root) { /* this script processor instance will be used to process files of type * csscript */ _scriptProcessor = new CscriptProcessor(); /*TODO: add another instance of a IScriptProcessor to handle files of * type csweb */ /* set the root for the server */ _webRoot = root; /* create a TcpListener to listen for netweork requests on the provided * port number at the lookedup host address and start listening */ TcpListener listener = new TcpListener( Dns.GetHostAddresses("localhost")[0], port); listener.Start(); Console.WriteLine("Web server listening on port {0}", port); /* main body of the web server, this will listen for requests, * open a socket with the client when a request is received * and spawn a process thread for accepting the request and * return to listen for the next request */ while (true) { Socket soc = listener.AcceptSocket(); new Task(delegate() { AcceptRequest(soc); }).Start(); } }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { if (context == null) { throw new ArgumentNullException("context"); } var tokens = Split(line); if (tokens.Length <= 0) { return(false); } if (!tokens[0].Equals("#r", StringComparison.Ordinal) && !tokens[0].Equals("#reference", StringComparison.Ordinal)) { return(false); } var referencePath = new FilePath(tokens[1].UnQuote()); var directoryPath = GetAbsoluteDirectory(currentScriptPath); var absoluteReferencePath = referencePath.MakeAbsolute(directoryPath); context.AddReference(_fileSystem.Exist(absoluteReferencePath) ? absoluteReferencePath.FullPath : referencePath.FullPath); return(true); }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { if (context == null) { throw new ArgumentNullException("context"); } var tokens = Split(line); if (tokens.Length <= 0) { return(false); } if (!tokens[0].Equals("using", StringComparison.Ordinal)) { return(false); } var @namespace = tokens[1].TrimEnd(';'); context.AddNamespace(@namespace); return(true); }
public WebForm(string uri, string name, IScriptProcessor service) { Uri = uri; AddProcessor(name, service); InitializeComponent(); Load += WebForm_Load; FormClosing += WebForm_FormClosing; }
/// <summary> /// Initializes a new instance of the <see cref="ScriptRunner"/> class. /// </summary> /// <param name="environment">The environment.</param> /// <param name="log">The log.</param> /// <param name="configuration">The configuration.</param> /// <param name="engine">The session factory.</param> /// <param name="aliasFinder">The alias finder.</param> /// <param name="analyzer">The script analyzer.</param> /// <param name="processor">The script processor.</param> /// <param name="conventions">The script conventions.</param> /// <param name="assemblyLoader">The assembly loader.</param> public ScriptRunner( ICakeEnvironment environment, ICakeLog log, ICakeConfiguration configuration, IScriptEngine engine, IScriptAliasFinder aliasFinder, IScriptAnalyzer analyzer, IScriptProcessor processor, IScriptConventions conventions, IAssemblyLoader assemblyLoader) { if (environment == null) { throw new ArgumentNullException(nameof(environment)); } if (log == null) { throw new ArgumentNullException(nameof(log)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (engine == null) { throw new ArgumentNullException(nameof(engine)); } if (aliasFinder == null) { throw new ArgumentNullException(nameof(aliasFinder)); } if (analyzer == null) { throw new ArgumentNullException(nameof(analyzer)); } if (processor == null) { throw new ArgumentNullException(nameof(processor)); } if (conventions == null) { throw new ArgumentNullException(nameof(conventions)); } if (assemblyLoader == null) { throw new ArgumentNullException(nameof(assemblyLoader)); } _environment = environment; _log = log; _configuration = configuration; _engine = engine; _aliasFinder = aliasFinder; _analyzer = analyzer; _processor = processor; _conventions = conventions; _assemblyLoader = assemblyLoader; }
public BusinessLogic(ILogger logger, IScriptProcessor scriptProcessor, IFileProcessor fileProcessor, IEmailProcessor emailProcessor, IDatabaseLogic databaseLogic) { curlDetails = new CurlDetails(); this.logger = logger; this.scriptProcessor = scriptProcessor; this.fileProcessor = fileProcessor; this.emailProcessor = emailProcessor; this.databaseLogic = databaseLogic; }
public BootstrapCommand( IScriptAnalyzer analyzer, ICakeConfiguration configuration, IScriptProcessor processor, ICakeEnvironment environment) { _analyzer = analyzer; _configuration = configuration; _processor = processor; _environment = environment; }
public CacheModule(IScriptAliasFinder aliasFinder, IScriptProcessor processor, ICakeEnvironment environment, ICakeAliasGenerator aliasGenerator, IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders) { _aliasFinder = aliasFinder ?? throw new ArgumentNullException(nameof(aliasFinder)); _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _aliasGenerator = aliasGenerator ?? throw new ArgumentNullException(nameof(aliasGenerator)); _loadDirectiveProviders = loadDirectiveProviders ?? throw new ArgumentNullException(nameof(loadDirectiveProviders)); }
/// <summary> /// Initializes a new instance of the <see cref="ScriptRunner"/> class. /// </summary> /// <param name="environment">The environment.</param> /// <param name="log">The log.</param> /// <param name="configuration">The configuration.</param> /// <param name="engine">The session factory.</param> /// <param name="aliasFinder">The alias finder.</param> /// <param name="analyzer">The script analyzer.</param> /// <param name="processor">The script processor.</param> /// <param name="conventions">The script conventions.</param> public ScriptRunner( ICakeEnvironment environment, ICakeLog log, ICakeConfiguration configuration, IScriptEngine engine, IScriptAliasFinder aliasFinder, IScriptAnalyzer analyzer, IScriptProcessor processor, IScriptConventions conventions) { if (environment == null) { throw new ArgumentNullException("environment"); } if (log == null) { throw new ArgumentNullException("log"); } if (configuration == null) { throw new ArgumentNullException("configuration"); } if (engine == null) { throw new ArgumentNullException("engine"); } if (aliasFinder == null) { throw new ArgumentNullException("aliasFinder"); } if (analyzer == null) { throw new ArgumentNullException("analyzer"); } if (processor == null) { throw new ArgumentNullException("processor"); } if (conventions == null) { throw new ArgumentNullException("conventions"); } _environment = environment; _log = log; _configuration = configuration; _engine = engine; _aliasFinder = aliasFinder; _analyzer = analyzer; _processor = processor; _conventions = conventions; }
/// <summary> /// Initializes a new instance of the <see cref="ScriptRunner"/> class. /// </summary> /// <param name="engine">The session factory.</param> /// <param name="aliasFinder">The alias finder.</param> /// <param name="scriptProcessor">The script processor.</param> public ScriptRunner(IScriptEngine engine, IScriptAliasFinder aliasFinder, IScriptProcessor scriptProcessor) { if (engine == null) { throw new ArgumentNullException("engine"); } if (aliasFinder == null) { throw new ArgumentNullException("aliasFinder"); } _engine = engine; _aliasFinder = aliasFinder; _scriptProcessor = scriptProcessor; }
/// <summary> /// Initializes a new instance of the <see cref="ScriptRunner"/> class. /// </summary> /// <param name="sessionFactory">The session factory.</param> /// <param name="aliasGenerator">The alias generator.</param> /// <param name="scriptProcessor">The script processor.</param> public ScriptRunner(IScriptSessionFactory sessionFactory, IScriptAliasGenerator aliasGenerator, IScriptProcessor scriptProcessor) { if (sessionFactory == null) { throw new ArgumentNullException("sessionFactory"); } if (aliasGenerator == null) { throw new ArgumentNullException("aliasGenerator"); } _sessionFactory = sessionFactory; _aliasGenerator = aliasGenerator; _scriptProcessor = scriptProcessor; }
/// <summary> /// Initializes a new instance of a script processor. /// </summary> /// <param name="databaseType">The type for which to create a script processor</param> /// <returns>A new instance of a script processor.</returns> public static IScriptProcessor GetProcessorInstance(DatabaseType databaseType) { IScriptProcessor sp = null; switch (databaseType) { case DatabaseType.Oracle: { sp = new OracleScriptProcessor(); break; } case DatabaseType.SqlServer: { sp = new SqlServerScriptProcessor(); break; } } return(sp); }
/* This method will process a script file and send the results as the * body of the response */ private void _GenerateScriptResult(IScriptProcessor processor, Socket socket, string path, Dictionary <string, string> requestParameters) { /* get a script result from the scrupt processor using the request parameter dictionary */ ScriptResult result; using (FileStream fs = File.OpenRead(path)) { result = processor.ProcessScript(fs, requestParameters); } /* if the result was an error, send an HTTP Error (500) along wiht a summary of * what went wrong as the body */ if (result.Error) { _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.ERROR); } else { /* send a response with the results of the script evaluation */ _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.OK); } }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { if (context == null) { throw new ArgumentNullException("context"); } var tokens = Split(line); if (tokens.Length <= 1) { return(false); } if (!tokens[0].Equals("using", StringComparison.Ordinal)) { return(false); } // Using block? var @namespace = tokens[1].TrimEnd(';'); if (@namespace.StartsWith("(")) { return(false); } // Using alias directive? if (tokens.Any(t => t == "=")) { context.AddUsingAliasDirective(string.Join(" ", tokens)); return(true); } // Namespace context.AddNamespace(@namespace); return(true); }
public ScriptRunner(IFileSystem fileSystem, ICakeEnvironment environment, CakeArguments arguments, IScriptSessionFactory sessionFactory, IScriptAliasGenerator aliasGenerator, IScriptProcessor processor, IScriptHost host) { if (fileSystem == null) { throw new ArgumentNullException("fileSystem"); } if (environment == null) { throw new ArgumentNullException("environment"); } if (arguments == null) { throw new ArgumentNullException("arguments"); } if (sessionFactory == null) { throw new ArgumentNullException("sessionFactory"); } if (aliasGenerator == null) { throw new ArgumentNullException("aliasGenerator"); } if (host == null) { throw new ArgumentNullException("host"); } _fileSystem = fileSystem; _environment = environment; _arguments = arguments; _sessionFactory = sessionFactory; _aliasGenerator = aliasGenerator; _processor = processor; _host = host; }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { if (context == null) { throw new ArgumentNullException("context"); } var tokens = Split(line); var directive = tokens.FirstOrDefault(); if (string.IsNullOrWhiteSpace(directive)) { return(false); } if (!directive.Equals("#addin", StringComparison.OrdinalIgnoreCase)) { return(false); } // Fetch the addin NuGet ID. var addInId = tokens .Select(value => value.UnQuote()) .Skip(1).FirstOrDefault(); if (string.IsNullOrWhiteSpace(addInId)) { return(false); } // Fetch optional NuGet source. var source = tokens .Skip(2) .Select(value => value.UnQuote()) .FirstOrDefault(); // Get the directory path to Cake. var applicationRoot = _environment.GetApplicationRoot(); // Get the addin directory. var addInRootDirectoryPath = applicationRoot .Combine("..\\Addins") .Collapse() .MakeAbsolute(_environment); var addInDirectoryPath = addInRootDirectoryPath.Combine(addInId); var addInRootDirectory = _fileSystem.GetDirectory(addInRootDirectoryPath); // Create the addin directory if it doesn't exist. if (!addInRootDirectory.Exists) { _log.Verbose("Creating addin directory {0}", addInRootDirectoryPath.FullPath); addInRootDirectory.Create(); } // Fetch available addin assemblies. var addInAssemblies = GetAddInAssemblies(addInDirectoryPath); // If no assemblies were found, try install addin from NuGet. if (addInAssemblies.Length == 0) { InstallAddin(addInId, addInRootDirectory, source); addInAssemblies = GetAddInAssemblies(addInDirectoryPath); } // Validate found assemblies. if (addInAssemblies.Length == 0) { throw new CakeException("Failed to find AddIn assemblies"); } // Reference found assemblies. foreach (var assemblyPath in addInAssemblies.Select(assembly => assembly.Path.FullPath)) { _log.Verbose("Addin: {0}, adding Reference {1}", addInId, assemblyPath); context.AddReference(assemblyPath); } return(true); }
public void AddProcessor(string name, IScriptProcessor processor) { processors[name] = processor; }
public ExecuteScriptCommand(IDbContext dbContext, IScriptProcessor scriptProcessor) { _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); _scriptProcessor = scriptProcessor ?? throw new ArgumentNullException(nameof(scriptProcessor)); }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { if (context == null) { throw new ArgumentNullException("context"); } var tokens = Split(line); var directive = tokens.FirstOrDefault(); if (string.IsNullOrWhiteSpace(directive)) { return(false); } if (!directive.Equals("#tool", StringComparison.OrdinalIgnoreCase)) { return(false); } // Fetch the tool NuGet ID. var toolId = tokens .Select(value => value.UnQuote()) .Skip(1).FirstOrDefault(); if (string.IsNullOrWhiteSpace(toolId)) { return(false); } // Fetch optional NuGet source. var source = tokens .Skip(2) .Select(value => value.UnQuote()) .FirstOrDefault(); // Get the directory path to Cake. var applicationRoot = _environment.WorkingDirectory; // Get the tool directory. var toolsRootDirectoryPath = applicationRoot .Combine(".\\tools") .Collapse() .MakeAbsolute(_environment); var toolDirectoryPath = toolsRootDirectoryPath.Combine(toolId); var toolsRootDirectory = _fileSystem.GetDirectory(toolsRootDirectoryPath); // Create the tool directory if it doesn't exist. if (!toolsRootDirectory.Exists) { _log.Verbose("Creating tool directory {0}", toolsRootDirectoryPath.FullPath); toolsRootDirectory.Create(); } // Fetch available tool executables. var toolExecutables = GetToolExecutables(toolDirectoryPath); // If no executables were found, try install tool from NuGet. if (toolExecutables.Length == 0) { InstallTool(toolId, toolsRootDirectory, source); toolExecutables = GetToolExecutables(toolDirectoryPath); } // Validate found assemblies. if (toolExecutables.Length == 0) { throw new CakeException("Failed to find tool executables."); } _log.Debug(logAction => { foreach (var toolExecutable in toolExecutables) { logAction("Found tool executable: {0}.", toolExecutable.Path); } }); return(true); }
public PrintViewApiHttpService(IDocumentApi documentApi, IPrintViewApi printViewApi, IScriptProcessor scriptProcessor) { _documentApi = documentApi; _printViewApi = printViewApi; _scriptProcessor = scriptProcessor; }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public abstract bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line);
public CachingScriptProcessor(IScriptProcessor processor) { _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _cache = new Dictionary <PackageReference, IReadOnlyList <FilePath> >(new PackageReferenceComparer()); }
public CacheModule(IScriptAliasFinder aliasFinder, IScriptProcessor processor, ICakeEnvironment environment) { _aliasFinder = aliasFinder ?? throw new ArgumentNullException(nameof(aliasFinder)); _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); }
/// <summary> /// Processes the specified line. /// </summary> /// <param name="processor">The script processor.</param> /// <param name="context">The script processor context.</param> /// <param name="currentScriptPath">The current script path.</param> /// <param name="line">The line to process.</param> /// <returns> /// <c>true</c> if the processor handled the line; otherwise <c>false</c>. /// </returns> public override bool Process(IScriptProcessor processor, ScriptProcessorContext context, FilePath currentScriptPath, string line) { // Remove all shebang lines that we encounter. return(line.StartsWith("#!", StringComparison.OrdinalIgnoreCase)); }
private void _GenerateDynamicResult(IScriptProcessor processor, Socket socket, string path, Dictionary<string, string> requestParameters) { /* get a script result from the scrupt processor using the request parameter dictionary */ ScriptResult result = processor.ProcessScript(path, requestParameters); /* if the result was an error, send an HTTP Error (500) along wiht a summary of * what went wrong as the body */ if (result.Error) { _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.ERROR); } else { /* send a response with the results of the script evaluation */ _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.OK); } }