Module: Changit

Defined in:
lib/changit.rb,
lib/changit/cli.rb,
lib/changit/lexer.rb,
lib/changit/version.rb,
lib/changit/config_merger.rb,
lib/changit/config_reader.rb,
lib/changit/config_writer.rb,
lib/changit/git_dir_finder.rb,
lib/changit/lexer/section_token.rb,
lib/changit/lexer/key_value_token.rb

Defined Under Namespace

Classes: CLI, ConfigMerger, ConfigReader, ConfigWriter, GitDirFinder, Lexer

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.run(src_file, target_files) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/changit.rb', line 12

def self.run(src_file, target_files)
  # File to copy from
  config = ConfigReader.new(search_path: src_file).read

  # First, search directories inside the current pwd and make sure they contain a .git dir
  files_to_write_to = GitDirFinder.new(search_paths: target_files).find_all

  # Then, copy the gitconfig file content to each .git/config file in these directories
  ConfigWriter.new(config, files_to_write_to).write
end