예제 #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);
            }
        }
예제 #2
0
        static BaseHookHandler GetHandler(GitHookContext context)
        {
            switch (context.Type)
            {
            case HookType.PreCommit:
                return(new PreCommitHookHandler(context));

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

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