Skip to content

Commit 3588789

Browse files
committed
Rename OVERCOMMIT_HOME constant to Overcommit::HOME
Since this was already in the `Overcommit` namespace, the `OVERCOMMIT_` prefix was unnecessary.
1 parent 9e75803 commit 3588789

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

lib/overcommit/cli.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def install_or_uninstall
128128
end
129129

130130
def print_template_directory_path
131-
puts File.join(OVERCOMMIT_HOME, 'template-dir')
131+
puts File.join(Overcommit::HOME, 'template-dir')
132132
halt
133133
end
134134

lib/overcommit/configuration.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def plugin_hook?(hook_context_or_type, hook_name)
147147
def built_in_hook?(hook_context, hook_name)
148148
hook_name = Overcommit::Utils.snake_case(hook_name)
149149

150-
File.exist?(File.join(OVERCOMMIT_HOME, 'lib', 'overcommit', 'hook',
150+
File.exist?(File.join(Overcommit::HOME, 'lib', 'overcommit', 'hook',
151151
hook_context.hook_type_name, "#{hook_name}.rb"))
152152
end
153153

lib/overcommit/configuration_loader.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Overcommit
44
# Manages configuration file loading.
55
class ConfigurationLoader
6-
DEFAULT_CONFIG_PATH = File.join(OVERCOMMIT_HOME, 'config', 'default.yml')
6+
DEFAULT_CONFIG_PATH = File.join(Overcommit::HOME, 'config', 'default.yml')
77

88
class << self
99
# Loads and returns the configuration for the repository we're running in.

lib/overcommit/constants.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Global application constants.
22
module Overcommit
3-
OVERCOMMIT_HOME = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
3+
HOME = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
44
CONFIG_FILE_NAME = '.overcommit.yml'
55

6-
HOOK_DIRECTORY = File.join(OVERCOMMIT_HOME, 'lib', 'overcommit', 'hook')
6+
HOOK_DIRECTORY = File.join(HOME, 'lib', 'overcommit', 'hook')
77

88
REPO_URL = 'https://github.com/brigade/overcommit'
99
BUG_REPORT_URL = "#{REPO_URL}/issues"

lib/overcommit/installer.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Overcommit
44
# Manages the installation of Overcommit hooks in a git repository.
55
class Installer # rubocop:disable ClassLength
6-
TEMPLATE_DIRECTORY = File.join(OVERCOMMIT_HOME, 'template-dir')
6+
TEMPLATE_DIRECTORY = File.join(Overcommit::HOME, 'template-dir')
77
MASTER_HOOK = File.join(TEMPLATE_DIRECTORY, 'hooks', 'overcommit-hook')
88

99
def initialize(logger)
@@ -171,7 +171,7 @@ def install_starter_config
171171
repo_config_file = File.join(@target, Overcommit::CONFIG_FILE_NAME)
172172

173173
return if File.exist?(repo_config_file)
174-
FileUtils.cp(File.join(OVERCOMMIT_HOME, 'config', 'starter.yml'), repo_config_file)
174+
FileUtils.cp(File.join(Overcommit::HOME, 'config', 'starter.yml'), repo_config_file)
175175
end
176176

177177
def overcommit_hook?(file)

lib/overcommit/utils.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Version < Gem::Version
2424

2525
class << self
2626
def script_path(script)
27-
File.join(OVERCOMMIT_HOME, 'libexec', script)
27+
File.join(Overcommit::HOME, 'libexec', script)
2828
end
2929

3030
# Returns an absolute path to the root of the repository.

spec/integration/template_dir_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
describe 'template directory' do
4-
let(:template_dir) { File.join(Overcommit::OVERCOMMIT_HOME, 'template-dir') }
4+
let(:template_dir) { File.join(Overcommit::HOME, 'template-dir') }
55
let(:hooks_dir) { File.join(template_dir, 'hooks') }
66

77
it 'contains a hooks directory' do

spec/overcommit/installer_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
expect { subject }.to change {
137137
File.exist?('.overcommit.yml') && FileUtils.compare_file(
138138
'.overcommit.yml',
139-
File.join(Overcommit::OVERCOMMIT_HOME, 'config', 'starter.yml')
139+
File.join(Overcommit::HOME, 'config', 'starter.yml')
140140
)
141141
}.from(false).to(true)
142142
end

0 commit comments

Comments
 (0)