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.1.0'

Class Method Summary collapse

Class Method Details

.runObject



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

def self.run
  # Initialize the CLI and fetch the parameters
  options = Changit::CLI.new.options

  # File to copy from
  config = ConfigReader.new(search_path: options[:src_path]).read

  # First, search directories inside the current pwd and make sure they contain a .git dir
  files_to_write_to = GitDirFinder.new(search_paths: options[:target_paths]).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