Skip to content

Commit 2e5048e

Browse files
author
Aiden Scandella
committed
Add Configuration with templates
Part of the default behavior of this project will change when it is released as a gem, since we no longer wish to install *all* of the hooks in here by default. I create a 'default' template, which ignores a subset of checks that are Causes/gerrit-specific. Not used yet, but soon... Change-Id: I807601c2b8a83477ad72eeff198ae218c780d4fb Reviewed-on: https://gerrit.causes.com/22692 Tested-by: Aiden Scandella <aiden@causes.com> Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
1 parent e5fcf95 commit 2e5048e

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

config/templates.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
default:
2+
excludes:
3+
pre_commit:
4+
- causes_email
5+
- test_history
6+
- restricted_paths
7+
commit_msg:
8+
- change_id

lib/overcommit.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'overcommit/configuration'
12
require 'overcommit/console_methods'
23
require 'overcommit/git_hook'
34
require 'overcommit/hook_specific_check'

lib/overcommit/configuration.rb

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'singleton'
2+
require 'yaml'
3+
4+
module Overcommit
5+
class Configuration
6+
include Singleton
7+
8+
attr_reader :templates
9+
10+
def initialize
11+
@templates = YAML::load_file(File.join(File.dirname(
12+
File.expand_path(__FILE__)), '..', '..', 'config', 'templates.yml'))
13+
end
14+
end
15+
16+
def self.config
17+
Configuration.instance
18+
end
19+
end

0 commit comments

Comments
 (0)