Example #1
0
        private static void HandleHooks(GitHookContext fileParseResult)
        {
            var assembly = Assembly.LoadFrom(fileParseResult.AssemblyPath);
            var types    = assembly.GetTypes().Where(o => !o.IsInterface && typeof(IGitHook).IsAssignableFrom(o));

            foreach (var type in types)
            {
                HandleHook(fileParseResult, type);
            }
        }
Example #2
0
        static BaseHookHandler GetHandler(GitHookContext context)
        {
            switch (context.Type)
            {
            case HookType.PreCommit:
                return(new PreCommitHookHandler(context));

            default:
                throw new NotSupportedException();
            }
        }
Example #3
0
        static void HandleHook(GitHookContext context, Type type)
        {
            var handler = GetHandler(context);

            handler.Handle(type);
        }
Example #4
0
 public PreCommitHookHandler(GitHookContext context)
 {
     _context = context;
 }