public void ExecutePreInstall_ExecutesDiscoveredHooks()
        {
            var fakeHook = new Hook("file.txt", HookType.File);
            _finder.Setup(x => x.DiscoverHooks()).Returns(new Hooks {PreInstall = new List<Hook> {fakeHook}});

            _ihe.ExecutePreInstall();

            _fakeHookRunner.Verify(x => x.ExecuteHook(fakeHook, null), Times.Once());
        }
        public void ExecuteHook(Hook hook, string arguments = null)
        {
            _log.Info("Executing package hookFileName: " + hook.FileName);

            var hookFilename = hook.FileName;
            var startInfo = new ProcessStartInfo
                {
                    FileName = hookFilename,
                    Arguments = arguments ?? string.Empty,
                    RedirectStandardOutput = true,
                    UseShellExecute = false,
                };

            CopyVariablesToEnvironment(startInfo);
            PrefixCommonScriptRuntimes(hookFilename, startInfo);
            StartProcess(hookFilename, startInfo);
        }
 public bool SupportsHook(Hook hook)
 {
     return hook.Type == HookType.File;
 }
Ejemplo n.º 4
0
 public bool SupportsHook(Hook hook)
 {
     return hook.Type == HookType.Class;
 }
Ejemplo n.º 5
0
 public void ExecuteHook(Hook hook, string arguments = null)
 {
     _log.Info("Executing plugin hook: " + hook);
     var classs = (IHook)Activator.CreateInstance(hook.Class);
     classs.Execute(_config);
 }