Beispiel #1
0
        public RuntimeServices(
            ILogProvider logProvider,
            IDictionary <Type, object> overrides,
            IConsole console,
            Type scriptEngineType,
            Type scriptExecutorType,
            Type replType,
            bool initDirectoryCatalog,
            IInitializationServices initializationServices,
            string scriptName, IEnumerable <Assembly> applicationAssemblies)
            : base(logProvider, overrides)
        {
            if (logProvider == null)
            {
                throw new ArgumentNullException(nameof(logProvider));
            }

            _log                    = logProvider.ForCurrentType();
            _console                = console;
            _scriptEngineType       = scriptEngineType;
            _scriptExecutorType     = scriptExecutorType;
            _replType               = replType;
            _initDirectoryCatalog   = initDirectoryCatalog;
            _initializationServices = initializationServices;
            _scriptName             = scriptName;
            _applicationAssemblies  = applicationAssemblies;
        }
Beispiel #2
0
 public ScriptServicesBuilder(IConsole console, ILog logger, IRuntimeServices runtimeServices = null)
 {
     _initializationServices = new InitializationServices(logger);
     _runtimeServices        = runtimeServices;
     _console = console;
     _logger  = logger;
 }
Beispiel #3
0
        public CommandFactory(IScriptServicesBuilder scriptServicesBuilder)
        {
            if (scriptServicesBuilder == null)
            {
                throw new ArgumentNullException(nameof(scriptServicesBuilder));
            }

            _scriptServicesBuilder  = scriptServicesBuilder;
            _initializationServices = _scriptServicesBuilder.InitializationServices;
            _fileSystem             = _initializationServices.GetFileSystem();

            if (_fileSystem.PackagesFile == null)
            {
                throw new ArgumentException(
                          "The file system provided by the initialization services provided by the script services builder has a null packages file.",
                          "scriptServicesBuilder");
            }

            if (_fileSystem.PackagesFolder == null)
            {
                throw new ArgumentException(
                          "The file system provided by the initialization services provided by the script services builder has a null package folder.",
                          "scriptServicesBuilder");
            }
        }
Beispiel #4
0
        private Repl GetRepl(string[] args, out MemoryBufferConsole memoryBufferConsole)
        {
            SetProfile();
            var arguments             = ParseArguments(args);
            var scriptServicesBuilder = ScriptServicesBuilderFactory.Create(arguments.CommandArguments, arguments.ScriptArguments);
            IInitializationServices _initializationServices = scriptServicesBuilder.InitializationServices;
            IFileSystem             _fileSystem             = _initializationServices.GetFileSystem();

            if (_fileSystem.PackagesFile == null)
            {
                throw new ArgumentException("The file system provided by the initialization services provided by the script services builder has a null packages file.");
            }

            if (_fileSystem.PackagesFolder == null)
            {
                throw new ArgumentException("The file system provided by the initialization services provided by the script services builder has a null package folder.");
            }

            ScriptServices scriptServices = scriptServicesBuilder.Build();

            memoryBufferConsole = new MemoryBufferConsole();
            Repl repl = new Repl(arguments.ScriptArguments, _fileSystem, scriptServices.Engine,
                                 scriptServices.ObjectSerializer, scriptServices.Logger, memoryBufferConsole,
                                 scriptServices.FilePreProcessor, scriptServices.ReplCommands);

            var workingDirectory = _fileSystem.CurrentDirectory;
            var assemblies       = scriptServices.AssemblyResolver.GetAssemblyPaths(workingDirectory);
            var scriptPacks      = scriptServices.ScriptPackResolver.GetPacks();

            repl.Initialize(assemblies, scriptPacks, null);

            return(repl);
        }
Beispiel #5
0
 public RuntimeServices(ILog logger, IDictionary <Type, object> overrides, IConsole console, Type scriptEngineType, Type scriptExecutorType, bool initDirectoryCatalog, IInitializationServices initializationServices) :
     base(logger, overrides)
 {
     _console                = console;
     _scriptEngineType       = scriptEngineType;
     _scriptExecutorType     = scriptExecutorType;
     _initDirectoryCatalog   = initDirectoryCatalog;
     _initializationServices = initializationServices;
 }
Beispiel #6
0
 public RuntimeServices(ILog logger, IDictionary<Type, object> overrides, IConsole console, Type scriptEngineType, Type scriptExecutorType, bool initDirectoryCatalog, IInitializationServices initializationServices)
     : base(logger, overrides)
 {
     _console = console;
     _scriptEngineType = scriptEngineType;
     _scriptExecutorType = scriptExecutorType;
     _initDirectoryCatalog = initDirectoryCatalog;
     _initializationServices = initializationServices;
 }
 public PvcScriptServicesBuilder(IConsole console, ILog logger, IRuntimeServices runtimeServices = null, ITypeResolver typeResolver = null, IInitializationServices initializationServices = null)
     : base(console: console,
         logger: logger,
         runtimeServices: runtimeServices,
         typeResolver: typeResolver,
         initializationServices: initializationServices ?? BuildInitializationServices(logger))
 {
     this.FileSystem<PvcFileSystem>()
         .PackageContainer<PvcPackageContainer>();
 }
Beispiel #8
0
 public ScriptServicesBuilder(
     IConsole console,
     ILogProvider logProvider,
     IRuntimeServices runtimeServices = null,
     IInitializationServices initializationServices = null)
 {
     InitializationServices = initializationServices ?? new InitializationServices(logProvider);
     _runtimeServices       = runtimeServices;
     ConsoleInstance        = console;
     _logProvider           = logProvider;
 }
 public RuntimeServices(ILog logger, IDictionary <Type, object> overrides, IList <Type> lineProcessors, IConsole console, Type scriptEngineType, Type scriptExecutorType, bool initDirectoryCatalog, IInitializationServices initializationServices, string scriptName) :
     base(logger, overrides)
 {
     _lineProcessors         = lineProcessors;
     _console                = console;
     _scriptEngineType       = scriptEngineType;
     _scriptExecutorType     = scriptExecutorType;
     _initDirectoryCatalog   = initDirectoryCatalog;
     _initializationServices = initializationServices;
     _scriptName             = scriptName;
 }
Beispiel #10
0
 public RuntimeServices(ILog logger, IDictionary<Type, object> overrides, IList<Type> lineProcessors, IConsole console, Type scriptEngineType, Type scriptExecutorType, bool initDirectoryCatalog, IInitializationServices initializationServices, string scriptName)
     : base(logger, overrides)
 {
     _lineProcessors = lineProcessors;
     _console = console;
     _scriptEngineType = scriptEngineType;
     _scriptExecutorType = scriptExecutorType;
     _initDirectoryCatalog = initDirectoryCatalog;
     _initializationServices = initializationServices;
     _scriptName = scriptName;
 }
Beispiel #11
0
 public ScriptServicesBuilder(
     IConsole console,
     ILog logger,
     IRuntimeServices runtimeServices = null,
     ITypeResolver typeResolver       = null,
     IInitializationServices initializationServices = null)
 {
     InitializationServices = initializationServices ?? new InitializationServices(logger);
     _runtimeServices       = runtimeServices;
     _typeResolver          = typeResolver;
     _typeResolver          = typeResolver ?? new TypeResolver();
     ConsoleInstance        = console;
     _logger = logger;
 }
Beispiel #12
0
 public ScriptServicesBuilder(
     IConsole console,
     Common.Logging.ILog logger,
     IRuntimeServices runtimeServices = null,
     ITypeResolver typeResolver       = null,
     IInitializationServices initializationServices = null)
     : this(
         console,
         new CommonLoggingLogProvider(logger),
         runtimeServices,
         typeResolver,
         initializationServices)
 {
 }
Beispiel #13
0
        public CommandFactory(IScriptServicesBuilder scriptServicesBuilder)
        {
            Guard.AgainstNullArgument("scriptServicesBuilder", scriptServicesBuilder);

            _scriptServicesBuilder = scriptServicesBuilder;
            _initializationServices = _scriptServicesBuilder.InitializationServices;
            _fileSystem = _initializationServices.GetFileSystem();

            if (_fileSystem.PackagesFile == null)
            {
                throw new ArgumentException("The file system provided by the initialization services provided by the script services builder has a null packages file.");
            }

            if (_fileSystem.PackagesFolder == null)
            {
                throw new ArgumentException("The file system provided by the initialization services provided by the script services builder has a null package folder.");
            }
        }
Beispiel #14
0
 public RuntimeServices(
     Common.Logging.ILog logger,
     IDictionary<Type, object> overrides,
     IConsole console,
     Type scriptEngineType,
     Type scriptExecutorType,
     Type replType,
     bool initDirectoryCatalog,
     IInitializationServices initializationServices,
     string scriptName)
     : this(new CommonLoggingLogProvider(logger),
         overrides,
         console,
         scriptEngineType,
         scriptExecutorType,
         replType,
         initDirectoryCatalog,
         initializationServices,
         scriptName)
 {
 }
Beispiel #15
0
 public RuntimeServices(
     Common.Logging.ILog logger,
     IDictionary <Type, object> overrides,
     IConsole console,
     Type scriptEngineType,
     Type scriptExecutorType,
     Type replType,
     bool initDirectoryCatalog,
     IInitializationServices initializationServices,
     string scriptName)
     : this(
         new CommonLoggingLogProvider(logger),
         overrides,
         console,
         scriptEngineType,
         scriptExecutorType,
         replType,
         initDirectoryCatalog,
         initializationServices,
         scriptName)
 {
 }
Beispiel #16
0
        public RuntimeServices(
            ILogProvider logProvider,
            IDictionary <Type, object> overrides,
            IConsole console,
            Type scriptEngineType,
            Type scriptExecutorType,
            Type replType,
            bool initDirectoryCatalog,
            IInitializationServices initializationServices,
            string scriptName)
            : base(logProvider, overrides)
        {
            Guard.AgainstNullArgument("logProvider", logProvider);

            _log                    = logProvider.ForCurrentType();
            _console                = console;
            _scriptEngineType       = scriptEngineType;
            _scriptExecutorType     = scriptExecutorType;
            _replType               = replType;
            _initDirectoryCatalog   = initDirectoryCatalog;
            _initializationServices = initializationServices;
            _scriptName             = scriptName;
        }
Beispiel #17
0
        public RuntimeServices(
            ILogProvider logProvider,
            IDictionary<Type, object> overrides,
            IConsole console,
            Type scriptEngineType,
            Type scriptExecutorType,
            Type replType,
            bool initDirectoryCatalog,
            IInitializationServices initializationServices,
            string scriptName)
            : base(logProvider, overrides)
        {
            Guard.AgainstNullArgument("logProvider", logProvider);

            _log = logProvider.ForCurrentType();
            _console = console;
            _scriptEngineType = scriptEngineType;
            _scriptExecutorType = scriptExecutorType;
            _replType = replType;
            _initDirectoryCatalog = initDirectoryCatalog;
            _initializationServices = initializationServices;
            _scriptName = scriptName;
        }
Beispiel #18
0
 public PvcScriptServicesBuilder(IConsole console, ILog logger, IRuntimeServices runtimeServices = null, ITypeResolver typeResolver = null, IInitializationServices initializationServices = null)
     : base(
         console: console,
         logger: logger,
         runtimeServices: runtimeServices,
         typeResolver: typeResolver,
         initializationServices: initializationServices ?? BuildInitializationServices(logger)
         )
 {
     this.FileSystem <PvcFileSystem>()
     .PackageContainer <PvcPackageContainer>();
 }